[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[LENNY] Authentification LDAP en TLS sur Apache



Tout d'abord merci pour ta réponse.

1/ Je pense que les modules sont bien chargés ; en tout cas le /etc/apache2/apache2.conf contient la directive
Include /etc/apache2/mods-enabled/*.load
qui inclut tous les fichiers .load de /etc/apache2/mods-enabled/ parmi lesquels on trouve :
    ldap.load qui contient LoadModule ldap_module /usr/lib/apache2/modules/mod_ldap.so
et authnz_ldap.load qui contient LoadModule authnz_ldap_module /usr/lib/apache2/modules/mod_authnz_ldap.so
Je pense que c'est suffisant pour pouvoir dire que les modules sont chargés non ? Ou bien il y a un autre moyen de le vérifier (en interrogeant le serveur en fonction par exemple ?)

2/ J'ai oublié de le préciser, mais oui, bien sûr, mon serveur LDAP accepte les connections TLS
Par exemple, quand je tape la commande :
ldapsearch -x -ZZ -H ldap://xxx.ups-tlse.fr -D "cn=admin,dc=xxx,dc=ups-tlse,dc=fr" -b "ou=Users,ou=People,dc=xxx,dc=ups-tlse,dc=fr" -W
Aux niveaux des logs, j'obtiens :
slapd[18327]: conn=0 fd=13 ACCEPT from IP=130.120.xxx.xxx:41224 (IP=130.120.xxx.xxx:389)
slapd[18327]: conn=0 op=0 EXT oid=1.3.6.1.4.1.1466.20037
slapd[18327]: conn=0 op=0 STARTTLS
slapd[18327]: conn=0 op=0 RESULT oid= err=0 text=
slapd[18327]: conn=0 fd=13 TLS established tls_ssf=128 ssf=128
slapd[18327]: conn=0 op=1 BIND dn="cn=admin,dc=xxx,dc=ups-tlse,dc=fr" method=128
slapd[18327]: conn=0 op=1 BIND dn="cn=admin,dc=xxx,dc=ups-tlse,dc=fr" mech=SIMPLE ssf=0
slapd[18327]: conn=0 op=1 RESULT tag=97 err=0 text=
slapd[18327]: conn=0 op=2 SRCH base="ou=Users,ou=People,dc=xxx,dc=ups-tlse,dc=fr" scope=2 deref=0 filter="(objectClass=*)"
slapd[18327]: conn=0 op=2 SEARCH RESULT tag=101 err=0 nentries=31 text=
slapd[18327]: conn=0 op=3 UNBIND
slapd[18327]: conn=0 fd=13 closed
Au niveau du point 3/  de ta réponse, je ne suis pas sûr d'avoir compris la chose à essayer ; mais en lisant l'exemple que tu retranscris et sur lequel je me suis aussi appuyé pour établir ma config, je vois que tu mets en avant l'ajout de l'option TLS à la fin de la ligne AuthLDAPURL. Si j'ai bien lu la doc, cette option ne sert qu'à surcharger la directive LDAPTrustedMode que j'ai bien mis à TLS. Ou alors, il y a quelque chose qui m'a échappé :-(. Quoi qu'il en soit, ça ne marche pas, que je mettes TLS dans l'un ou l'autre, ni même aux deux endroits.

Ce qui m'inquiète le plus c'est qu'il m'affiche une internal server error au lieu d'une authentification failed qui me paraîtraît de meilleur aloi.

En tout cas merci de te pencher sur mon problème. Je suis à l'écoute de toutes les idées qui pourraient me sortir de cette impasse.

jMax


2009/4/23 Tan.N <axaly@yahoo.fr>


1/ A vérifier si les modules mod_ldap et mod_authnz_ldap sont chargés dans apache.

2/ Petite question : ton serveur Ldap accepte-t-il les connexions TLS ?

3/ A essayer :
D'après la doc d'Apache :  http://httpd.apache.org/docs/2.2/mod/mod_ldap.html#usingssltls

**********
The ability to create an SSL and TLS connections to an LDAP server is defined by the directives LDAPTrustedGlobalCert, LDAPTrustedClientCert and LDAPTrustedMode. These directives specify the CA and optional client certificates to be used, as well as the type of encryption to be used on the connection (none, SSL or TLS/STARTTLS).

# Establish an SSL LDAP connection on port 636. Requires that
# mod_ldap and mod_authnz_ldap be loaded. Change the
# "yourdomain.example.com" to match your domain.

LDAPTrustedGlobalCert CA_DER /certs/certfile.der

<Location /ldap-status>
SetHandler ldap-status
Order deny,allow
Deny from all
Allow from yourdomain.example.com
AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one
AuthzLDAPAuthoritative off
Require valid-user
</Location>

# Establish a TLS LDAP connection on port 389. Requires that
# mod_ldap and mod_authnz_ldap be loaded. Change the
# "yourdomain.example.com" to match your domain.

LDAPTrustedGlobalCert CA_DER /certs/certfile.der

<Location /ldap-status>
SetHandler ldap-status
Order deny,allow
Deny from all
Allow from yourdomain.example.com
AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one TLS
AuthzLDAPAuthoritative off
Require valid-user
</Location>

***********

Jean-Max Redonnet a écrit :
Bonjour,

Malgré tous mes efforts, multiples et répétés, je ne parviens définitivement pas à configurer l'authentification LDAP en TLS sur mon serveur Apache2.2.

Voilà ce que j'ai mis dans le /etc/apache2/ports.conf inclus dans /etc/apache2/apache2.conf

LDAPTrustedGlobalCert CA_BASE64 /etc/ssl/cacert.pem

<VirtualHost 130.120.xxx.xxx:80>

    LDAPTrustedClientCert CERT_BASE64 /etc/ssl/certs/xxx.ups-tlse.fr.crt
    LDAPTrustedClientCert KEY_BASE64 /etc/ssl/private/xxx.ups-tlse.fr.key
    LDAPTrustedMode TLS

    <Location /ldap-status>
        SetHandler ldap-status
        order deny,allow
        allow from xxx.ups-tlse.fr
        allow from xxx.ups-tlse.fr
        AuthType basic
        AuthName "Auth LDAP"
        AuthBasicProvider ldap
        AuthLDAPURL ldap://xxx.ups-tlse.fr/ou=Users,ou=People,dc=xxx,dc=ups-tlse,dc=fr?uid
        AuthzLDAPAuthoritative off
        require valid-user
    </Location>

</VirtualHost>

OpenLDAP est installé et marche bien. Apache idem.
Mes certificats sont bons (je les utilise par ailleurs avec succès).

Je ne vois pas d'où peut venir le problème. Alors avant de switcher vers le module d'authentification via PAM (qui comble de l'ironie utilise LDAP avec bonheur), je m'en remet aux gens qui savent...

Dans la doc d'Apache, j'ai trouvé ça :
"The documentation for the SDK claims to support both SSL and STARTTLS, however STARTTLS does not seem to work on all versions of the SDK. The SSL/TLS mode can be set using the LDAPTrustedMode parameter. If an ldaps:// URL is specified, SSL mode is forced. The OpenLDAP documentation notes that SSL (ldaps://) support has been deprecated to be replaced with TLS, although the SSL functionality still works."
Alors, je me dis que je suis peut-être pas le seul à rencontrer des problèmes...

Si vous avez des retours d'expérience ou des suggestions, je suis tout ouï

Merci d'avance.

jMax





Reply to: