HRZOO HPC users backend component
Build:
docker/ldap-server/$ docker build . -t ipanema:5000/hrzoo-ldapserv
docker/ldap-client/$ docker build . -t ipanema:5000/hrzoo-ldapclient
Further customization with shell settings etc.
docker/$ docker compose up
docker exec -t -u user -i hrzoo-client /bin/zsh
docker exec -t -u user -i hrzoo-ldapserv /bin/zsh
./chezmoi-config-apply.sh
These settings are implied in the configuration files of server and client:
- hostnames:
docker-hrzooldapserv
,docker-hrzooldapclient
- base LDAP DN:
dc=hpc,dc=srce,dc=hr
- LDAP password:
foobar
- CA certificate
openssl ecparam -out root.key -name prime256v1 -genkey
openssl req -new -sha256 -key root.key -out root.csr
openssl x509 -req -sha256 -days 3650 -in root.csr -signkey root.key -out root.cert
- CA signed LDAP certificate
openssl ecparam -out ldap.key -name prime256v1 -genkey
openssl req -new -sha256 -key ldap.key -out ldap.csr
openssl x509 -req -in ldap.csr -CA root.cert -CAkey root.key -CAcreateserial -out ldap.cert -days 3650 -sha256
Container context:
docker exec -t -u user -i hrzoo-ldapserv /bin/zsh
Initial configuration:
sudo su -c 'VIFM=/home/user/.config/vifm /home/user/.bin/vifm/bin/vifm'
sudo slapadd -n 0 -F /etc/openldap/slapd.d -l /etc/openldap/slapd.ldif
sudo chown -R ldap:ldap /etc/openldap/slapd.d/
Append to /etc/openldap/slapd.d/cn=config.ldif
:
olcTLSCertificateFile: /etc/openldap/certs/ldap.cert
olcTLSCertificateKeyFile: /etc/openldap/certs/ldap.key
Restart service:
sudo supervisorctl restart openldap
Preset password=foobar
sudo ldapadd -h localhost -x -w foobar -D "cn=Manager,dc=hpc,dc=srce,dc=hr" -f /home/user/ldap-conf/base/base.ldif
sudo ldapadd -h localhost -x -w foobar -D "cn=Manager,dc=hpc,dc=srce,dc=hr" -f /home/user/ldap-conf/base/group.ldif
sudo ldapadd -h localhost -x -w foobar -D "cn=Manager,dc=hpc,dc=srce,dc=hr" -f /home/user/ldap-conf/base/passwd.ldif
sudo -s
export SUDOERS_BASE="ou=SUDOers,dc=hpc,dc=srce,dc=hr"
cvtsudoers -f ldif -o /tmp/sudoers.ldif /etc/sudoers
Edit /tmp/sudoers.ldif
and prepend:
dn: ou=SUDOers,dc=hpc,dc=srce,dc=hr
objectClass: top
objectClass: organizationalUnit
ou: SUDOers
description: SUDOers container
dn: cn=defaults,ou=SUDOers,dc=hpc,dc=srce,dc=hr
...
ldapadd -x -W -D "cn=Manager,dc=hpc,dc=srce,dc=hr" -f /tmp/sudoers.ldif
Initiate test query and watch logs:
sudo ldapsearch -x -h localhost
tail -f /home/user/ldap-logs
Commit changes:
docker commit hrzoo-ldapserv ipanema:5000/hrzoo-ldapserv