LDAP with TLS not working

Hello all,
I have a problem setting up OpenLDAP server 2.4.44 on latest FreeBSD 10.3.
The server has been installed form ports with the standard options, the same machine is also CA for my internal domain.
When I try to start slapd this is the error I get:
Code:
root@srv1:~/sslCA # /usr/local/libexec/slapd -u ldap -g ldap -d 10
57b2437f @(#) $OpenLDAP: slapd 2.4.44 (Aug 15 2016 22:31:15) $
    root@srv1:/usr/ports/net/openldap24-server/work/openldap-2.4.44/servers/slapd
TLS: could not load verify locations (file:`/root/sslCA/cacert.pem',dir:`').
TLS: error:0200100D:system library:fopen:Permission denied /usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/bio/bss_file.c:175
TLS: error:2006D002:BIO routines:BIO_new_file:system lib /usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/bio/bss_file.c:180
TLS: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib /usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/x509/by_file.c:253
57b2437f main: TLS init def ctx failed: -1
57b2437f slapd stopped.
57b2437f connections_destroy: nothing to destroy.

This would make me thing that /root/sslCA/cacert.pem is not readable by the user ldap, but this is not the case:
Code:
root@srv1:~/sslCA # pwd
/root/sslCA
root@srv1:~/sslCA # ls -la cacert.pem 
-rw-r--r--  1 root  wheel  969 Aug 15 22:38 cacert.pem

The certificate is properly recognized from OpenSSL so it's not corrupted:
Code:
root@srv1:~/sslCA # openssl x509 -in cacert.pem -noout -text | head
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 15849774239493584907 (0xdbf5b5b1f326f80b)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=UK, ST=England, L=XXX, O=Home LAB, CN=srv1.home.lab
        Validity
            Not Before: Aug 15 21:38:47 2016 GMT
            Not After : Aug 13 21:38:47 2026 GMT
        Subject: C=UK, ST=England, L=XXX, O=Home LAB, CN=srv1.home.lab

This is the content of my /usr/local/etc/openldap/slapd.conf:
Code:
root@srv1:~/sslCA # cat /usr/local/etc/openldap/slapd.conf
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/corba.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/collective.schema
include /usr/local/etc/openldap/schema/openldap.schema

# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral    ldap://root.openldap.org

pidfile        /var/run/openldap/slapd.pid
argsfile    /var/run/openldap/slapd.args
logfile     /var/log/ldap/slapd.log
loglevel     5
# Load dynamic backend modules:
modulepath    /usr/local/libexec/openldap
moduleload    back_mdb
moduleload    back_ldap

# Sample security restrictions
#    Require integrity protection (prevent hijacking)
#    Require 112-bit (3DES or better) encryption for updates
#    Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
security ssf=128
TLSCertificateFile /root/sslCA/srv1-cert.pem
TLSCertificateKeyFile /root/sslCA/private/srv1-key.pem
TLSCACertificateFile /root/sslCA/cacert.pem

# Sample access control policy:
#    Root DSE: allow anyone to read it
#    Subschema (sub)entry DSE: allow anyone to read it
#    Other DSEs:
#        Allow self write access
#        Allow authenticated users read access
#        Allow anonymous users to authenticate
#    Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
#    by self write
#    by users read
#    by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn.  (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

#######################################################################
# MDB database definitions
#######################################################################

database    mdb
maxsize        1073741824
suffix        "dc=home,dc=lab"
rootdn        "cn=srv1,dc=home,dc=lab"
rootpw          {SHA}6bpooyl76BEc+QEHOV9l6GMPdmU=
# Cleartext passwords, especially for the rootdn, should
# be avoid.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw        secret
# The database directory MUST exist prior to running slapd AND 
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory    /var/db/openldap-data
# Indices to maintain
index    objectClass    eq

Anyone could please help me?
 
Your ldap user is not allowed to access root's home directory (that includes everything within that directory).
 
Back
Top