This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
cn:ccr:aai:howto:saml-sp [2019/04/30 11:17] monducci@infn.it [Configurazione] |
cn:ccr:aai:howto:saml-sp [2019/04/30 11:26] (current) monducci@infn.it [Configurazione] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== RHEL 5/6: Configurare un Service Provider SAML 2.0 ====== | ||
+ | ---- | ||
+ | |||
+ | **ATTENZIONE: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | La seguente guida illustra come configurare un' | ||
+ | ===== simpleSAMLphp ===== | ||
+ | |||
+ | simpleSAMLphp perfette di implementare l' | ||
+ | ==== Installazione ==== | ||
+ | |||
+ | La documentazione di trova alla pagina [[http:// | ||
+ | |||
+ | Il download è disponibile a [[https:// | ||
+ | |||
+ | # yum install httpd mod_ssl php php-xml | ||
+ | # cd /var | ||
+ | # wget -O - https:// | ||
+ | # mv simplesamlphp-1.13.2 simplesamlphp | ||
+ | | ||
+ | |||
+ | **NOTA**: In caso si usi php 5.1 eseguire anche: | ||
+ | | ||
+ | < | ||
+ | # yum install php-pear | ||
+ | # pecl install json | ||
+ | # cat > / | ||
+ | ; Enable json extension module | ||
+ | extension = json.so | ||
+ | EOT | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== Configurazione ==== | ||
+ | |||
+ | Documentazione: | ||
+ | |||
+ | === **Scaricare i metadati dell' | ||
+ | |||
+ | == IdP di Produzione == | ||
+ | |||
+ | # cd metadata/ | ||
+ | # wget -O saml20-idp-remote.php https:// | ||
+ | | ||
+ | == IdP di Test == | ||
+ | |||
+ | # cd metadata/ | ||
+ | # wget -O saml20-idp-remote.php https:// | ||
+ | |||
+ | | ||
+ | === **Modificare il file: '' | ||
+ | * Impostare la password per il frontend: ''' | ||
+ | * Impostare la chiave di cifratura interna: ''' | ||
+ | * Impostare l' | ||
+ | * Inserire il seguente codice dopo la riga: ''' | ||
+ | <code php> | ||
+ | 10 => array( ' | ||
+ | 10 => array( ' | ||
+ | </ | ||
+ | |||
+ | * Commentare la linea: '' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === **Creare i certificati per SAML:** === | ||
+ | # mkdir / | ||
+ | # cd / | ||
+ | # openssl req -new -x509 -newkey rsa:2048 -days 3652 -nodes -out saml.crt -keyout saml.key -subj / | ||
+ | |||
+ | |||
+ | === **Modificare il file: '' | ||
+ | * Impostare l'IdP di riferimento: | ||
+ | * * **Produzione** ''' | ||
+ | * * **Testing** | ||
+ | * Aggiungere il seguente codice dopo la linea ''' | ||
+ | <code php> | ||
+ | // Certificates | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | === **Modificare il file ''/ | ||
+ | |||
+ | * Prima di ''</ | ||
+ | < | ||
+ | Alias /simplesaml / | ||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | === **Far (ri)partire il web server** === | ||
+ | |||
+ | # / | ||
+ | |||
+ | |||
+ | A questo punto è necessario **inviare i metadati del vostro SP** ('' | ||
+ | ==== Codice PHP ==== | ||
+ | |||
+ | All' | ||
+ | |||
+ | Documentazione: | ||
+ | |||
+ | Un esempio semplice semplice: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | require_once('/ | ||
+ | $as = new SimpleSAML_Auth_Simple(' | ||
+ | if ( $as-> | ||
+ | $as-> | ||
+ | } | ||
+ | |||
+ | if ( !$as-> | ||
+ | $as-> | ||
+ | } | ||
+ | |||
+ | |||
+ | echo "Hello World!\n"; | ||
+ | |||
+ | if ( $as-> | ||
+ | echo "You are authenticated< | ||
+ | |||
+ | $attr = $as-> | ||
+ | |||
+ | echo "< | ||
+ | print_r( $attr ); | ||
+ | echo "</ | ||
+ | | ||
+ | } | ||
+ | |||
+ | |||
+ | ?> | ||
+ | <br> | ||
+ | <a href="? | ||
+ | <a href="? | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Shibboleth SP ===== | ||
+ | |||
+ | In caso si voglia implementare l' | ||
+ | |||
+ | Documentazione: | ||
+ | ==== Installazione ==== | ||
+ | |||
+ | Configurare il repository YUM: | ||
+ | |||
+ | # cat > / | ||
+ | [security_shibboleth] | ||
+ | name=Shibboleth (RHEL_6) | ||
+ | type=rpm-md | ||
+ | baseurl=http:// | ||
+ | gpgcheck=1 | ||
+ | gpgkey=http:// | ||
+ | enabled=1 | ||
+ | priority=10 | ||
+ | EOT | ||
+ | |||
+ | |||
+ | Installare: | ||
+ | |||
+ | yum install shibboleth.x86_64 httpd mod_ssl | ||
+ | |||
+ | |||
+ | ==== Configurazione ==== | ||
+ | |||
+ | |||
+ | Modificare il file: ''/ | ||
+ | |||
+ | * Sostituire tutte le occorrenze di '' | ||
+ | * Sostituire tutte le occorrenze di '' | ||
+ | * Sostituire '' | ||
+ | * Impostare handlerSSL=" | ||
+ | * Nela caso di shibboleth-2.0-native-sp prima del tag ''< | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | * Nela caso di shibboleth-3.0-native-sp prima del tag ''< | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | * Scaricare i metadati dell' | ||
+ | == IdP di Produzione == | ||
+ | # wget -O / | ||
+ | |||
+ | == IdP di Test == | ||
+ | # wget -O / | ||
+ | |||
+ | * Configurare il mapping degli attributi. Scaricate il file già pronto: | ||
+ | |||
+ | # wget -O / | ||
+ | |||
+ | * Far (ri)partire i servizi | ||
+ | |||
+ | # / | ||
+ | # / | ||
+ | | ||
+ | |||
+ | A questo punto è necessario **inviare i metadati del vostro SP** che trovate alla URL | ||
+ | |||
+ | https:// | ||
+ | |||
+ | tramite l' | ||
+ | |||
+ | Per effettuare il logout utilizzare la URL: | ||
+ | |||
+ | https:// | ||
+ | |||
+ | La configurazione del modulo shibboleth di apache si trova nel file ''/ |