ldapsearch
parameters:-W
prompt for password-x
use simple auth-Z
try to use STARTTLS-ZZ
force use of STARTTLS-D
bind with the given name-b
search baseldaps://
on port 636 is deprecated with LDAPv3. Use ldap://
on port 389 with STARTTLS instead.apt-get install slapd ldap-utils
/etc/ldap/ldap.conf
and set the BASE
and URI
parameters:# # LDAP Defaults # # See ldap.conf(5) for details # This file should be world readable but not world writable. BASE dc=my,dc=domain,dc=tld URI ldaps://ldap.my.domain.tld ldap://ldap.my.domain.tld:666 #SIZELIMIT 12 #TIMELIMIT 15 #DEREF never # TLS certificates (needed for GnuTLS) TLS_CACERT /etc/ssl/certs/ca-certificates.crt TLS_REQCERT ALLOW
dkpg-reconfigure slapd
Omit OpenLDAP server configuration? | No |
Organization name: | <pick something> |
Administrator password: | <same password as before> |
Confirm password: | <same password as before> |
Database backend to use: | MDB |
Do you want the database to be removed when slapd is purged? | No |
Move old database? | Yes |
Allow LDAPv2 protocol? | No |
$> ldapsearch -x
base.ldif
with the following content:dn: ou=people,dc=my,dc=domain,dc=tld objectClass: organizationalUnit ou: people dn: ou=groups,dc=my,dc=domain,dc=tld objectClass: organizationalUnit ou: groups
ldapadd
:$> ldapadd -x -D cn=admin,dc=my,dc=domain,dc=tld -W -f base.ldif
$> ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config
# {1}mdb, config
heading (example output):# {1}mdb, config dn: olcDatabase={1}mdb,cn=config objectClass: olcDatabaseConfig objectClass: olcMdbConfig olcDatabase: {1}mdb olcDbDirectory: /var/lib/ldap olcSuffix: dc=my,dc=domain,dc=tld olcAccess: {0}to attrs=userPassword,shadowLastChange by dn="cn=admin,dc=my,dc= domain,dc=tld" write by self write by * none olcAccess: {1}to dn.base="" by * read olcAccess: {2}to * by dn="cn=admin,dc=my,dc=domain,dc=tld" write by * read olcLastMod: TRUE olcRootDN: cn=admin,dc=my,dc=domain,dc=tld olcRootPW: {SSHA}abcdefghijklmnopqrstuvwxyz123456 olcSecurity: tls=1 olcDbCheckpoint: 512 30 olcDbIndex: objectClass eq olcDbIndex: cn,uid eq olcDbIndex: uidNumber,gidNumber eq olcDbIndex: member,memberUid eq olcDbMaxSize: 1073741824
olcAccess
olcAccess: {0}
for the passwords and olcAccess: {2}
for general access.access.ldif
file:dn: olcDatabase={1}mdb,cn=config changetype: modify delete: olcAccess olcAccess: {0} - add: olcAccess olcAccess: {0}to attrs=userPassword,shadowLastChange by dn="cn=admin,dc=my,dc=domain,dc=tld" write by self write by anonymous auth by * none - delete: olcAccess olcAccess: {2} - add: olcAccess olcAccess: {2}to * by dn="cn=admin,dc=my,dc=domain,dc=tld" manage by self write by anonymous auth by users read
ldapmodify -Y EXTERNAL -H ldapi:/// -f access.ldif
ldapsearch -x -D "cn=admin,dc=my,dc=domain,dc=tld" -W
cert.crt
- Your certificate (without any other intermediate certs)cert.key
- Your private keychain.pem
- The intermediate certs/opt/ssl
$> usermod -aG ssl-cert openldap
$> chown root:ssl-cert cert.crt cert.key chain.pem $> chmod 640 cert.crt cert.key chain.pem
tls.ldif
file:dn: cn=config changetype: modify add: olcTLSCipherSuite olcTLSCipherSuite: NORMAL - add: olcTLSCRLCheck olcTLSCRLCheck: none - add: olcTLSVerifyClient olcTLSVerifyClient: never - add: olcTLSCACertificateFile olcTLSCACertificateFile: /opt/ssl/chain.pem - add: olcTLSCertificateFile olcTLSCertificateFile: /opt/ssl/cert.crt - add: olcTLSCertificateKeyFile olcTLSCertificateKeyFile: /opt/ssl/cert.key - add: olcTLSProtocolMin olcTLSProtocolMin: 3.3
$> ldapmodify -Y EXTERNAL -H ldapi:/// -f tls.ldif
dn: olcDatabase={1}mdb,cn=config changetype: modify add: olcSecurity olcSecurity: tls=1
-Z
in ldapsearch
):ldapsearch -x -Z -D "cn=admin,dc=my,dc=domain,dc=tld" -W
admins
posixGroup in the groups
oudn: olcDatabase={1}mdb,cn=config changetype: modify delete: olcAccess olcAccess: {3} - add: olcAccess olcAccess: {3}to * by dn="cn=admin,dc=my,dc=domain,dc=tld" manage by set="user/uid & [cn=admins,ou=groups,dc=my,dc=domain,dc=tld]/memberUid" manage by self write by anonymous auth by users read -