1
MyFirst IdP
EuroCAMP Training This work is licensed under a Creative Commons
Attribution‐ShareAlike 3.0 Unported License.
Acknowledgements
- Portions of this training course taken from:
MyFirst IdP EuroCAMP Training This work is licensed under a Creative - - PDF document
MyFirst IdP EuroCAMP Training This work is licensed under a Creative Commons Attribution ShareAlike 3.0 Unported License . Acknowledgements Portions of this training course taken from: SWITCHaai simpleSAMLphp website EduGate
Attribution‐ShareAlike 3.0 Unported License.
htt // t k li /l t k – http://www.turnkeylinux.org/lampstack – Apache HTTPd Web Server – MySQL Database – PHP 5.3
– http://simplesamlphp.org/docs/1.8/simplesamlphp‐install
– Daemon + mod_shib for Apache
simpleSAMLphp Shibboleth IdP Shibboleth SP SAML1.1 (Shib Profile) ~ X X SAML2 0 (saml2int) X X X SAML2.0 (saml2int) X X X Identity Provider (IdP) X X ‐ Service Provider (SP) X ‐ X Bridge (IdP<‐>SP) X ‐ ‐ OAuth/OpenID X ‐ ‐ Discovery Service X ‐ ‐ Latest Version 1.8 2.2 2.4 Programming Lang. PHP Java Servlet C Primary Developer UNINETT Internet2 Internet2
cd /var/simplesamlphp/ cd /var/simplesamlphp/ cp -r config-templates/* config/ cp -r metadata-templates/* metadata/
cd /var/ svn checkout http://simplesamlphp.googlecode.com/svn/trunk/
cd /var/simplesamlphp/ cp -r config-templates/* config/ cp -r metadata-templates/* metadata/
simplesamlphp
cd /var/simplesamlphp/ svn update update to latest version svn update –r XXXX goto revision, default HEAD
/var/simplesamlphp/config/
config.php authsources.php
cd /var/simplesamlphp/config/ more config.php
http://simplesamlphp.org/docs/1.8/simplesamlphp-install #section_7 cd /var/simplesamlphp/config/ more config.php
cd /var/simplesamlphp/config/ cd /var/simplesamlphp/config/
vi config.php
pico config.php
Editor Nano VIM Open file
$ nano file.xml $ vim file.xml
Save file <ctrl>-o <esc>, :w Save and exit <ctrl>-x <esc>, :wq <esc>, ZZ Search string <ctrl>-w, string <esc>, /string Go to line <ctrl>--, number <esc>, number, number , , , <shift>-G Pro and Cons + Easy
+ Powerful
http://www.switch.ch/aai/support/presentations/installfest‐2009/ShibInstallFest‐Tipps‐and‐Tricks.ppt
'enable saml20 idp' > true
' bl l20 id ' t
'enable.saml20-idp' => true,
'auth.adminpassword' => 'your_new_password’,
–
'enable.saml20-idp' => true, tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz’ \ </dev/urandom | dd bs=32 count=1 2>/dev/null;echo
'auth.adminpassword' => 'your new password’,
'auth.adminpassword' => 'your_new_password’,
'secretsalt' => 'randombytesinsertedhere', # or type junk! 'auth.adminpassword' => 'your_new_password', 'technicalcontact_name' => 'My Name', 'technicalcontact_email' => 'my.name@inst.federated.now',
http://simplesamlphp.org/docs/1.8/simplesamlphp-install#section_7
t h d l / l th/ bl touch modules/exampleauth/enable
/* 'example-userpass' => array( 'exampleauth:UserPass', 'student:studentpass' => array( 'uid' => array('test'), 'eduPersonAffiliation' => array('member', 'student'), ),
'employee:employeepass' => array( 'uid' => array('employee'), 'eduPersonAffiliation' => array('member', 'employee'), ), ), */
'example-userpass' => array( 'exampleauth:UserPass', 'student:studentpass' => array( 'uid' => array('test'), uid > array( test ), 'eduPersonAffiliation' => array('member', 'student'), ), 'employee:employeepass' => array( 'uid' => array('employee'), 'eduPersonAffiliation' => array('member', 'employee'), ), 'username:password' => array( 'uid' => array('username'),
'eduPersonAffiliation' => array('member', 'faculty'), ), ),
'username:password' => array( 'uid' => array('username'), ' d P Affili ti ' > (' b ' 'f lt ')
'eduPersonAffiliation' => array('member', 'faculty'), 'cn' => array('My Name'), 'postalCode' => array('1017 AW'), 'telephoneNumber' => array('+31205304488'), ), ),
more attributemap/name2oid.php
echo 'idpXX-wsX.lab.iamfederated.org' >> /etc/ddclient.conf echo 'spXX-wsX.lab.iamfederated.org' >> /etc/ddclient.conf more /etc/ddclient.conf
/etc/init.d/ddclient restart grep ddclient /var/log/syslog
$metadata['https://host12- ws3.lab.iamfederated.org/simplesaml/saml2/idp/metadata.php'] = array ( 'metadata-set' => 'saml20-idp-remote', 'entityid' => 'https://host12- ws3.lab.iamfederated.org/simplesaml/saml2/idp/metadata.php', 'SingleSignOnService' => 'https://host12- ws3.lab.iamfederated.org/simplesaml/saml2/idp/SSOService.php' ); , 'SingleLogoutService' => 'https://host12- ws3.lab.iamfederated.org/simplesaml/saml2/idp/SingleLogoutSer vice.php', 'certData' => 'MIICgTCCAeoCCQCbOlrWDdX7FTANBgkqhkiG9w0BA…', 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid- format:transient', );
$metadata['https://sp12- ws3.lab.iamfederated.org/simplesaml/module.php/saml/sp/metada ta.php/default-sp'] = array ( 'AssertionConsumerService' => 'https://sp12- ws3.lab.iamfederated.org/simplesaml/module.php/saml/sp/saml2- acs.php/default-sp', 'SingleLogoutService' => 'https://sp12-
); SingleLogoutService => https://sp12- ws3.lab.iamfederated.org/simplesaml/module.php/saml/sp/saml2- logout.php/default-sp', );
vi /etc/apache2/sites enabled/000 default vi /etc/apache2/sites-enabled/000-default <VirtualHost *:80> … <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </IfModule> </VirtualHost>
a2enmod rewrite headers /etc/init.d/apache2 restart / tua
Header add Strict-Transport-Security "max-age=15768000"
/var/simplesamlphp/metadata/saml20-idp-hosted.php $metadata['__DYNAMIC:1__'] = array();
/var/simplesamlphp/config/authsources.php 'default-sp' => array( 'saml:SP', 'entityID' => NULL, // https://{hostname}/sp is a suitable entityID.
'logging level' > LOG NOTICE 'logging.level' => LOG NOTICE, 'logging.handler' => 'syslog', 'logging.processname' => ’simplesamlphp', tail –f /var/log/syslog | grep ‘simplesaml’
tail –f /var/log/syslog | grep ‘simplesaml’
'logging.level' => LOG_DEBUG, 'logging.handler' => 'file’ cd /var/simplesamlphp chown -R www-data:www-data log chmod -R g+w log
cd /var/simplesamlphp chown -R www-data:www-data log chmod -R g+w log tail –f /var/simplesaml/log/simplesaml.log
/* E bl th th filt b l t t ti ll
/* Enable the authproc filter below to automatically generated eduPersonTargetedID. */ 20 => 'core:TargetedID', */ 'userid.attribute' => 'uid’,
20 => 'core:TargetedID', 20 => array( 'class' => 'core:TargetedID', 'attributename' => 'uid’ ),
10 => array( 'class' => 'core:AttributeAdd', 'o' => 'yourorg', 'l' => 'Istanbul', 'ou' => 'ITS', 'schacHomeOrganization' => 'yourorg.ac.bv', ),
10 => array( 'class' => 'core:AttributeAdd', '%replace', 'eduPersonAffiliation' => array('student', 'members'), ),
10 (
10 => array( 'class' => 'core:ScopeAttribute', 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', ),
10 => array( 'class' => 'core:ScopeAttribute', 'scopeAttribute' => 'schacHomeOrganization', 'sourceAttribute' => 'uid', 'targetAttribute' => 'eduPersonPrincipalName', ),
50 ( 50 => array( 'class' => 'core:AttributeMap', 'mail' => 'email', 'uid' => 'user' 'cn' => array('name', 'displayName'), ), 60 => array( 'class' => 'core:AttributeMap', 'name2oid',
name2oid , ),
i
'AttributeNameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri', 'authproc' => array( // Convert LDAP names to oids. 100 => array( 'class' => 'core:AttributeMap', 'name2oid’ ), ),
'audio' => 'urn:oid:0.9.2342.19200300.100.1.55’, 'aRecord' => 'urn:oid:0.9.2342.19200300.100.1.26', 'aliasedEntryName' => 'urn:oid:2.5.4.1', 'aliasedObjectName' => 'urn:oid:2.5.4.1', 'associatedDomain' => 'urn:oid:0.9.2342.19200300.100.1.37', 'associatedName' => 'urn:oid:0.9.2342.19200300.100.1.38', 'audio' => 'urn:oid:0.9.2342.19200300.100.1.55’,
/* 'example-sql' => array( 'sqlauth:SQL', 'dsn' => 'mysql:host=localhost;dbname=simplesaml', 'username' => 'simplesaml', 'password' => 'secretpassword',
'query' => 'SELECT "username", "name", "email" FROM "users" WHERE "username" = :username AND "password" = :password', ), */
' l l ' > ( 'sql-exampleorg-groups' => array( 'sqlauth:SQL', 'dsn' => 'mysql:host=localhost;dbname=simplesaml', 'username' => 'simplesaml', 'password' => 'secretpassword', 'query' => 'SELECT users.username, name, email, groupname AS groups FROM users LEFT JOIN usergroups ON users.username=usergroups.username WHERE users.username = :username AND password = :password',
:username AND password :password , ), 'query' => 'SELECT * FROM users WHERE username = :username AND password = :password',
Username Password Name stud1 pass1 Juan Student staff2 pass2 Twee Staff teach3 pass3 Trio Teacher alum4 pass4 Quart Alumni
mysql –u root –p simplesaml Enter password: mysql> show tables; mysql> explain users; mysql> select * from users;
// ' th' > ' l '
// 'auth' => 'example-userpass', 'auth' => 'example-sql',
/* 'example-ldap' => array( 'ldap:LDAP', 'hostname' => 'localhost', // all attributes are fetched. 'attributes' => NULL, 'dnpattern' => 'uid=%username%,ou=people,dc=example,dc=org', 'search.enable' => FALSE, … ), */
// ' th' > ' l '
// 'auth' => 'example-userpass', 'auth' => 'example-sql',
'example-ldap' => array( 'ldap:LDAP', 'hostname' => 'localhost', // all attributes are fetched. 'attributes' => NULL, 'attributes' => array('uid','sn','cn','entryDN', 'objectClass'), 'dnpattern' => 'uid=%username%,ou=people,dc=example,dc=org', 'search.enable' => FALSE, … ),
'example-ldap' => array( 'ldap:LDAP', ldap:LDAP , 'hostname' => 'localhost', // all attributes are fetched. 'attributes' => array('uid','sn','cn','entryDN', 'objectClass'), 'dnpattern' => 'uid=%username%,ou=people,dc=example,dc=org', 'search.enable' => FALSETRUE, 'search.base' => 'ou=people,dc=example,dc=org',
… ),
10 => array( 'class' => 'core:AttributeAlter', 'subject' => 'entryDN', 'pattern' => '/ou=people/', 'replacement' => 'staff', 'target' => 'eduPersonPrimaryAffiliation', ), 11 => array( 'class' => 'core:AttributeAlter', 'subject' => 'entryDN', 'pattern' => ’/ou=students/', 'replacement' => 'student', 'target' => 'eduPersonPrimaryAffiliation', ),
cd /var/simplesamlphp/modules svn checkout \ https://forja.rediris.es/svn/confia/attributecollector/trunk/
https://forja.rediris.es/svn/confia/attributecollector/trunk/ attributecollector
'authproc' => array( 10 => array( 'existing' => 'preserve', 'class' => 'attributecollector:AttributeCollector', 'uidfield' => 'uid', 'collector' => array( 'class' => 'attributecollector:SQLCollector', 'dsn' => 'mysql:host=localhost;dbname=simplesaml', ' ' ' i l l' 'username' => 'simplesaml', 'password' => 'secretpassword', 'query' => 'SELECT * from users where username=:uidfield', ), ), ),
/etc/ssl/certs/cert.pem (crt + key)
l k 2048 509 d 3652 d \
config/config.php: (metadata signing) 'metadata.sign.enable' => FALSE, 'metadata.sign.privatekey' => NULL, 'metadata.sign.certificate' => NULL, metadata/saml20-idp-hosted.php: 'privatekey' => 'server.pem', 'certificate' => 'server.crt', config/authsource: (signing messages of SP) 'redirect.sign' => true, 'privatekey' => 'server.pem’,
/* * Consent module is enabled (with no permanent storage, using cookies). */ 90 => array( 'class' => 'consent:Consent', 'store' => 'consent:Cookie', 'focus' => 'yes', 'checked' => TRUE ), */
cd /var/simplesaml bin/translation.php pull ./modules/core/dictionaries/frontpage.translation.json cd /var/simplesaml
– The ‘\’ continues the input on the next line.
cd /var/simplesaml find . -name '*.translation.json' | xargs -n 1 \ bin/translation.php pull
/* * Languages available, RTL languages, and default language */ 'language available' => array('en' 'no' 'nn' 'se'
language.available => array( en , no , nn , se , 'da', 'de', 'sv', 'fi', 'es', 'fr', 'it', 'nl', 'lb', 'cs', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-BR', 'tr', 'ja', 'zh- tw', 'ru'), 'language.rtl' => array('ar','dv','fa','he','ps','ur'), 'language.default' => 'en',
templates/includes/header.php
htt // i l l h /d /1 8/ i l l h th i – http://simplesamlphp.org/docs/1.8/simplesamlphp‐theming
cd /var/simplesaml mkdir –p modules/yourorg/themes/theme/default/includes/ mkdir p modules/yourorg/www
touch modules/yourorg/default-enable cp templates/includes/header.php templates/includes/header.php modules/yourorg/themes/theme/default/includes/ touch modules/yourorg/default-enable
OLD: <link rel="icon" type="image/icon" href="/<?php echo $this- >data['baseurlpath']; ?>resources/icons/favicon.ico" /> NEW: <link rel="icon" type="image/icon" href="<?php echo SimpleSAML_Module::getModuleUrl('yourorg/favicon.ico');?>" />