diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py index d52cdc1e2..007357b25 100644 --- a/ipaserver/plugins/cert.py +++ b/ipaserver/plugins/cert.py @@ -321,7 +321,10 @@ def bind_principal_can_manage_cert(cert): A python-cryptography ``Certificate`` object. """ - bind_principal = kerberos.Principal(getattr(context, 'principal')) + op_account = getattr(context, 'principal', None) + if op_account is None: + return False + bind_principal = kerberos.Principal(op_account) if not bind_principal.is_host: return False @@ -691,7 +694,15 @@ class cert_request(Create, BaseCertMethod, VirtualCommand): principal_string = unicode(principal) principal_type = principal_to_principal_type(principal) - bind_principal = kerberos.Principal(getattr(context, 'principal')) + op_account = getattr(context, 'principal', None) + if op_account is None: + # Can the bound principal request certs for another principal? + # the virtual operation check will rely on LDAP ACIs, no need + # for the Kerberos principal here. + # Force the principal that cannot be matched in normal deployments + op_account = '@' + + bind_principal = kerberos.Principal(op_account) bind_principal_string = unicode(bind_principal) bind_principal_type = principal_to_principal_type(bind_principal)