Este conteúdo não está disponível no idioma selecionado.
Chapter 10. Using ldapmodify to manage IdM users externally
As an IdM administrators you can use the ipa
commands to manage your directory content. Alternatively, you can use the ldapmodify
command to achieve similar goals. You can use this command interactively and provide all the data directly in the command line. You also can provide data in the file in the LDAP Data Interchange Format (LDIF) to ldapmodify
command.
10.1. Templates for managing IdM user accounts externally Copiar o linkLink copiado para a área de transferência!
The following templates can be used for various user management operations in IdM. The templates show which attributes you must modify using ldapmodify
to achieve the following goals:
- Adding a new stage user
- Modifying a user’s attribute
- Enabling a user
- Disabling a user
- Preserving a user
The templates are formatted in the LDAP Data Interchange Format (LDIF). LDIF is a standard plain text data interchange format for representing LDAP directory content and update requests.
Using the templates, you can configure the LDAP provider of your provisioning system to manage IdM user accounts.
For detailed example procedures, see the following sections:
Templates for adding a new stage user
A template for adding a user with UID and GID assigned automatically. The distinguished name (DN) of the created entry must start with
uid=user_login
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow A template for adding a user with UID and GID assigned statically:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You are not required to specify any IdM object classes when adding stage users. IdM adds these classes automatically after the users are activated.
Templates for modifying existing users
Modifying a user’s attribute:
dn: distinguished_name changetype: modify replace: attribute_to_modify attribute_to_modify: new_value
dn: distinguished_name changetype: modify replace: attribute_to_modify attribute_to_modify: new_value
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Disabling a user:
dn: distinguished_name changetype: modify replace: nsAccountLock nsAccountLock: TRUE
dn: distinguished_name changetype: modify replace: nsAccountLock nsAccountLock: TRUE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enabling a user:
dn: distinguished_name changetype: modify replace: nsAccountLock nsAccountLock: FALSE
dn: distinguished_name changetype: modify replace: nsAccountLock nsAccountLock: FALSE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Updating the
nssAccountLock
attribute has no effect on stage and preserved users. Even though the update operation completes successfully, the attribute value remainsnssAccountLock: TRUE
.Preserving a user:
dn: distinguished_name changetype: modrdn newrdn: uid=user_login deleteoldrdn: 0 newsuperior: cn=deleted users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=com
dn: distinguished_name changetype: modrdn newrdn: uid=user_login deleteoldrdn: 0 newsuperior: cn=deleted users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Before modifying a user, obtain the user’s distinguished name (DN) by searching using the user’s login. In the following example, the user_allowed_to_modify_user_entries user is a user allowed to modify user and group information, for example activator or IdM administrator. The password in the example is this user’s password:
[...] # ldapsearch -LLL -x -D "uid=user_allowed_to_modify_user_entries,cn=users,cn=accounts,dc=idm,dc=example,dc=com" -w "Secret123" -H ldap://r8server.idm.example.com -b "cn=users,cn=accounts,dc=idm,dc=example,dc=com" uid=test_user dn: uid=test_user,cn=users,cn=accounts,dc=idm,dc=example,dc=com memberOf: cn=ipausers,cn=groups,cn=accounts,dc=idm,dc=example,dc=com
[...]
# ldapsearch -LLL -x -D "uid=user_allowed_to_modify_user_entries,cn=users,cn=accounts,dc=idm,dc=example,dc=com" -w "Secret123" -H ldap://r8server.idm.example.com -b "cn=users,cn=accounts,dc=idm,dc=example,dc=com" uid=test_user
dn: uid=test_user,cn=users,cn=accounts,dc=idm,dc=example,dc=com
memberOf: cn=ipausers,cn=groups,cn=accounts,dc=idm,dc=example,dc=com
10.2. Templates for managing IdM group accounts externally Copiar o linkLink copiado para a área de transferência!
The following templates can be used for various user group management operations in IdM. The templates show which attributes you must modify using ldapmodify
to achieve the following aims:
- Creating a new group
- Deleting an existing group
- Adding a member to a group
- Removing a member from a group
The templates are formatted in the LDAP Data Interchange Format (LDIF). LDIF is a standard plain text data interchange format for representing LDAP directory content and update requests.
Using the templates, you can configure the LDAP provider of your provisioning system to manage IdM group accounts.
Creating a new group
Modifying groups
Deleting an existing group:
dn: group_distinguished_name changetype: delete
dn: group_distinguished_name changetype: delete
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Adding a member to a group:
dn: group_distinguished_name changetype: modify add: member member: uid=user_login,cn=users,cn=accounts,dc=idm,dc=example,dc=com
dn: group_distinguished_name changetype: modify add: member member: uid=user_login,cn=users,cn=accounts,dc=idm,dc=example,dc=com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Do not add stage or preserved users to groups. Even though the update operation completes successfully, the users will not be updated as members of the group. Only active users can belong to groups.
Removing a member from a group:
dn: distinguished_name changetype: modify delete: member member: uid=user_login,cn=users,cn=accounts,dc=idm,dc=example,dc=com
dn: distinguished_name changetype: modify delete: member member: uid=user_login,cn=users,cn=accounts,dc=idm,dc=example,dc=com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Before modifying a group, obtain the group’s distinguished name (DN) by searching using the group’s name.
10.3. Using ldapmodify command interactively Copiar o linkLink copiado para a área de transferência!
You can modify Lightweight Directory Access Protocol (LDAP) entries in the interactive mode.
Procedure
In a command line, enter the LDAP Data Interchange Format (LDIF) statement after the
ldapmodify
command.Example 10.1. Changing the telephone number for a testuser
ldapmodify -Y GSSAPI -H ldap://server.example.com
# ldapmodify -Y GSSAPI -H ldap://server.example.com dn: uid=testuser,cn=users,cn=accounts,dc=example,dc=com changetype: modify replace: telephoneNumber telephonenumber: 88888888
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that you need to obtain a Kerberos ticket for using
-Y
option.-
Press
Ctlr+D
to exit the interactive mode. Alternatively, provide an LDIF file after
ldapmodify
command:Example 10.2. The
ldapmodify
command reads modification data from an LDIF fileldapmodify -Y GSSAPI -H ldap://server.example.com -f ~/example.ldif
# ldapmodify -Y GSSAPI -H ldap://server.example.com -f ~/example.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.4. Preserving an IdM user with ldapmodify Copiar o linkLink copiado para a área de transferência!
You can use ldapmodify
to preserve an IdM user; that is, how to deactivate a user account after the employee has left the company.
Prerequisites
- You can authenticate as an IdM user with a role to preserve users.
Procedure
Log in as an IdM user with a role to preserve users:
kinit admin
$ kinit admin
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the
ldapmodify
command and specify the Generic Security Services API (GSSAPI) as the Simple Authentication and Security Layer (SASL) mechanism to be used for authentication:ldapmodify -Y GSSAPI
# ldapmodify -Y GSSAPI SASL/GSSAPI authentication started SASL username: admin@IDM.EXAMPLE.COM SASL SSF: 256 SASL data security layer installed.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the
dn
of the user you want to preserve:dn: uid=user1,cn=users,cn=accounts,dc=idm,dc=example,dc=com
dn: uid=user1,cn=users,cn=accounts,dc=idm,dc=example,dc=com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter modrdn as the type of change you want to perform:
changetype: modrdn
changetype: modrdn
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Specify the newrdn for the user:
newrdn: uid=user1
newrdn: uid=user1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Indicate that you want to preserve the user:
deleteoldrdn: 0
deleteoldrdn: 0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Specify the new superior DN:
newsuperior: cn=deleted users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=com
newsuperior: cn=deleted users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Preserving a user moves the entry to a new location in the directory information tree (DIT). For this reason, you must specify the DN of the new parent entry as the new superior DN.
Press
Enter
again to confirm that this is the end of the entry:[Enter] modifying rdn of entry "uid=user1,cn=users,cn=accounts,dc=idm,dc=example,dc=com"
[Enter] modifying rdn of entry "uid=user1,cn=users,cn=accounts,dc=idm,dc=example,dc=com"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Exit the connection using Ctrl + C.
Verification
Verify that the user has been preserved by listing all preserved users:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow