Stand: März 2015, simplesamlphp-1.10, www.simplesamlphp.org
Dieses Dokument beschreibt die Installation und Konfiguration eines Identity Provider (IdP) mit SimpleSAMLphp im Verbund der DFN-AAI.
RedHat EL 5 oder 6, simpleSAMLphp-1.10, php-5.3
einfache Bereitstellung eines IdP 'SAML2
' und 'SAML1.1
' (shib13) mit Anbindung an das lokale ldap, Attribute werden aus vorhandenen Attributen erzeugt und in das geforderte Format überführt.
Folgende Attribute werden bereitgestellt:
Alle eduPerson-Attribute werden direkt oder indirekt aus vorhandenen LDAP-Attributen erzeugt oder befüllt.
Folgende Attribute werden als Hilfsattribute erzeugt:
Version simpleSAMLphp-1.10.1
Ich brauche für die Attributfilter die DN des Nutzers. Und ich möchte nur die erste E-Mail-Adresse aus LDAP haben (bei uns ist das mail-attribut in ldap multivalued). Dazu habe ich folgende Zeilen in der Datei
'www/auth/login.php
' hinzugefügt:
107c107,108 < --- > $attributes['dn'] = array($dn,); > $attributes['mail']= array($attributes['mail'][0],);
'metadata/saml20-idp-hosted.php
'
$metadata['https://idp.fh-schmalkalden.de/simplesaml'] = array( /* * The hostname of the server (VHOST) that will use this SAML entity. * * Can be '__DEFAULT__', to use this entry by default. */ 'host' => '__DEFAULT__', /* X.509 key and certificate. Relative to the cert directory. */ 'privatekey' => 'idp.key', 'certificate' => 'idp.crt', /* * Authentication source to use. Must be one that is configured in * 'config/authsources.php'. */ 'auth' => 'auth/login.php', 'userid.attribute' => 'uid', /* Uncomment the following to use the uri NameFormat on attributes. */ 'attributes.NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri', );
'metadata/shib13-idp-hosted.php
'
$metadata['https://idp.fh-schmalkalden.de/simplesaml'] = array( /* * The hostname of the server (VHOST) that will use this SAML entity. * * Can be '__DEFAULT__', to use this entry by default. */ 'host' => '__DEFAULT__', /* X.509 key and certificate. Relative to the cert directory. */ 'privatekey' => 'idp.key', 'certificate' => 'idp.crt', /* * Authentication source to use. Must be one that is configured in * 'config/authsources.php'. */ 'auth' => 'auth/login.php', 'userid.attribute' => 'uid', );
'config/ldap.php
'
... $config = array ( /** * LDAP configuration. This is only relevant if you use the LDAP authentication plugin. * * The attributes parameter is a list of attributes that should be retrieved. * If the attributes parameter is set to null, all attributes will be retrieved. */ #'auth.ldap.dnpattern' => 'uid=%username%,dc=feide,dc=no,ou=feide,dc=uninett,dc=no', 'auth.ldap.hostname' => 'ldapmaster.fh-schmalkalden.de ldapslave.fh-schmalkalden.de', 'auth.ldap.attributes' => array('gidNumber','mail','sn','givenName','ou','uid','employeeType','organizationalStatus'), 'auth.ldap.enable_tls' => TRUE, /* * Searching the DN of the user. */ /* Set this to TRUE to enable searching. */ 'auth.ldap.search.enable' => TRUE, /* The base DN for the search. */ 'auth.ldap.search.base' => 'dc=fh-sm,dc=de', /* The attribute(s) to search for. * * This may be a single string, or an array of string. If this is an array, then any of the attributes * in the array may match the value the user supplied as the username. */ 'auth.ldap.search.attributes' => 'uid', /* The username & password the simpleSAMLphp should bind as before searching. If this is left * as NULL, no bind will be performed before searching. */ 'auth.ldap.search.username' => NULL, 'auth.ldap.search.password' => NULL, ); ...
'config/config.php
'
... 'enable.saml20-idp' => true, 'enable.shib13-idp' => true, 'enable.adfs-idp' => false, 'enable.wsfed-sp' => false, 'enable.authmemcookie' => false, ...
Einige Attribute fehlen in der attributeMap! Diese Attribute bitte ergänzen für automatisches urn-Präfix:
'attributemap/addurnprefix.php
'
'ou' => 'urn:mace:dir:attribute-def:ou', 'eduPersonTargetedID' => 'urn:mace:dir:attribute-def:eduPersonTargetedID',
Alle eduPerson-Attribute werden aus ldap-attributen beim Aufruf erzeugt. An der FH Schmalkalden gibt es zur Unterscheidung von Student oder Mitarbeiter zwei unterschiedlichen ldap-Zweige ou=students und ou=people. Anhand der DN eines Nutzers wird zunächst nach Student (student) oder Mitarbeiter (employee) unterschieden. Pro Mitarbeiter gibt es ein LDAP-Attribut, aus welchem weitere Affiliations abgeleitet werden (staff oder faculty). Besitzt der Nutzer ein Attribut „organizationalStatus“ und ist der Wert „terminated“, werden alle vorherigen Werte der Affiliation durch den einen Wert „alum“ überschrieben.
'config/config.php
'
/* * Authentication processing filters that will be executed for all IdPs * Both Shibboleth and SAML 2.0 */ 'authproc.idp' => array( /* Enable the authproc filter below to automatically generated eduPersonTargetedID. */ 15 => 'core:TargetedID', /* add some attributes with default values */ 16 => array( 'class' => 'core:AttributeAdd', 'scope' => array('fh-schmalkalden.de'), 'eduPersonAffiliation' => array('member'), 'eduPersonEntitlement' => array('common-lib-terms'), ), /* create Principal */ 18 => array( 'class' => 'core:ScopeAttribute', 'sourceAttribute' => 'uid', 'scopeAttribute' => 'scope', 'targetAttribute' => 'eduPersonPrincipalName', ), /* set affiliation, depends on ldap attributes */ 24 => array( 'class' => 'core:PHP', 'code' => ' if (strpos($attributes["dn"][0],"ou=students") !== false) { $attributes["eduPersonAffiliation"][] = "student"; }; if (strpos($attributes["dn"][0],"ou=people") !== false) { $attributes["eduPersonAffiliation"][] = "employee"; }; if (strpos($attributes["employeeType"][0],"Angestellter") !== false) { $attributes["eduPersonAffiliation"][] = "staff"; }; if (strpos($attributes["employeeType"][0],"Hochschullehrer") !== false) { $attributes["eduPersonAffiliation"][] = "faculty"; }; if (strpos($attributes["organizationalStatus"][0],"terminated") !== false) { $attributes["eduPersonAffiliation"] = array("alum"); $attributes["eduPersonEntitlement"] = None; }; ', ), 25 => array( 'class' => 'core:ScopeAttribute', 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', ), /* Enable the authproc filter below to add URN Prefixces to all attributes */ 28 => array( 'class' => 'core:AttributeMap', 'addurnprefix' ), // Adopts language from attribute to use in UI 30 => 'core:LanguageAdaptor', /* Add a realm attribute from edupersonprincipalname 40 => 'core:AttributeRealm', */ 45 => array( 'class' => 'core:StatisticsWithAttribute', 'attributename' => 'realm', 'type' => 'saml20-idp-SSO', ), /* When called without parameters, it will fallback * by checking the 'attributes' parameter in metadata on IdP hosted and SP remote. */ # limitiert die attribute, siehe attributes bei den sp-metadaten 50 => 'core:AttributeLimit', # hier kommt micro approve: 90 => array( 'class' => 'consent:Consent', 'store' => 'consent:Cookie', ), // If language is set in Consent module it will be added as an attribute. #99 => 'core:LanguageAdaptor', ), ... weitere filter
touch modules/metarefresh/enable cp modules/metarefresh/config-templates/*.php config/ cd ../modules/metarefresh/bin ./metarefresh.php -s https://www.aai.dfn.de/fileadmin/metadata/DFN-AAI-Test-metadata.xml>dfn-metadata.txt
und an diese Datei anhängen:
metadata/saml20-sp-remote.php
Dieses Update wird dann später per cron-job automatisch durchgeführt. Diese Variante NUR ZUM TEST, später wird ein eigenes Verzeichnis erstellt und die Metadatan werden per cronjob regelmäßig geupdated. Siehe letzter Absatz.
https://idp-host/simplesaml/saml2/idp/metadata.php
https://testsp2.aai.dfn.de/secure-all
oder zusätzlich als Member
siehe http://simplesamlphp.org/docs/1.10/simplesamlphp-automated_metadata
03. März 2015, parsing der xml-metafiles dfn-aai dauert sehr lange, bis zu 10min, fehlermeldung von php:
PHP Fatal error: Maximum execution time of 600 seconds exceeded in /var/simplesamlphp/lib/xmlseclibs.php on line 770
Dazu dieser Hinweis:
https://simplesamlphp.org/metaprocessing
ich habe die xmlseclibs.php ausgetauscht wie in der Anleitung vorgeschlagen, aus 10min werden nach Austausch der xmlseclibs.php 5sec.