IAM appliance - iam-app-directory-server
RPM package with OpenLDAP container (openldap-docker) to be used as a primary user store for CAS Access Manager. The container originally comes from osixia/openldap-backup but we have our own fork.
The czechidm and cas services depend on this package.
RPM is built "the usual way" using the bcv-rpmbuild container.
Directory structure
-
/data/volumes/directory-server/data- OpenLDAP MDB database -
/data/volumes/directory-server/config- OpenLDAP OLC (configuration) database -
/data/volumes/directory-server/secrets-pwfiles- bootstrap password for admin and readonly userscn=admin,dc=iamappliance(user administration),cn=admin,cn=config(config administration),cn=cas,dc=iamappliance(read-only user for CAS). If the password don’t exist, package creates them automatically during its installation. -
/data/volumes/directory-server/secrets-certs- LDAPS certificate and private key. There are also achain.pemanddhparam.pemfiles. DHparam file is generated automatically during the first start of the container. -
/data/volumes/directory-server/secrets-enc- Encrypted backups keyldap-backup-symkey.pwfileis located here. File is generated automatically if it does not exist. -
/data/volumes/directory-server/backup- Backups are stored here. -
/data/logs/directory-server- Logs are stored here.-
This directory must have correct SElinux labels. RPM package installation script handles this automatically by executing
semanage fcontext ….
-
Configuration files
-
/data/registry/node-active-config/docker-compose-directory-server.yml- container compose file -
/etc/rsyslog.d/10_directory-server.conf- syslog configuration for the container to send logs to dedicated files on the filesystem -
/etc/logrotate.d/directory-server- logrotate configuration
Controlling the service
-
systemd unit is located in
/usr/lib/systemd/system/iam-directory-server.serviceso the commandsystemctl start/stop/enable/disableworks as expected. -
Start of the service calls
docker-compose … up, which starts/creates/recreates the container as needed. -
Backups
-
Periodic backups are executed once a day by systemd timer
/usr/lib/systemd/system/iam-directory-server-backup.timerand/usr/lib/systemd/system/iam-directory-server-backup.serviceunit. -
Backup can be executed manually with
systemctl start iam-directory-server-backup.service. -
Backups are compressed.
-
Backups older than 7 days are automatically deleted.
-
Restore from backup needs manual action of the administrator.
-
Dependencies
-
Service does not have any installation dependencies.
-
Service does not have any runtime dependencies.
Kinks and quirks
-
First start of the container initializes whole
slapdinstance. Its configuration is directly in thecn=configinside the LDAP server. Static files in/etc/ldap/schemaare used only during this initialization phase and have no other effect. -
Auto-generation of
dhparam.pem(and other files) is done only on the first init of the LDAP database. -
Container contains
runit,cron,slapdandsyslog-ngso it does not conform to our container requirements wiki. But it is the only sensible way of doing LDAP recovery with running container and stoppedslapd.
Backup and restore
-
Make sure you have correct backup. Create special new backup right before the restore operation to preserve original (even if undesirable) state.
-
If you use encrypted backups and you are planning to change the encryption key, save the original
ldap-backup-symkey.pwfileso you can still access your historical backups. -
Use
slapd-backup-configandslapd-backup-datato backup the LDAP server. -
Use
slapd-restore-configandslapd-restore-datato restore the LDAP server. Those scripts useslapaddinternally and you must delete the original LDAP databases beforehand. Whole restore procedure then looks like this:root@directory-server:/# rm -r /etc/ldap/slapd.d/cn* root@directory-server:/# /sbin/slapd-restore-config 20210204T090611-config.gz root@directory-server:/# rm /var/lib/ldap/* root@directory-server:/# /sbin/slapd-restore-data 20210204T090615-data.gz
Encrypted backup have
.gz.esuffix.