Authentification | Utilisateurs | Mot-de-passe |
---|---|---|
✔ |
LL::NG peut déléguer l'authentification à Apache, ainsi il est possible d'utiliser tous les modules d'authentification Apache, par exemple:
REMOTE_USER
, qui sera utilisée par LL::NG pour obtenir le nom d'utilisateur authentifié.
Les paramètres suivants sont utilisés pour l'exemple :
Le module peut être trouvé ici.
Sur CentOS/RHEL :
yum install mod_auth_kerb
Sur Debian/Ubuntu :
apt-get install libapache2-mod-auth-kerb
Ce module doit être chargé par Apache (directive LoadModule).
Editer /etc/krb5.conf
:
[libdefaults] default_realm = EXAMPLE.COM [realms] EXAMPLE.COM = { kdc = ad.example.com admin_server = ad.example.com } [domain_realm] .example.com = EXAMPLE.COM example.com = EXAMPLE.COM
Il faut lancer cette commande dans Active Directory:
ktpass -princ HTTP/auth.example.com@EXAMPLE.COM -mapuser EXAMPLE.COM\ssokerberos -crypto DES-CBC-MD5 -ptype KRB5_NT_PRINCIPAL -mapOp set +DesOnly -pass complicatedpassword -out c:\auth.keytab
Le fichier auth.keytab
doit ensuite être copié (par un média sûr) sur le serveur Linux (par exemple dans /etc/lemonldap-ng
).
Ensuite sur le serveur Linux :
kinit HTTP/auth.example.com kvno HTTP/auth.example.com@EXAMPLE.COM klist -e kinit -k -t /etc/lemonldap-ng/auth.keytab HTTP/auth.example.com
msktutil
sur le serveur Linux. Il est possible de trouver un paquet pour beaucoup de distributions avec une petite recherche sur le web.
Initialiser la connexion Kerberos :
kinit ssokerberos@EXAMPLE.COM
Créer ensuite le fichier keytab.
rm -f /etc/lemonldap-ng/auth.keytab msktutil -c -b "cn=COMPUTERS" -s HTTP/auth.example.com -h auth.example.com -k /etc/lemonldap-ng/auth.keytab --computer-name portalsso --upn HTTP/auth.example.com --server ad.example.com --verbose
rm -f /etc/lemonldap-ng/auth.keytab msktutil -c -b "cn=COMPUTERS" -s HTTP/auth.example.com -h auth.example.com -k /etc/lemonldap-ng/auth.keytab --computer-name portalsso --upn HTTP/auth.example.com --server ad.example.com --verbose --enctypes 28
–enctypes
requiert msktutil > 0.4
Fermer la connexion kerberos :
kdestroy
Changer les droits sur le fichier keytab :
chown apache /etc/lemonldap-ng/auth.keytab
Dans le manager, aller dans Paramètres généraux
> Modules d'authentification
et choisir Apache pour l'authentification.
il est également possible de configurer le niveau d'authentification pour ce module.
Modifier l'hôte virtuel du portail :
<VirtualHost *> ServerName auth.example.com DocumentRoot /var/lib/lemonldap-ng/portal/ <Directory /var/lib/lemonldap-ng/portal/> Order allow,deny Allow from all Options +ExecCGI <IfModule auth_kerb_module> AuthType Kerberos KrbMethodNegotiate On KrbMethodK5Passwd Off KrbAuthRealms EXAMPLE.COM Krb5KeyTab /etc/lemonldap-ng/auth.keytab KrbVerifyKDC Off KrbServiceName HTTP/auth.example.com require valid-user </IfModule> </Directory> </VirtualHost>
On peut souhaiter utiliser le backend d'authentification multiple pour retomber sur un autre système d'authentification pour les utilisateurs sans ticket Kerberos.
Ceci requiert quelques astuces car le module d'authentification Kerberos d'Apache ne fonctionne pas si require valid-user
n'est pas indiqué. This requires to create a second virtual host (kerberos.example.com), which should be registered into the DNS system.
Pour le réussir, suivre ces étapes :
ServerName kerberos.example.com
vi /var/lib/lemonldap-ng/portal/login.pl
#!/usr/bin/perl use CGI ':cgi-lib'; use strict; use CGI::Carp 'fatalsToBrowser'; my $uri = $ENV{"REQUEST_URI"}; print CGI::header(-Refresh => '0; URL=https://auth.example.com'.$uri); exit(0);
<VirtualHost *> ServerName kerberos.example.com DocumentRoot /var/lib/lemonldap-ng/portal/ <Directory /var/lib/lemonldap-ng/portal/> Order allow,deny Allow from all Options +ExecCGI +FollowSymLinks </Directory> ErrorDocument 401 /login.pl <LocationMatch ^/(?!login.pl)> <IfModule auth_kerb_module> AuthType Kerberos KrbMethodNegotiate On KrbMethodK5Passwd Off KrbAuthRealms EXAMPLE.COM Krb5KeyTab /etc/lemonldap-ng/auth.keytab KrbVerifyKDC Off KrbServiceName HTTP/kerberos.example.com Satisfy any Order allow,deny allow from APPLICATIONS_IP require valid-user </IfModule> </LocationMatch> </VirtualHost>
Configure IE or Firefox to trust http://auth.example.com
or http://kerberos.example.com
, and then it should work!