Shibboleth-sp2 debian

Installation d'un service provider shibboleth2 sous debian

package

le module shibboleth pour apache fait partie des depos debian par defaut

root@kohadev:/etc/apt# apt-cache search shibboleth
libapache2-mod-shib2 - Federated web single sign-on system (Apache module)
libshibsp-dev - Federated web single sign-on system (development)
libshibsp-doc - Federated web single sign-on system (API docs)
libshibsp4 - Federated web single sign-on system (runtime)
shibboleth-sp2-schemas - Federated web single sign-on system (schemas)
sympa - Modern mailing list manager

installation

root@kohadev:/etc/apt# aptitude install libapache2-mod-shib2
Les NOUVEAUX paquets suivants vont être installés :
  libapache2-mod-shib2 libcurl3{a} liblog4cpp5{a} libsaml6{a} libshibsp4{a} libssh2-1{a} libxerces-c3.1{a} libxml-security-c15{a} libxmltooling4{a} odbcinst{a} odbcinst1debian2{a}
  opensaml2-schemas{a} shibboleth-sp2-schemas{a} unixodbc{a} xmltooling-schemas{a}
0 paquets mis à jour, 15 nouvellement installés, 0 à enlever et 109 non mis à jour.
Il est nécessaire de télécharger 5 733 ko d'archives. Après dépaquetage, 25,2 Mo seront utilisés.
Voulez-vous continuer ? [Y/n/?] y
Prendre : 1 http://debian.enst.fr/debian/ squeeze/main libssh2-1 amd64 1.2.6-1 [80,9 kB]
Prendre : 2 http://debian.enst.fr/debian/ squeeze/main libcurl3 amd64 7.21.0-2.1+squeeze2 [285 kB]
Prendre : 3 http://debian.enst.fr/debian/ squeeze/main liblog4cpp5 amd64 1.0-4 [129 kB]
Prendre : 4 http://debian.enst.fr/debian/ squeeze/main libxerces-c3.1 amd64 3.1.1-1+b1 [1 156 kB]
Prendre : 5 http://debian.enst.fr/debian/ squeeze/main odbcinst1debian2 amd64 2.2.14p2-1 [78,4 kB]
Prendre : 6 http://debian.enst.fr/debian/ squeeze/main odbcinst amd64 2.2.14p2-1 [39,0 kB]
Prendre : 7 http://debian.enst.fr/debian/ squeeze/main unixodbc amd64 2.2.14p2-1 [266 kB]
Prendre : 8 http://debian.enst.fr/debian/ squeeze/main libxml-security-c15 amd64 1.5.1-3+squeeze1 [354 kB]
Prendre : 9 http://debian.enst.fr/debian/ squeeze/main libxmltooling4 amd64 1.3.3-2 [789 kB]
Prendre : 10 http://debian.enst.fr/debian/ squeeze/main libsaml6 amd64 2.3-2+squeeze1 [1 287 kB]
Prendre : 11 http://debian.enst.fr/debian/ squeeze/main opensaml2-schemas all 2.3-2+squeeze1 [28,3 kB]
Prendre : 12 http://debian.enst.fr/debian/ squeeze/main shibboleth-sp2-schemas all 2.3.1+dfsg-5 [19,0 kB]
Prendre : 13 http://debian.enst.fr/debian/ squeeze/main xmltooling-schemas all 1.3.3-2 [13,0 kB]
Prendre : 14 http://debian.enst.fr/debian/ squeeze/main libshibsp4 amd64 2.3.1+dfsg-5 [973 kB]
Prendre : 15 http://debian.enst.fr/debian/ squeeze/main libapache2-mod-shib2 amd64 2.3.1+dfsg-5 [235 kB]
 5 733 ko téléchargés en 3s (1 665 ko/s)
Sélection du paquet libssh2-1 précédemment désélectionné.
(Lecture de la base de données... 59164 fichiers et répertoires déjà installés.)
Dépaquetage de libssh2-1 (à partir de .../libssh2-1_1.2.6-1_amd64.deb) ...
Sélection du paquet libcurl3 précédemment désélectionné.
Dépaquetage de libcurl3 (à partir de .../libcurl3_7.21.0-2.1+squeeze2_amd64.deb) ...
Sélection du paquet liblog4cpp5 précédemment désélectionné.
Dépaquetage de liblog4cpp5 (à partir de .../liblog4cpp5_1.0-4_amd64.deb) ...
Sélection du paquet libxerces-c3.1 précédemment désélectionné.
Dépaquetage de libxerces-c3.1 (à partir de .../libxerces-c3.1_3.1.1-1+b1_amd64.deb) ...
Sélection du paquet odbcinst1debian2 précédemment désélectionné.
Dépaquetage de odbcinst1debian2 (à partir de .../odbcinst1debian2_2.2.14p2-1_amd64.deb) ...
Sélection du paquet odbcinst précédemment désélectionné.
Dépaquetage de odbcinst (à partir de .../odbcinst_2.2.14p2-1_amd64.deb) ...
Sélection du paquet unixodbc précédemment désélectionné.
Dépaquetage de unixodbc (à partir de .../unixodbc_2.2.14p2-1_amd64.deb) ...
Sélection du paquet libxml-security-c15 précédemment désélectionné.
Dépaquetage de libxml-security-c15 (à partir de .../libxml-security-c15_1.5.1-3+squeeze1_amd64.deb) ...
Sélection du paquet libxmltooling4 précédemment désélectionné.
Dépaquetage de libxmltooling4 (à partir de .../libxmltooling4_1.3.3-2_amd64.deb) ...
Sélection du paquet libsaml6 précédemment désélectionné.
Dépaquetage de libsaml6 (à partir de .../libsaml6_2.3-2+squeeze1_amd64.deb) ...
Sélection du paquet opensaml2-schemas précédemment désélectionné.
Dépaquetage de opensaml2-schemas (à partir de .../opensaml2-schemas_2.3-2+squeeze1_all.deb) ...
Sélection du paquet shibboleth-sp2-schemas précédemment désélectionné.
Dépaquetage de shibboleth-sp2-schemas (à partir de .../shibboleth-sp2-schemas_2.3.1+dfsg-5_all.deb) ...
Sélection du paquet xmltooling-schemas précédemment désélectionné.
Dépaquetage de xmltooling-schemas (à partir de .../xmltooling-schemas_1.3.3-2_all.deb) ...
Sélection du paquet libshibsp4 précédemment désélectionné.
Dépaquetage de libshibsp4 (à partir de .../libshibsp4_2.3.1+dfsg-5_amd64.deb) ...
Sélection du paquet libapache2-mod-shib2 précédemment désélectionné.
Dépaquetage de libapache2-mod-shib2 (à partir de .../libapache2-mod-shib2_2.3.1+dfsg-5_amd64.deb) ...
Traitement des actions différées (« triggers ») pour « man-db »...
Paramétrage de libssh2-1 (1.2.6-1) ...
Paramétrage de libcurl3 (7.21.0-2.1+squeeze2) ...
Paramétrage de liblog4cpp5 (1.0-4) ...
Paramétrage de libxerces-c3.1 (3.1.1-1+b1) ...
Paramétrage de libxml-security-c15 (1.5.1-3+squeeze1) ...
Paramétrage de libxmltooling4 (1.3.3-2) ...
Paramétrage de libsaml6 (2.3-2+squeeze1) ...
Paramétrage de opensaml2-schemas (2.3-2+squeeze1) ...
Paramétrage de shibboleth-sp2-schemas (2.3.1+dfsg-5) ...
Paramétrage de xmltooling-schemas (1.3.3-2) ...
Paramétrage de libshibsp4 (2.3.1+dfsg-5) ...
Paramétrage de odbcinst (2.2.14p2-1) ...
Paramétrage de odbcinst1debian2 (2.2.14p2-1) ...
Paramétrage de unixodbc (2.2.14p2-1) ...
Paramétrage de libapache2-mod-shib2 (2.3.1+dfsg-5) ...
Adding system-user for Shibboleth daemon
Starting Shibboleth 2 daemon: shibd.

