Simplesamlphp SP
- https://simplesamlphp.org/
- Ohjeet Shibbolointiin
- https://sp-registry.it.helsinki.fi/
- HY idp entityid tuotanto: https://login.helsinki.fi/shibboleth testi: https://login-test.it.helsinki.fi/shibboleth
- idp-metadata tuotanto: https://login.helsinki.fi/metadata/sign-hy-metadata.xml testi: https://login-test.it.helsinki.fi/metadata/sign-hy-test-metadata.xml
- Metadatan allekirjoitusvarmenne tuotanto: https://login.helsinki.fi/metadata/sc/sign-login.helsinki.fi.crt testi: https://login.helsinki.fi/metadata/sc/sign-login.helsinki.fi.crt
Autentikonti-ohjeessa puhutaan, kuinka asennetaan Shibboleth-SP, mod_shib ja apache. Tässä muistiossa asennetaan simplesamlphp SP ja nginx.
Vaatimukset:
Aktivoi application streamit nginx:1.20, php:8.0 ja nodejs:18
dnf module enable nginx:1.20 php:8.0 nodejs:18
asenna paketit
- nginx
- php
- php-cli
- php-common
- php-fpmd
- php-gd
- php-intl
- php-mbstring
- php-opcache
- php-pdo
- php-xml
Asenna simplesamlphp githubista:
asenna simplesamlphp
curl -LJ https://github.com/simplesamlphp/simplesamlphp/releases/download/v2.3.6/simplesamlphp-2.3.6-full.tar.gz | tar fxvz -
mv simplesamlphp-2.3.6 simplesamlphp
cd simplesamlphp
./bin/composer install
./bin/composer require simplesamlphp/simplesamlphp-module-metarefresh
Kopioi config/config.php.dist config/config.php. Editoi:
- baseURL
- technicalcontact_name
- technicalcontact_email
- 'timezone' => 'Europe/Helsinki'
- secretsalt
- auth.adminpassword
Katso että php-fpm-prosessilla on lukuoikeus tiedostoon.
Tee avaimet shibbolethiin ja vie luomasi varmenne sp-rekisteriin:
Hae Idp:n allekirjoitusavain cert-hakemistoon:
https://login.helsinki.fi/metadata/sc/sign-login.helsinki.fi.crtwget -O ../cert/
Konfiguroi config/authsources.php. Katso että entityID on sama sp-rekisterissä.
<?php $config = [ /* * When multiple authentication sources are defined, you can specify one to use by default * in order to authenticate users. In order to do that, you just need to name it "default" * here. That authentication source will be used by default then when a user reaches the * SimpleSAMLphp installation from the web browser, without passing through the API. * * If you already have named your auth source with a different name, you don't need to change * it in order to use it as a default. Just create an alias by the end of this file: * * $config['default'] = &$config['your_auth_source']; */ // This is a authentication source which handles admin authentication. 'admin' => [ // The default is to use core:AdminPassword, but it can be replaced with // any authentication source. 'core:AdminPassword', ], // An authentication source which can authenticate against SAML 2.0 IdPs. 'default-sp' => [ 'saml:SP', // The entity ID of this SP. 'entityID' => 'https://blogs-dev.local/simplesamlphp', // The entity ID of the IdP this SP should contact. // Can be NULL/unset, in which case the user will be shown a list of available IdPs. 'idp' => 'https://login-test.it.helsinki.fi/shibboleth', // The URL to the discovery service. // Can be NULL/unset, in which case a builtin discovery service will be used. 'discoURL' => null, // Private key and certificate 'certificate' => 'blogs-dev.local-cert.pem', 'privatekey' => 'blogs-dev.local-key.pem', /* * If SP behind the SimpleSAMLphp in IdP/SP proxy mode requests * AuthnContextClassRef, decide whether the AuthnContextClassRef will be * processed by the IdP/SP proxy or if it will be passed to the original * IdP in front of the IdP/SP proxy. */ 'proxymode.passAuthnContextClassRef' => false, /* * The attributes parameter must contain an array of desired attributes by the SP. * The attributes can be expressed as an array of names or as an associative array * in the form of 'friendlyName' => 'name'. This feature requires 'name' to be set. * The metadata will then be created as follows: * <md:RequestedAttribute FriendlyName="friendlyName" Name="name" /> */ /* 'name' => [ 'en' => 'A service', 'no' => 'En tjeneste', ], */ 'attributes' => [ 'uid', 'displayName', 'schacHomeOrganization', 'eduPersonPrincipalName', 'mail', // Specify friendly names for these attributes: 'sn' => 'urn:oid:2.5.4.4', 'givenName' => 'urn:oid:2.5.4.42', ], 'attributes.required' => [ 'uid', 'displayName', 'mail', 'eduPersonPrincipalName', ], 'attributes.NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', ], ];
Katso, että
- entityID vastaa sp-rekisterissä olevaa
- certificate ja privatekey ovat asennettu ja php:lla on lukuoikeus tiedostoihin
- idp:n entityid on täsmälleen samassa muodossa
- Sovelluksesi tarvitsemat attribuutit ovat listattu ja samat attribuutit on lisätty sp-rekisteriin
Konfiguroi simplesamlphp nginxiin. Tuollainen blokki pitäisi löytyä sovelluksesi ssl-virtualhostista:
Unknown macro: noformat. Click on this message for details.
Käynnistä php-fpm ja nginx.
Kirjaudu selaimella idp:n admin-työkaluun /simplesamlphp/admin. Mene välilehteen federation, ja laajenna SAML 2.0 SP metadata ikkuna. Etsi metadatasta AssertionConsumerService HTTP-Post muotoinen url ja vie se SP-rekisteriin. Seiraavalsi seuraa linkkiä XML to SimpleSAMLphp metadata converter. Hae käyttämäsi idp:n metadata leikepöydälle (curl https://login-test.it.helsinki.fi/metadata/sign-hy-test-metadata.xml | xclip) ja vie se muunnostyökaluun. klikkaa parse, ja vie konvertoitu metadata tiedostoon metadata/saml20-idp-remote.php