31.2. Managing IdM permissions in the CLI
Follow this procedure to manage Identity Management (IdM) permissions using the command line (CLI).
Prerequisites
- Administrator privileges for managing IdM or the User Administrator role.
- An active Kerberos ticket. For details, see Using kinit to log in to IdM manually.
Procedure
Create new permission entries with the
ipa permission-addcommand. For example, to add a permission named dns admin:$ ipa permission-add "dns admin"Specify the properties of the permission with the following options:
--bindtypespecifies the bind rule type. This option accepts theall,anonymous, andpermissionarguments. Thepermissionbindtype means that only the users who are granted this permission via a role can exercise it.For example:
$ ipa permission-add "dns admin" --bindtype=allIf you do not specify
--bindtype, thenpermissionis the default value.참고It is not possible to add permissions with a non-default bind rule type to privileges. You also cannot set a permission that is already present in a privilege to a non-default bind rule type.
--rightlists the rights granted by the permission, it replaces the deprecated--permissionsoption. The available values areadd,delete,read,search,compare,write,all.You can set multiple attributes by using multiple
--rightoptions or with a comma-separated list inside curly braces. For example:$ ipa permission-add "dns admin" --right=read --right=write $ ipa permission-add "dns admin" --right={read,write}참고addanddeleteare entry-level operations (for example, deleting a user, adding a group, and so on) whileread,search,compareandwriteare more attribute-level: you can write touserCertificatebut not readuserPassword.--attrsgives the list of attributes over which the permission is granted.You can set multiple attributes by using multiple
--attrsoptions or by listing the options in a comma-separated list inside curly braces. For example:$ ipa permission-add "dns admin" --attrs=description --attrs=automountKey $ ipa permission-add "dns admin" --attrs={description,automountKey}The attributes provided with
--attrsmust exist and be allowed attributes for the given object type, otherwise the command fails with schema syntax errors.--typedefines the entry object type to which the permission applies, such as user, host, or service. Each type has its own set of allowed attributes. For example:$ ipa permission-add "manage service" --right=all --type=service --attrs=krbprincipalkey --attrs=krbprincipalname --attrs=managedby--subtreegives a subtree entry; the filter then targets every entry beneath this subtree entry. Provide an existing subtree entry;--subtreedoes not accept wildcards or non-existent domain names (DNs). Include a DN within the directory.Because IdM uses a simplified, flat directory tree structure,
--subtreecan be used to target some types of entries, like automount locations, which are containers or parent entries for other configuration. For example:$ ipa permission-add "manage automount locations" --subtree="ldap://ldap.example.com:389/cn=automount,dc=example,dc=com" --right=write --attrs=automountmapname --attrs=automountkey --attrs=automountInformation참고The
--typeand--subtreeoptions are mutually exclusive: you can see the inclusion of filters for--typeas a simplification of--subtree, intending to make life easier for an admin.--filteruses an LDAP filter to identify which entries the permission applies to.IdM automatically checks the validity of the given filter. The filter can be any valid LDAP filter, for example:
$ ipa permission-add "manage Windows groups" --filter="(!(objectclass=posixgroup))" --right=write --attrs=description--memberofsets the target filter to members of the given group after checking that the group exists. For example, to let the users with this permission modify the login shell of members of the engineers group:$ ipa permission-add ManageShell --right="write" --type=user --attr=loginshell --memberof=engineers참고Setting the
memberofattribute permission is not applied if the target LDAP entry does not contain any reference to group membership.--targetgroupsets target to the specified user group after checking that the group exists. For example, to let those with the permission write the member attribute in the engineers group (so they can add or remove members):$ ipa permission-add ManageMembers --right="write" --subtree=cn=groups,cn=accounts,dc=example,dc=test --attr=member --targetgroup=engineersOptionally, you can specify a target domain name (DN):
-
--targetspecifies the DN to apply the permission to. Wildcards are accepted. -
--targettospecifies the DN subtree where an entry can be moved to. -
--targetfromspecifies the DN subtree from where an entry can be moved.
-