package 2.4

pour disposer d'un SP 2.4.x sur debian squeeze il faut un backport

references

root@kohadev:/etc# apt-get -t squeeze-backports install libapache2-mod-shib2

root@kohadev:~# dpkg --list | grep shib
ii  libapache2-mod-shib2                  2.4.3+dfsg-2~bpo60+1         Federated web single sign-on system (Apache module)
ii  libshibsp4                            2.3.1+dfsg-5                 Federated web single sign-on system (runtime)
ii  libshibsp5                            2.4.3+dfsg-2~bpo60+1         Federated web single sign-on system (runtime)
ii  shibboleth-sp2-schemas                2.4.3+dfsg-2~bpo60+1         Federated web single sign-on system (schemas)

Certificat SP

il semble que par defaut le certificat du SP ne soit pas généré⇒ sefsigned manuel:

root@kohadev:/etc/shibboleth# /usr/sbin/shib-keygen -h kohadev.it-sudparis.eu -y 10 -e https://kohadev.it-sudparis.eu/shibboleth
Generating a 2048 bit RSA private key
...........................+++
...........................+++
writing new private key to 'sp-key.pem'
-----

root@kohadev:/etc/shibboleth# ls -ltra sp-*
-rw-r----- 1 root _shibd 1675 23 août  14:50 sp-key.pem
-rw-r--r-- 1 root root   1172 23 août  14:50 sp-cert.pem

test shibd

root@kohadev:/etc/shibboleth# /etc/init.d/shibd start ; tail -f /var/log/shibboleth/shibd.log
Starting Shibboleth 2 daemon: shibd.
2012-08-23 14:51:41 INFO Shibboleth.AttributeExtractor.XML : creating mapping for Attribute urn:oid:1.3.6.1.4.1.5923.1.1.1.10
2012-08-23 14:51:41 INFO Shibboleth.AttributeExtractor.XML : creating mapping for Attribute urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
2012-08-23 14:51:41 INFO Shibboleth.Application : building AttributeFilter of type XML...
2012-08-23 14:51:41 INFO Shibboleth.AttributeFilter : loaded XML resource (/etc/shibboleth/attribute-policy.xml)
2012-08-23 14:51:41 INFO Shibboleth.Application : building AttributeResolver of type Query...
2012-08-23 14:51:41 INFO Shibboleth.Application : building CredentialResolver of type File...
2012-08-23 14:51:41 INFO XMLTooling.SecurityHelper : loading private key from file (/etc/shibboleth/sp-key.pem)
2012-08-23 14:51:41 INFO XMLTooling.SecurityHelper : loading certificate(s) from file (/etc/shibboleth/sp-cert.pem)
2012-08-23 14:51:41 INFO Shibboleth.Listener : registered remoted message endpoint (default::getHeaders::Application)
2012-08-23 14:51:41 INFO Shibboleth.Listener : listener service starting

config apache

root@kohadev:/etc/apache2/mods-available# cat shib2.conf
# Global Configuration
# This is the XML file that contains all the global, non-apache-specific
# configuration.  Look at this file for most of your configuration parameters.
ShibConfig /etc/shibboleth/shibboleth2.xml

# Used for example logo and style sheet in error templates.
<IfModule mod_alias.c>
  <Location /shibboleth-sp>
    Allow from all
  </Location>
  Alias /shibboleth-sp/main.css /usr/share/shibboleth/main.css
  Alias /shibboleth-sp/logo.jpg /usr/share/shibboleth/logo.jpg
</IfModule>

chargement apache

root@kohadev:/etc/apache2# vim envvars
root@kohadev:/etc/apache2# a2enmod shib2
Enabling module shib2.
Run '/etc/init.d/apache2 restart' to activate new configuration!


root@kohadev:/etc/apache2/mods-enabled# /etc/init.d/apache2 stop
Stopping web server: apache2 ... waiting .


