summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-07-12 17:45:06 -0400
committerRob Crittenden <rcritten@redhat.com>2010-07-13 09:29:10 -0400
commit1e1985b17c3988056bef045fa84a9c7aaf0c4c65 (patch)
tree3f95c4af67e71c42bacbdaaf6de7ba2217d1603b /ipaserver
parentc9e0b43d53eaf6def7d8f445734115450f8fecaf (diff)
downloadfreeipa-1e1985b17c3988056bef045fa84a9c7aaf0c4c65.tar.gz
freeipa-1e1985b17c3988056bef045fa84a9c7aaf0c4c65.tar.xz
freeipa-1e1985b17c3988056bef045fa84a9c7aaf0c4c65.zip
Add API to delete a service principal key, service-disable.
I have to do some pretty low-level LDAP work to achieve this. Since we can't read the key using our modlist generator won't work and lots of tricks would be needed to use the LDAPUpdate object in any case. I pulled usercertificate out of the global params and put into each appropriate function because it makes no sense for service-disable. This also adds a new variable, has_keytab, to service/host_show output. This flag tells us whether there is a krbprincipalkey.
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/plugins/ldap2.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index aebeb5c27..3c536e241 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -825,6 +825,22 @@ class ldap2(CrudBackend, Encoder):
"""Mark entry inactive."""
self.set_entry_active(dn, False)
+ def remove_principal_key(self, dn):
+ """Remove a kerberos principal key."""
+
+ dn = self.normalize_dn(dn)
+
+ # We need to do this directly using the LDAP library because we
+ # don't have read access to krbprincipalkey so we need to delete
+ # it in the blind.
+ mod = [(_ldap.MOD_REPLACE, 'krbprincipalkey', None),
+ (_ldap.MOD_REPLACE, 'krblastpwdchange', None)]
+
+ try:
+ self.conn.modify_s(dn, mod)
+ except _ldap.LDAPError, e:
+ self._handle_errors(e, **{})
+
# CrudBackend methods
def _get_normalized_entry_for_crud(self, dn, attrs_list=None):