idsldapdiff, ldapdiff
Use the ldapdiff command to identify the differences in a replica server and its master server. You can also synchronize the replica server with its master server.
Description
The idsldapdiff command is an LDAP client utility which is used to compare two directory subtrees on two different directory servers to determine whether their contents match. You can also use this command to synchronize any entries that do not match. You might want to synchronize the following two types of differences:
- Entries that have the same DN, but different contents.
- Entries that are present on one server, but not the other.
The following list shows the operational attributes that idsldapdiff compares and fixes.
- ACL-related
-
aclEntryaclPropagateaclSourceentryOwnerownerPropagateownerSourceibm-filterAclEntryibm-filterAclInherit
- Password policy-related
-
pwdChangedTimepwdResetibm-pwdAccountLockedibm-pwdIndividualPolicyDNibm-pwdGroupPolicyDN
- Other operational attributes
-
ibm-entryUuidcreatorsNamecreateTimeStampmodifiersNamemodifyTimeStamp
You must run the command when no updates are queued up or made on both the replica and master servers. The administrator must quiesce or suspend all update activities to the two subtrees that are compared. When you use the idsldapdiff command for compare operation, you must suspend update operations on the directory server. If the command is run while the updates are made, then all discrepancies might not be accurately reported or fixed.
If the command is run with the fix operation mode, use the command with the server administration
control, the -a option. With the server administration control option, the tool
writes to a read-only replica and also modifies operational attributes such as
ibm-entryUuid.
You can also use the idsldapdiff command to bring a master and replica server in sync before you start replication. For the command to function, it requires the base DN, which is being compared, exists on both servers. If the base DN does not exist on either of the servers, the command gives an error and then exits.
The command traverses to each entry in the subtree on the master server and compares its contents with the corresponding entry on the replica server. Since each entry is read, running the utility can take a long time and can generate lots of read requests to the master and replica servers. Depending on the number of differences and whether in the fix operation mode, the tool generates an equal amount of write requests to the replica server.
Ideally, use the tool when replication is set for the first time between the servers. For example, if your topology has two peer masters and two replica servers, you might want to run idsldapdiff between peer 1 and peer 2. Thereafter, if replication is suspended, run idsldapdiff concurrently between peer 1 and replica 1; and between peer 2 and replica 2. If replication is set up correctly, every change on a master server is propagated to its replica servers. If a replication problem occurs, the tool can be run to identify and correct the problems. This command is a diagnostic and corrective tool, it is not designed to run as routine maintenance. An administrator might decide to run the tool if there are replication-related errors in the log files.
idsldapdiff -?
- If the idsldapdiff command is used between a server of latest version and a server of previous supported version, then the tool reports differences for entries even if there are no user attribute changes. It is because of the higher granularity of timestamps in IBM® Security Verify Directory, version 6.2 and later, which is set to microseconds. Therefore, it is advisable not to use the idsldapdiff command in such scenarios.
- The idsldapdiff command shows an appropriate message after it finishes comparing every 100th entry.
Synopsis
To compare and optionally fix the differences:idsldapdiff | ldapdiff -b baseDN -sh host -ch host [-a] [-C countnumber]
[-cD dn] [-cK keyStore] [-cw password] -[cN keyStoreType]
[-cp port] [-cP keyStorePwd] [-ct trustStoreType]
[-cT trustStore] [-cY trustStorePwd] [-cZ] [-F] [-j]
[-L filename] [-O] [-sD dn] [-sK keyStore] [-sw password]
[-sN keyStoreType] [-sp port] [-sP keyStorePwd]
[-st trustStoreType] [-sT trustStore] [-sY trustStorePwd]
[-sZ]
To compare
schema:idsldapdiff | ldapdiff -S -sh host -ch host [-a] [-C countnumber]
[-cD dn] [-cK keyStore] [-cw password] -[cN keyStoreType]
[-cp port] [-cP keyStorePwd] [-ct trustStoreType]
[-cT trustStore] [-cY trustStorePwd] [-cZ] [-j]
[-L filename] [-O] [-sD dn] [-sK keyStore] [-sw password]
[-sN keyStoreType] [-sp port] [-sP keyStorePwd]
[-st trustStoreType] [-sT trustStore] [-sY trustStorePwd]
[-sZ]Guidelines for encryption
The idsldapdiff tool searches against cn=configuration to
determine the encryption settings on the server. For search and fix operations, the administrator DN
or administrator group DN is required. The tool fails if a bind DN other than the administrator DN
or an administrative group member DN is used. Global administrators cannot run the
idsldapdiff tool with compare and fix options. Only administrators and
administrator group members can run idsldapdiff with compare and fix options.
The master and replica servers can have different encryption settings. For example:
- Non-matching one-way encryption scheme
- Two-way and one-way encryption schemes
- Two-way encryption schemes with different key stash files
Based on the type of encryption that is used, the behavior of an operation might vary, when a password or any other encrypted attribute is encountered.
- Non-matching one-way encryption scheme
- With this encryption setting, the servers are configured with different types of one-way
encryption scheme. For example, the master server is set to use
shaand the replica server is set to usecryptencryption scheme. On running the idsldapdiff tool, the value on a replica server is directly overwritten with the value from the master server. Running the idsldapdiff tool a second time on the same entries does not show any difference. - Two-way and one-way encryption schemes
- In this encryption type, one of the servers is using a two-way encryption scheme like
AES, and the other server is using one-way encryption scheme such assha. Depending on whether the master server is using two-way or one-way encryption scheme, the results of the setup are different. When multiple encryption type is used, the performance of the idsldapdiff tool gets degraded. - Two-way encryption schemes with different key stash files
- In this case, both servers are using two-way encryption schemes but their stash files are generated with different seed or salt values. Since both servers decrypt, performance of the idsldapdiff tool is degraded. If the decrypted values are different, the synchronization process further degrades the performance of theidsldapdiff tool.
- The password policy attributes are synchronized by the idsldapdiff tool only if the password policy is enabled on both the servers.
- The idsldapdiff tool checks the encryption settings on both the servers. It shows warning messages if the encryption settings are different on both the servers, or if the seed and salt values are different on both servers.
- Use the idsldapdiff tool only for schema comparison. Do not use idsldapdiff with the -F option.
- If the server has some custom binary attributes, then the following
configuration for LDAP JNDI tools needs to be completed to get the resulting LDIF
file properly generated with these attributes and their values:
- Create <ISVD installation directory>/java/jre/lib/jndi.properties
- Add following line
Options
The options to the idsldapdiff command. There are two subgroups that apply only on the supplier server or the consumer server.- -a
- Specifies to include server administration control for writing to a read-only replica.
- -b baseDN
- Specifies to use the baseDN search base as the starting point for the search instead of the default. If -b is not specified, this tool examines the LDAP_BASEDN environment variable for a search base definition.
- -C countnumber
- Counts the number of non-matching entries. If more than the specified number of mismatches are found, the tool exits.
- -F
- Specifies to use the fix option. If specified, content on the replica server is modified to match the content of the master server. This option cannot be used if the -S is also specified.
- -j
- Excludes the following operational attributes from the LDIF file.
creatorsNamecreateTimeStampmodifiersNamemodifyTimeStamp
Note: The -j option is only valid when the -L option is specified. - -L filename
- Generate an LDIF file for output. Use this option only if the -F option is
not specified. The LDIF file can be used to update the replica server to eliminate the differences.Note: If the server has some custom binary attributes, then you must configure the LDAP JNDI tools to ensure that the resulting ldif file is generated with the correct attributes and values by using the following steps:
- Create <ISDS installation directory>/java/jre/lib/jndi.properties.
- Add the following line.
java.naming.ldap.attributes.binary=<space separated list of all the custom binary attributes>
- -O
- Specifies to list DNs for non-matching entries. Note: This option overrides the -F and -L options.
- -S
- Specifies to compare the schema on both of the servers. Compares and fixes by using the -S option can be made with any bind DN.
- -x
- Ignores extra entries on the replica. The idsldapdiff tool takes two passes to synchronize the servers. In the first pass, idsldapdiff traverses the master server and does the following actions:
- Adds any extra entries on the master to the replica
- Compares and fixes entries that exist on both the servers
- Options for a replication supplier server
-
The following options apply to a replication supplier server and are denoted by a prefix
sin the option.- -sD dn
- Specifies to use dn to bind to an LDAP directory. The dn variable is a string-represented value.
- -sh host
- Specifies the host name.
- -sK keystore
- Specifies the name of the SSL keystore file with the default extension of
jks. If the key database file is not in the current directory, specify the
fully qualified keystore file name.
- In an environment where self-signed certificates are used, with supplier LDAP server
ibm-slapdSslAuthset toserverAuththis keystore file may contain a client side personal self-signed certificate. There is no need to add this client side personal certificate into the supplier LDAP server's key database (kdb) file. - In an environment where self-signed certificates are used, with supplier LDAP server
ibm-slapdSslAuthset toserverClientAuththis keystore file must contain a client side personal self-signed certificate. This client side personal certificate must be added into the supplier LDAP server's key database (kdb) file. - In an environment where CA signed certificates are used, with supplier LDAP server
ibm-slapdSslAuthset toserverAuththis keystore file may contain a client side personal certificate signed by the same CA. - In an environment where CA signed certificates are used, with supplier LDAP server
ibm-slapdSslAuthset toserverClientAuththis keystore file must contain a client side personal certificate signed by the same CA.
This parameter effectively enables the -sZ switch.
When you use the -sK parameter, you must also use the following flags with valid values: -sP, -sN, -sT, -sY, -st.
- In an environment where self-signed certificates are used, with supplier LDAP server
- -sN keyStoreType
- Specifies the type of the SSL keystore. For this version of idsldapdiff the only supported type is jks. This parameter is ignored if the -sZ or -sK parameter is not specified.
- -sp ldapport
- Specifies a port for the LDAP server to listen. The default LDAP port is 389. If -sp is not specified and -sZ is specified, the default LDAP secure port, 636, is used.
- -sP keyStorePwd
- Specifies the keystore password. This password is required to access the encrypted information in the keystore file, which might include one or more private keys. This parameter is ignored if -sZ or -sK is not specified.
- -st trustStoreType
- Specifies the type of the SSL truststore. For this version of idsldapdiff the only supported type is jks. This parameter is ignored if -sZ or -sT is not specified.
- -sT trustStore
- Specifies the name of the SSL truststore file with default extension of
jks. If the truststore file is not in the current directory, specify the fully
qualified truststore file name. This truststore file can be the same as or different from the file
keystore (see the description of the -sK flag).
- In an environment where self-signed certificates are used, the supplier LDAP server's personal self-signed certificate must be added to this trustStore.
- In an environment where CA signed certificates are used, all applicable root and intermediate(if any) certificates must be added to this trustStore.
This parameter effectively enables the -sZ switch.
- -sw password | ?
- Specifies to use password as the password for authentication. Use the
?to generate a password prompt. The password prompt option prevents your password from being visible when you use the ps command. - -sY trustStorePwd
- Specifies a password for the trusted store file. This password is required to access the encrypted information in the truststore file, which can include one or more private keys.
- -sZ
- Specifies to use a secure SSL connection to communicate with an LDAP server.
- Options for a replication consumer server
-
The following options apply to a replication consumer server and are denoted by a prefix
cin the option.- -cD dn
- Specifies to use dn to bind to an LDAP directory. The dn variable is a string-represented value.
- -ch host
- Specifies the host name.
- -cK keystore
- Specifies the name of the SSL keystore file with the default extension of
jks. If the keystore file is not in the current directory, specify the fully
qualified keystore file name.
- In an environment where self-signed certificates are used, with consumer LDAP server
ibm-slapdSslAuthset toserverAuththis keystore file may contain a client side personal self-signed certificate. There is no need to add this client side personal certificate into the consumer LDAP server's key database (kdb) file. - In an environment where self-signed certificates are used, with consumer LDAP server
ibm-slapdSslAuthset toserverClientAuththis keystore file must contain a client side personal self-signed certificate. This client side personal certificate must be added into the consumer LDAP server's key database (kdb) file. - In an environment where CA signed certificates are used, with consumer LDAP server
ibm-slapdSslAuthset toserverAuththis keystore file may contain a client side personal certificate signed by the same CA. - In an environment where CA signed certificates are used, with consumer LDAP server
ibm-slapdSslAuthset toserverClientAuththis keystore file must contain a client side personal certificate signed by the same CA.
This parameter effectively enables the -cZ switch. The -cK parameter also requires you to provide the following flags with appropriate values: -cP, -cN, -cT, -cY, -ct.
- In an environment where self-signed certificates are used, with consumer LDAP server
- -cN keyStoreType
- Specifies the type of the SSL keystore. For this version of idsldapdiff the only supported type is jks. This parameter is ignored if the -cZ or -cK parameter is not specified.
- -cp ldapport
- Specifies a port for the LDAP server to listen. The default LDAP port is 389. If -cp is not specified and -cZ is specified, the default LDAP secure port, 636, is used.
- -cP keyStorePwd
- Specifies the keystore password. This password is required to access the encrypted information in the keystore file, which might include one or more private keys. This parameter is ignored if -cZ or -cK is not specified.
- -ct trustStoreType
- Specifies the type of the SSL truststore. For this version of idsldapdiff the only supported type is jks. This parameter is ignored if -cZ or -cT is not specified.
- -cT trustStore
- Specifies the name of the SSL truststore file with default extension of
jks. If the trust database file is not in the current directory, specify the
fully qualified truststore file name. This truststore file can be same as or different from the
keystore file (see the -sK flag description).
- In an environment where self-signed certificates are used, the consumer LDAP server's personal self-signed certificate must be added to this trustStore.
- In an environment where CA signed certificates are used, all applicable root and intermediate(if any) certificates must be added to this trustStore.
This parameter effectively enables the -cZ switch.
- -cw password | ?
- Specifies to use password as the password for authentication. Use the
?to generate a password prompt. The password prompt option prevents your password from being visible when you use the ps command. - -cY trustStorePwd
- Specifies a password for the trusted store file. This password is required to access the encrypted information in the truststore file, which can include one or more private keys.
- -cZ
- Specifies to use a secure SSL connection to communicate with an LDAP server.
Notes®
If no DN arguments are provided, the idsldapdiff command waits to read a list of DNs from standard input. To exit from the command prompt, use Ctrl+D on UNIX® systems. On Windows™ systems, use Ctrl+Z.Exit status
Exit status is0 if no errors occur. If exit
status is non-zero, then an error occurred. When error occurs, messages are written to the standard
error.Security functions
To use the SSL or TLS-related functions that are associated with this utility, see "SSL, TLS notes" in the IBM Security Verify Directory Version 10.0.4 Command Reference.Examples
- Example 1:
- To see the differences that the tool reports, consider two servers one a master server and other
a replica server. Consider that the suffix
o=sampleis present on both the servers. The entries in the master and replica servers are represented by using the two LDIF files, master.ldif and replica.ldif. - Example 2:
- To find differences in schema of directory servers, run the idsldapdiff command.
- Example 3:
- To compare and optionally fix the differences when the servers are configured for secure communications, run the following command:
- Example 4:
- To compare schemas of servers that are configured for secure communications, run the following command: