Topic: Securing LDAP with Lets Encrypt Certificate
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: Ubuntu 18.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Since a long time I'm trying to secure the connections to the LDAP installed by iRedMail with my LetsEncrypt-Certificate. With no success. I've found out that openldap doesn't have the permission to read the files in the letsencrypt-folder. So I copied them to /etc/certs/ and I was able to restart slapd.
Here comes the relevant part of my /etc/ldap/slapd.conf:
# TLS files.
TLSCACertificateFile /etc/ssl/certs/example.com.fullchain.pem
TLSCertificateFile /etc/ssl/certs/example.com.cert.pem
TLSCertificateKeyFile /etc/ssl/private/example.com.privkey.pem
I've tried some modifications of my /etc/ldap/ldap.conf but with no effect:
BASE dc=example,dc=com
URI ldap://127.0.0.1:389 ldaps://127.0.0.1:636 ldaps://example.com:636
#TLS_CACERT /etc/ssl/certs/iRedMail.crt
TLS_CACERT /etc/ssl/certs/example.com.fullchain.pem
The encryption seems to work on the machine itself but if I try to connect from another on I get this error message (using -d 1 option in ldapsearch):
ldap_url_parse_ext(ldaps://example.com)
ldap_create
ldap_url_parse_ext(ldaps://example.com:636/??base)
Enter LDAP Password:
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP example.com:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying *.*.*.*:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
TLS: peer cert untrusted or revoked (0x42)
TLS: can't connect: (unknown error code).
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
What am I doing wrong? What can I do to connect from outside to the LDAP? Isn't it possible with the LDAP installed by iRedMail?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.