Upgrade and Configure Symas OpenLDAP 2.6 Server with Replication on RHEL/CentOS 8
Learn how to upgrade and configure Symas OpenLDAP 2.6 server with replication on RHEL/CentOS 8 for robust, reliable directory services.
Table of Contents
General Upgrade Procedures
Generally, you can add a node to an LDAP cluster without taking down the LDAP environment. A server with SOLD 2.4 will replicate with a SOLD 2.6 server, but this should only be temporary. The following scenario is for updating/upgrading during a maintenance window.
Change
dc=example,dc=comto the root suffix of your environment.
Update Current Configuration
1. Backup the current configuration and database
For nodes using a dynamic configuration (slapd.d)
slapcat -n 0 -l /tmp/slapd24.config.ldifcp slapd24-config.ldif slapd26-config.ldifFor nodes using a static configuration (slapd.conf)
cp slapd.conf slapd.conf.26Backup of the current database
slapcat -b dc=example,dc=com -l /tmp/database.ldif2. Uninstall the OpenLDAP 2.4 server and client binaries. Perform this step if you are doing an “in place” upgrade.
a. For Symas OpenLDAP Gold, remove symas-openldap-gold.
b. For RHEL Symas OpenLDAP for Linux, remove symas-openldap-clients symas-openldap-servers
3. To modify the existing configuration for SOLD 2.6, update the following lines:
General Updates
Dynamic Config
olcArgsFile: /var/symas/run/slapd.args
olcPidFile: /var/symas/run/slapd.pid
olcModulePath: /opt/symas/lib/openldapStatic Config
pidfile /var/symas/run/slapd.pid
argsfile /var/symas/run/slapd.args
modulepath /opt/symas/lib/openldap If Using Multival
Dynamic Config
olcDbMultival: default 50,10Static Config
multival default 50,10If Using ppolicy
If the ppolicy (not ppolicy10) overlay is in use, then the ppolicy schema must be removed from the configuration file.
If Using ppolicy10
If the ppolicy10 (not ppolicy) overlay is in use, then all references to "ppolicy10" must be changed to "ppolicy" in the configuration file.
If Using pwdPolicyCheckModule
Update ppolicy entries by adding pwdPolicyUseCheckModule: TRUE and removing "pwdCheckModule" attribute.
If Using OTP_2FA overlay
Any reference to "otp_2fa" in the configuration file must be replaced with "otp."
If Using remoteauth With TLS handling
remoteauth_tls_pin was renamed to remoteauth_tls_peerkey_hash.
The individual TLS configuration variables:
remoteauth_cacert_dir
remoteauth_cacert_file
remoteauth_starttls
remoteauth_validate_certsAre replaced with a single keyword:
remoteauth_tlsIf Using pw-argon2.la
Replaced pw-argon2.la with argaon2.la
Configuring LDAP server
Install Symas OpenLDAP on RHEL 8 Server
1.
wget -q https://repo.symas.com/configs/SOLDAP/rhel8/release26.repo -O /etc/yum.repos.d/soldap-release26.repo2.
dnf update3.
dnf install symas-openldap-clients symas-openldap-serversIf you are performing an “in place” upgrade and logging is already enabled, skip to Setup OpenLDAP Environment.
Configure slapd Log and Rotation
Method 1
1. Add log values to slapd.conf
vi /opt/symas/etc/openldap/slapd.confRecommended Settings
logfile /var/log/slapd.log
logfile-format syslog-utc
logfile-only on
logfile-rotate 7 1000 24 More information can be found here: https://www.openldap.org/software/man.cgi?query=slapd.conf&manpath=OpenLDAP+2.6-Release.
Method 2
1. Modify rsyslog.conf to redirect slapd messages to slapd.log
vi /etc/rsyslog.confSave slapd/solserver messages to slapd.log:
local4.* -/var/log/slapd.log 2. Create the slapd.log file
touch /var/log/slapd.log3. Restart the rsyslog service
systemctl restart rsyslog.service4. Create the log rotation configuration file
vi /etc/logrotate.d/slapd/var/log/slapd.log
{
rotate 7
daily
missingok
notifempty
compress
postrotate
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
endscript
}Setup OpenLDAP Environment
Configure First Provider/Master
1. Create the main database directory, accesslog directory and configuration directory. Replace example and dc=example,dc=com with the your environment variables.
mkdir -p /var/symas/openldap-data/example
mkdir -p /var/symas/openldap-data/accesslog
mkdir -p /opt/symas/etc/openldap/slapd.dThe last line, mkdir -p /opt/symas/etc/openldap/slapd.d, is for an environment using a dynamic configuration
2. Sometimes it is necessary to provide more resources to the slapd process to override system limitations. Most commonly this is the number of file descriptors available to the process. The following is an example of how this is done with Symas OpenLDAP 2.6.
mkdir -p /etc/systemd/system/symas-openldap-server.service.d3. Create the file override.conf
vi /etc/systemd/system/symas-openldap-server.service.d/override.conf4. Add the following (The following content will allow the slapd process to have up to approximately 524,000 active connections):
[Service]
LimitNOFILE=5242885. The systemd daemon must be reloaded for this to take effect:
sudo systemctl daemon-reload6. By default, the slapd process will run as the root user and listen on ldap:/// and ldapi:///. To change these settings requires making a systemd override file:
vi edit /etc/default/symas-openldapSLAPD_URLS="ldap:/// ldaps:/// ldapi:///"Options that can be overridden:
SLAPD_URLS - URLS to listen on
SLAPD_OPTIONS - Additional options to pass to slapd, including user and group
For example, to listen on the ldap, ldaps, and ldapi ports and socket:
SLAPD_URLS="ldap:/// ldaps:/// ldapi:///"To run as the user and group ldap:
SLAPD_OPTIONS="-u ldap -g ldap"7. Load the configuration file to the environment:
Dynamic Configuration:
slapadd -F /opt/symas/etc/openldap/slapd.d -n 0 -l /tmp/slapd26-config.ldifStatic Configuration:
cp slapd.conf.26 /opt/symas/etc/openldap/slapd.conf8. Load the database:
slapadd -q -F /opt/symas/etc/openldap/slapd.d -b dc=example,dc=com -l /tmp/database.ldif9. Start the slapd service:
systemctl start slapd10. Perform a `slapcat` of database that will be loaded on the next server.
slapcat -b dc=example,dc=com -l /tmp/db_backup.ldifPlease note: the 'olcServerID' must be unique on all provider/master servers.
If the data needs to be validated then use the slapadd command with the proper -o options, example:
/opt/symas/bin/slapadd -o schema-check=yes -o value-check=yes -b dc=example,dc=com -l database.ldifThis will significantly increase the database load time, but will perform more data integrity checks. This will avoid replication issues.
Configure Second Provider/Master
1. Perform steps 1 through 7 from the Configure First Provider/Master section.
2. Make sure that the appropriate changes have been made to the configuration.
a. olcServerID / serverID must be unique.
b. olcTLSCertificateFile / TLSCertificateFile and olcTLSCertificateKeyFile / TLSCertificateKeyFile must use server appropriate certificate.
c. olcSyncrepl / syncrepl stanza must have the correct server(s) listed.
4. Load the database that was created in the previous section (Step 10 in Configure First Provider/Master):
slapadd -q -b dc=example,d=com -l /tmp/db_backup.ldif5. Start the slapd service.
6. Verify that the servers are replicating by making a change on both, and verify those changes are reflected on each server.
Configure Replica(s)/Slave(s)
1. Perform steps 1 through 7 from the Configure First Provider/Master section
2. Make sure that the appropriate changes have been made to the configuration:
a. olcTLSCertificateFile / TLSCertificateFile and olcTLSCertificateKeyFile / TLSCertificateKeyFile must use server appropriate certificate.
b. olcSyncrepl / syncrepl stanza must have the correct server(s) listed.
3. Load the database that was created in the previous section (Step 10 in Configure First Provider/Master):
slapadd -q -b dc=example,d=com -l /tmp/db_backup.ldif4. Start the slapd service.
5. Verify that the servers are replicating by making a change on a provider, and verifying the data is correct on the replica/slave.