Configure OpenLDAP with SSL/TLS

To improve the security of the communication with the ldap servers, it’s very interesting to configure the protocol SSL/TLS to encrypt all the data across the network. This configuration requires a valid X.509 certificate signed by a CA (certified authority) or signed yourself. In the configuration show in this post I’ll use a self-signed certificate and this will be configured in the ldap server and finally configure an ldap client to the ldap server across SSL/TLS:

ssl-tls

Configuring ldap server

- Creating a self signed certificate with openssl utility:

1
2
3
4
5
# mkdir /etc/ldap/ssl
# openssl genrsa -out /etc/ldap/ssl/private.key 2048
# openssl req -new -x509 -key /etc/ldap/ssl/private.key -out /etc/ldap/ssl/cert.pem -days 432
# chown openldap
# chown -R openldap:openldap /etc/ldap/ssl/

- Edit the slapd.conf file to add the new certificate and the key created:

1
2
3
4
5
6
# vi /etc/ldap/slapd.conf
 
TLSCACertificateFile /etc/ldap/ssl/cert.pem
TLSCertificateFile /etc/ldap/ssl/cert.pem
TLSCertificateKeyFile /etc/ldap/ssl/private.key
TLSCipherSuite SECURE256:!AES-128-CBC

- TLSCipherSuite directive defines the list of ciphers from which slapd will negotiate in the connection. To show the list ciphers available in your system type the next command (it’s necessary to be installed gnutls-bin package):

1
# gnutls-cli -l

- Edit /etc/default/slapd:

- Restarting slapd:

1
# service slapd restart

Configuring the client

- Edit /etc/ldap/ldap.conf

1
2
3
4
5
6
BASE dc=opentodo,dc=net
URI ldaps://172.16.0.100
TLS_CACERT /etc/ldap/cert.pem
#the server don't check the certificate
#necessary for self signed certificates
TLS_REQCERT never

- Sources:

http://www.zytrax.com/books/ldap/ch15/

Nhận xét

Bài đăng phổ biến từ blog này

CLEANING UP THE ZABBIX DATABASE

[Resolved] Amazon EC2 Redhat 7 using 6GB for the root space

Connect to a different port with SQL Server Management Studio