Getting Started With Apacheds
RedHat Enterprise Linux 8 does not include the OpenLDAP server package. To install ApacheDS instead:
sudo yum install -y java-1.8.0-openjdk
curl -OL https://dlcdn.apache.org//directory/apacheds/dist/2.0.0.AM26/apacheds-2.0.0.AM26-x86_64.rpm
sudo rpm -i apacheds-2.0.0.AM26-x86_64.rpm
sudo vi /opt/apacheds-2.0.0.AM26/conf/wrapper.conf #Put Java path
sudo /etc/init.d/apacheds-2.0.0.AM26-default start
Then, install the LDAP client utility to connect to the server:
sudo yum install -y openldap-clients
sudo yum install -y vim-enhanced
ldapsearch -h $(hostname -f):10389 -D 'uid=admin,ou=system' -w 'secret' -b '' -s base
The server contains the example.com partition by default, so we create the user and group with an LDIF:
echo '
dn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
ou: people
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
' > basedn.ldif
echo '
dn: uid=user1,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
cn: user1
sn: Person1
echo "userPassword: $(sudo slappasswd -s 1)" >> ldapUser.ldif
echo '
dn: cn=admins,ou=groups,dc=example,dc=com
objectClass: groupofnames
cn: admins
description: Admin users
member: cn=user1,ou=groups,dc=example,dc=com
' >> ldapUser.ldif
ldapadd -h $(hostname -f):10389 -D 'uid=admin,ou=system' -w 'secret' -f basedn.ldif
ldapadd -h $(hostname -f):10389 -D 'uid=admin,ou=system' -w 'secret' -f ldapUser.ldif
Fetch the self-signed certificate with:
openssl s_client -showcerts -connect localhost:10636 </dev/null