Este contenido no está disponible en el idioma seleccionado.
Chapter 9. Using ldapmodify to manage IdM users externally
You can use the ldapmodify command to manage Identity Management (IdM) user and group entries as an alternative to the ipa command-line utilities. The ldapmodify command supports both interactive input and LDIF files for bulk operations.
9.1. Templates for managing IdM user accounts externally Copiar enlaceEnlace copiado en el portapapeles!
Use LDIF templates with ldapmodify to manage Identity Management (IdM) user accounts from an external provisioning system, enabling automated user creation, modification, enabling, disabling, and preservation.
Update specific LDAP attributes with the ldapmodify utility to manage user accounts and states. Use the provided syntax to perform the following administrative tasks:
- 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.
- 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:dn: uid=user_login,cn=staged users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=com changetype: add objectClass: top objectClass: inetorgperson uid: user_login sn: surname givenName: first_name cn: full_nameA template for adding a user with UID and GID assigned statically:
dn: uid=user_login,cn=staged users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=com changetype: add objectClass: top objectClass: person objectClass: inetorgperson objectClass: organizationalperson objectClass: posixaccount uid: user_login uidNumber: UID_number gidNumber: GID_number sn: surname givenName: first_name cn: full_name homeDirectory: /home/user_loginYou 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_valueDisabling a user:
dn: distinguished_name changetype: modify replace: nsAccountLock nsAccountLock: TRUEEnabling a user:
dn: distinguished_name changetype: modify replace: nsAccountLock nsAccountLock: FALSE
Updating the
nssAccountLockattribute 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
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://server.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
9.2. Templates for managing IdM group accounts externally Copiar enlaceEnlace copiado en el portapapeles!
Use LDAP Data Interchange Format (LDIF) templates with ldapmodify to manage Identity Management (IdM) user group accounts from an external provisioning system, enabling automated group creation, member management, and deletion.
Modify specific LDAP attributes using the ldapmodify utility to manage group configurations. Use the provided syntax to perform the following administrative tasks:
- 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 LDIF, 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
dn: cn=group_name,cn=groups,cn=accounts,dc=idm,dc=example,dc=com
changetype: add
objectClass: top
objectClass: ipaobject
objectClass: ipausergroup
objectClass: groupofnames
objectClass: nestedgroup
objectClass: posixgroup
uid: group_name
cn: group_name
gidNumber: GID_number
- Modifying groups
- Deleting an existing group:
dn: group_distinguished_name changetype: deleteAdding 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=comDo 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
Before modifying a group, obtain the group’s distinguished name (DN) by searching using the group’s name.
# ldapsearch -YGSSAPI -H ldap://<server.idm.example.com> -b "<cn=groups,cn=accounts,dc=idm,dc=example,dc=com>" "cn=<group_name>"
dn: cn=group_name,cn=groups,cn=accounts,dc=idm,dc=example,dc=com
ipaNTSecurityIdentifier: S-1-5-21-1650388524-2605035987-2578146103-11017
cn: testgroup
objectClass: top
objectClass: groupofnames
objectClass: nestedgroup
objectClass: ipausergroup
objectClass: ipaobject
objectClass: posixgroup
objectClass: ipantgroupattrs
ipaUniqueID: 569bf864-9d45-11ea-bea3-525400f6f085
gidNumber: 1997010017
9.3. Using ldapmodify command interactively Copiar enlaceEnlace copiado en el portapapeles!
Modify LDAP entries in Identity Management (IdM) interactively using ldapmodify by entering LDIF statements directly in the terminal or by loading them from a file.
Procedure
In a command line, enter the LDAP Data Interchange Format (LDIF) statement after the
ldapmodifycommand.For example, to change the telephone number for a
<testuser>:# ldapmodify -Y GSSAPI -H ldap://<server.example.com> dn: uid=testuser,cn=users,cn=accounts,dc=example,dc=com changetype: modify replace: telephoneNumber telephonenumber: 88888888Note that you need to obtain a Kerberos ticket for using
-Yoption.-
Press
Ctlr+Dto exit the interactive mode. Alternatively, provide an LDIF file after
ldapmodifycommand:The
ldapmodifycommand reads modification data from an LDIF file# ldapmodify -Y GSSAPI -H ldap://<server.example.com> -f ~/example.ldif
9.4. Preserving an IdM user with ldapmodify Copiar enlaceEnlace copiado en el portapapeles!
Deactivate Identity Management (IdM) user accounts using ldapmodify to preserve user data when employees leave your organization. Preserved users retain their information for auditing while preventing authentication.
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 adminEnter the
ldapmodifycommand 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 SASL/GSSAPI authentication started SASL username: admin@IDM.EXAMPLE.COM SASL SSF: 256 SASL data security layer installed.Enter the
dnof the user you want to preserve:dn: uid=user1,cn=users,cn=accounts,dc=idm,dc=example,dc=comEnter modrdn as the type of change you want to perform:
changetype: modrdnSpecify the newrdn for the user:
newrdn: uid=user1Indicate that you want to preserve the user:
deleteoldrdn: 0Specify the new superior DN:
newsuperior: cn=deleted users,cn=accounts,cn=provisioning,dc=idm,dc=example,dc=comPreserving 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
Enteragain 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"- Exit the connection using Ctrl + C.
Verification
Verify that the user has been preserved by listing all preserved users:
$ ipa user-find --preserved=true -------------- 1 user matched -------------- User login: user1 First name: First 1 Last name: Last 1 Home directory: /home/user1 Login shell: /bin/sh Principal name: user1@IDM.EXAMPLE.COM Principal alias: user1@IDM.EXAMPLE.COM Email address: user1@idm.example.com UID: 1997010003 GID: 1997010003 Account disabled: True Preserved user: True ---------------------------- Number of entries returned 1 ----------------------------