Paquets debian (pré-requis)
apt-get install apache2 libapache2-mod-php5 libldap-2.4-2 ldap-utils libsasl2-modules-ldap openssl libsasl2-2 libkrb5-3 php5-ldap php5-sasl php5-auth-pam
Configuration Apache
Activer le module LDAP Apache 2.0
a2enmod auth_ldap
Activer le module LDAP Apache 2.2
a2enmod authnz_ldap
Certificat SSL
Copier le certificat dans /etc/apache2/ssl/ldap.pem
-----BEGIN CERTIFICATE-----
KJDFJ
...
JDiejfioe
-----END CERTIFICATE-----
Configuration LDAP dans Apache 2.0
Ajouter dans apache2.conf ou httpd.conf:
LDAPTrustedCA /etc/apache2/ssl/ldap.pem
LDAPTrustedCAType BASE64_FILE
Configuration LDAP dans Apache 2.2
Ajouter dans apache2.conf ou httpd.conf:
LDAPTrustedGlobalCert CA_BASE64 /etc/apache2/ssl/ldap.pem
/etc/ldap/ldap.conf
BASE dc=com
URI ldap://ldap.host.com
TLS_REQCERT demand
TLS_CACERT /etc/apache2/ssl/ldap.pem
Redémarrer le service apache2
/etc/init.d/apache2 restart
Test
ldaptls.php
Troubleshooting
Problème: fonction PHP ldap_start_tls en erreur. Authentification LDAP impossible par la suite.
Système: debian lenny
Nom du paquet: apache2
Version: 2.2.9-10
Solution:
cd /etc/ldap
mkdir certs
cp /etc/apache2/ssl/ldap.pem /etc/ldap/certs/mycert.pem
vi /etc/ldap/ldap.conf
TLS_REQCERT never
TLS_CACERT /etc/ldap/certs/mycert.pem
/etc/init.d/apache2 restart
Follow Me!