cn:ccr:aai:howto:saml-sp-rhel7
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cn:ccr:aai:howto:saml-sp-rhel7 [2017/04/20 09:08] – enrico@infn.it | cn:ccr:aai:howto:saml-sp-rhel7 [2022/12/18 10:54] (current) – enrico@infn.it | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== RHEL 7: Configurare un Service Provider SAML 2.0 ====== | ||
| + | |||
| + | 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 epel-release | ||
| + | # yum install httpd mod_ssl php php-xml php-mcrypt php-mbstring | ||
| + | # curl -L https:// | ||
| + | # mv / | ||
| + | ==== Configurazione ==== | ||
| + | |||
| + | Documentazione: | ||
| + | |||
| + | Scaricare i metadati dell' | ||
| + | |||
| + | == IdP di Produzione == | ||
| + | |||
| + | # curl -o / | ||
| + | |||
| + | == IdP di Test == | ||
| + | |||
| + | # curl -o / | ||
| + | | ||
| + | **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( ' | ||
| + | 20 => array( ' | ||
| + | </ | ||
| + | |||
| + | === Creare i certificati per SAML: === | ||
| + | # 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** | ||
| + | <code php> | ||
| + | ' | ||
| + | </ | ||
| + | **Test** | ||
| + | <code php> | ||
| + | ' | ||
| + | </ | ||
| + | Aggiungere il seguente codice dopo la linea ''' | ||
| + | <code php> | ||
| + | // Certificates | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | </ | ||
| + | |||
| + | Modificare il file ''/ | ||
| + | |||
| + | Prima di ''</ | ||
| + | < | ||
| + | Alias /simplesaml / | ||
| + | < | ||
| + | Options FollowSymLinks | ||
| + | AllowOverride None | ||
| + | Require all granted | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | Far (ri)partire il web server | ||
| + | |||
| + | # systemctl start httpd | ||
| + | |||
| + | |||
| + | A questo punto è necessario **inviare i metadati del vostro SP**, scaricandoli dalla url: | ||
| + | https:// | ||
| + | tramite l' | ||
| + | |||
| + | |||
| + | ==== 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: | ||
| + | |||
| + | # curl -o / | ||
| + | |||
| + | Installare: | ||
| + | # yum install epel-release | ||
| + | # yum install shibboleth httpd mod_ssl | ||
| + | |||
| + | ==== Configurazione ==== | ||
| + | |||
| + | |||
| + | Modificare il file: ''/ | ||
| + | |||
| + | * Sostituire tutte le occorrenze di '' | ||
| + | * Sostituire tutte le occorrenze di '' | ||
| + | * Sostituire '' | ||
| + | * Impostare '' | ||
| + | * Prima del tag ''< | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | * Scaricare i metadati dell' | ||
| + | == IdP di Produzione == | ||
| + | # curl -o / | ||
| + | |||
| + | == IdP di Test == | ||
| + | # curl -o / | ||
| + | |||
| + | * Configurare il mapping degli attributi. Scaricate il file già pronto: | ||
| + | |||
| + | # curl -o / | ||
| + | * Far (ri)partire i servizi | ||
| + | |||
| + | # systemctl restart httpd | ||
| + | # systemctl restart shibd | ||
| + | | ||
| + | |||
| + | A questo punto è necessario **inviare i metadati del vostro SP** che trovate all' | ||
| + | |||
| + | https:// | ||
| + | |||
| + | tramite l' | ||
| + | |||
| + | Per testare la configurazione, | ||
| + | |||
| + | mkdir / | ||
| + | echo "<? | ||
| + | | ||
| + | Invocare lo script all' | ||
| + | | ||
| + | https:// | ||
| + | | ||
| + | Gli attributi dell' | ||
| + | |||
| + | Per effettuare il logout utilizzare l' | ||
| + | |||
| + | https:// | ||
| + | |||
| + | La configurazione del modulo shibboleth di apache si trova nel file ''/ | ||
| + | |||
| + | In caso si utilizzino CMS, in particolare Joomla, si presti attenzione alle regole di riscrittura presenti nel file '' | ||
| + | |||
| + | RewriteCond %{REQUEST_URI} !^/ | ||
| + | RewriteCond %{REQUEST_FILENAME} !-f | ||
| + | RewriteCond %{REQUEST_FILENAME} !-d | ||
| + | RewriteCond %{REQUEST_URI} !^/ | ||
| + | RewriteCond %{REQUEST_URI} !^/ | ||
| + | RewriteRule .* index.php [L] | ||
| + | |||
| + | |||
| + | ===== SP generico ===== | ||
| + | Per configurare un Service provider SAML è necessario registrare alcune informazioni relative all' | ||
| + | |||
| + | ==== Certificato dell' | ||
| + | |||
| + | E' il certificato che l'IdP usa per firmare e cifrare i pacchetti SAML è un certificato self-signed che può essere scaricato in formato PEM, direttamente dall' | ||
| + | |||
| + | === IdP di Produzione === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | === IdP di TEST === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | ==== Secondo Certificato dell' | ||
| + | Se configurate un SP SAML durante un key-rollover, | ||
| + | |||
| + | === IdP di Produzione === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | === IdP di TEST === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | ==== > IdP Issuer (Entity ID) ==== | ||
| + | |||
| + | === IdP di Produzionee === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | === IdP di TEST === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ==== > IDP Login URL ==== | ||
| + | === IdP di Produzionee === | ||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | === IdP di TEST === | ||
| + | |||
| + | < | ||
| + | https:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== > IDP binding ==== | ||
| + | |||
| + | < | ||
| + | HTTP-Redirect | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== > User Login Setting ==== | ||
| + | Questo è l' | ||
| + | |||
