Provide API for management of host, service, and user principal aliases

New commands (*-{add,remove}-principal [PKEY] [PRINCIPAL ...])
were added to manage principal aliases.

'add' commands will check the following:
* the correct principal type is supplied as an alias
* the principals have correct realm and the realm/alternative suffix (e.g.
  e-mail) do not overlap with those of trusted AD domains

If the entry does not have canonical principal name, the first returned
principal name will be set as one. This is mostly to smoothly operate on
entries created on older servers.

'remove' commands will check that there is at least one principal alias equal
to the canonical name left on the entry.

See also: http://www.freeipa.org/page/V4/Kerberos_principal_aliases

https://fedorahosted.org/freeipa/ticket/1365
https://fedorahosted.org/freeipa/ticket/3961
https://fedorahosted.org/freeipa/ticket/5413

Reviewed-By: David Kupka <dkupka@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Babinsky
2016-07-01 09:37:25 +02:00
committed by Martin Basti
parent a28d312796
commit e6ff83e361
8 changed files with 299 additions and 42 deletions
+23 -1
View File
@@ -43,7 +43,9 @@ from .baseuser import (
convert_nsaccountlock,
fix_addressbook_permission_bindrule,
baseuser_add_manager,
baseuser_remove_manager)
baseuser_remove_manager,
baseuser_add_principal,
baseuser_remove_principal)
from .idviews import remove_ipaobject_overrides
from ipalib.plugable import Registry
from .baseldap import (
@@ -287,6 +289,14 @@ class user(baseuser):
'Modify Users and Reset passwords',
},
},
'System: Manage User Principals': {
'ipapermright': {'write'},
'ipapermdefaultattr': {'krbprincipalname', 'krbcanonicalname'},
'default_privileges': {
'User Administrators',
'Modify Users and Reset passwords',
},
},
'System: Modify Users': {
'ipapermright': {'write'},
'ipapermdefaultattr': {
@@ -1187,3 +1197,15 @@ class user_add_manager(baseuser_add_manager):
@register()
class user_remove_manager(baseuser_remove_manager):
__doc__ = _("Remove a manager to the user entry")
@register()
class user_add_principal(baseuser_add_principal):
__doc__ = _('Add new principal alias to the user entry')
msg_summary = _('Added new aliases to user "%(value)s"')
@register()
class user_remove_principal(baseuser_remove_principal):
__doc__ = _('Remove principal alias from the user entry')
msg_summary = _('Removed aliases from user "%(value)s"')