root@kohadev:/etc/shibboleth# apache2ctl configtest
Syntax OK

root@kohadev:/etc/apache2/mods-enabled# /etc/init.d/apache2 start ; tail -f /var/log/apache2/error.log
[Thu Aug 23 15:05:57 2012] [notice] caught SIGTERM, shutting down
[Thu Aug 23 15:06:04 2012] [notice] Apache/2.2.16 (Debian) configured -- resuming normal operations

test config shibd

root@kohadev:/etc/shibboleth# /usr/sbin/shibd -t
overall configuration is loadable, check console for non-fatal problems

Test http

apache SSL sur le SP

Par defaut la configuration apache n'etait pas operationnele sur cette machine, de plus on la signe avec notre certificat TCS

recuperation des certificats TCS

[root@shibds certs]# scp chain-1075-wildcard.it-sudparis.eu.pem cert-1075-wildcard.it-sudparis.eu.pem cachain-TERENA_UTN-USERFirst-Hardware_AddTrust.pem add_trust_external_ca_root.pem root@kohadev.it-sudparis.eu root@kohadev.it-sudparis.eu:/etc/ssl/certs/

enable mod SSL

root@kohadev:/etc/apache2/sites-available# a2enmod ssl
Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
Run '/etc/init.d/apache2 restart' to activate new configuration!

root@kohadev:/etc/apache2/sites-available# ls -ltra ../mods-enabled/ | grep ssl
lrwxrwxrwx 1 root root   26 23 août  15:32 ssl.load -> ../mods-available/ssl.load
lrwxrwxrwx 1 root root   26 23 août  15:32 ssl.conf -> ../mods-available/ssl.conf

root@kohadev:/etc/apache2/sites-available# a2ensite default-ssl
Enabling site default-ssl.
Run '/etc/init.d/apache2 reload' to activate new configuration!

root@kohadev:/etc/apache2/sites-available# ls -ltra ../sites-enabled/ | grep ssl
lrwxrwxrwx 1 root root   30 23 août  15:38 default-ssl -> ../sites-available/default-ssl

verification SSL Listen

root@kohadev:/etc/apache2/sites-available# /etc/init.d/apache2 restart

root@kohadev:/etc/apache2/sites-available# lsof -i tcp  | grep https
apache2   9908        root    6u  IPv6 157682      0t0  TCP *:https (LISTEN)
apache2   9916    www-data    6u  IPv6 157682      0t0  TCP *:https (LISTEN)
apache2   9917    www-data    6u  IPv6 157682      0t0  TCP *:https (LISTEN)

ajout d'application override et cert

# /usr/sbin/shib-keygen -h cat-med.int.fr -f 
rm: impossible de supprimer '/etc/shibboleth/sp-key.pem': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/etc/shibboleth/sp-cert.pem': Aucun fichier ou dossier de ce type
Generating a 2048 bit RSA private key
......................................................................+++
..........................+++
writing new private key to '/etc/shibboleth/sp-key.pem'

Metadata pour integration fede-imt

recuperation des metadata de ce SP (en https !) + procedure de verification, integration et signature

[root@shibds fede-imt-metadata]# wget https://kohadev.it-sudparis.eu/Shibboleth.sso/Metadata
--2012-08-23 15:42:00--  https://kohadev.it-sudparis.eu/Shibboleth.sso/Metadata

[root@shibds fede-imt-metadata]# mv Metadata sp.koadev.it-sudparis.eu.xml

Validation

[root@shibds xmlsectool-1.1.5]# ./xmlsectool.sh --validateSchema  --schemaDirectory  schemaDirectory/samlschemas/ --inFile /root/xml/fede-imt-metadata-svn/fede-imt-metadata/sp.koadev.it-sudparis.eu.xml
INFO  XmlSecTool - Reading XML document from file '/root/xml/fede-imt-metadata-svn/fede-imt-metadata/sp.koadev.it-sudparis.eu.xml'
INFO  XmlSecTool - XML document parsed and is well-formed.
INFO  XmlSecTool - XML document is schema valid