CAS et Kerberos
Pages enfant
  • Passage de l'authentification Kerberos aux applications web (mod_auth_kerb) (archive)

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Les tests sont fait sur la machine cas.ifsic.univ-rennes1.fr, sur laquelle on installe Apache et mod_auth_kerb. Cette partie sera réutilisée ultérieurement lors de la configuration du serveur CAS.

Authentification

Il n'est pas nécessaire de configurer l'authentification des utilisateurs avec system-config-authentication sur ce serveur (les utilisateurs n'ont pas à se connecter sur le serveur CAS). Il faut néanmoins installer le fichier /etc/krb5.conf :

Bloc de code
[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log

[libdefaults]
 default_realm = UNIV-RENNES1.FR
 default_etypes = des3-hmac-sha1 des-cbc-crc
 default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
 default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
 permitted_enctypes = des3-hmac-sha1 des-cbc-crc rc4-hmac
 ticket_lifetime = 24h
 forwardable = yes

[realms]
 UNIV-RENNES1.FR = {
  kdc = kerb.ifsic.univ-rennes1.fr:88
  admin_server = kerb.ifsic.univ-rennes1.fr:749
  default_domain = univ-rennes1.fr
 }

[domain_realm]
 .univ-rennes1.fr = UNIV-RENNES1.FR
 univ-rennes1.fr = UNIV-RENNES1.FR

[appdefaults]
 pam = {
   debug = false
   ticket_lifetime = 36000
   renew_lifetime = 36000
   forwardable = true
   krb4_convert = false
 }

Installation basique Apache

Installer httpd (Apache) et mod_auth_kerb et démarrer Apache :

Bloc de code
[root@cas ~]# chkconfig httpd on
[root@cas ~]# service httpd start
Starting httpd:                          [OK]
[root@cas ~]#

Création d'un script de test

Ecrire un simple script test.php dans le répertoire /var/www/html/kerb :

Bloc de code
<?php
echo "<p>REMOTE_USER=[".$_SERVER['REMOTE_USER']."]</p>";
echo "<p>PHP_AUTH_USER=[".$_SERVER['PHP_AUTH_USER']."]</p>";
phpinfo();
?>

Debuggage

Modifier la directive LogLevel du fichier /etc/httpd/conf/httpd.conf :

...

Les logs sont dans le répertoire /var/log/httpd.

Test

Tester en accédant à http://cas.ifsic.univ-rennes1.fr/kerb/test.php .

Installation mod_auth_kerb

Configuration Kerberos

Déclarer le client Kerberos :

Bloc de code
[root@cas ~]# kadmin
Authenticating as principal root/admin@UNIV-RENNES1.FR with password.
Password for root/admin@UNIV-RENNES1.FR:
kadmin:  addprinc -randkey HTTP/cas.ifsic.univ-rennes1.fr
WARNING: no policy specified for HTTP/cas.ifsic.univ-rennes1.fr@UNIV-RENNES1.FR; defaulting to no policy
Principal "HTTP/cas.ifsic.univ-rennes1.fr@UNIV-RENNES1.FR" created.
kadmin:  exit
[root@cas ~]# 

Configuration mod_auth_kerb

Exporter la clé du client dans le fichier le fichier /etc/httpd/conf/mod_auth_kerb.keytab (ce fichier sera utilisé par mod_auth_kerb) :

...

Bloc de code
<Location /kerb>
  #SSLRequireSSL
  AuthType KerberosV5
  AuthName "Kerberos Login"
  KrbMethodNegotiate On
  KrbMethodK5Passwd Off
  KrbAuthRealms UNIV-RENNES1.FR
  Krb5KeyTab /etc/httpd/conf/mod_auth_kerb.keytab
  require valid-user
</Location>

Test

Avant de tester, ne pas oublier d'ouvrir le port 80 entrant (system-config-firewall).

...