Priporočamo, da za OS strežnika izberete Linux CentOS 6 ali novejši. IdP je realiziran z openLDAP in SimpleSAMLphp.
Predpostavljamo, da imate pred pričetkom postavitve IdP, spletni strežnik s SSL podporo že nameščen in delujoč.
yum install openldap-servers yum install openldap-clientsV pomoč so na voljo: Za upravljanje z vsebino (polnjenje in ažuriranje) lahko uporabite storitev SIO MDM, ki se nahaja na naslovu: Storitev SIO MDM.
cd /opt
Z uradne spletne strani SimplesamlPHP prenesite zadnjo verzijo.
Ustvarite nastavitvene datoteke s privzetimi vrednostmi:cd /opt/simplesamlphp cp -r config-templates/*.php config/ cp -r metadata-templates/*.php metadata/V mapi /opt/simplesamlphp imate sedaj nameščen SimpleSAMLphp. S tem je namestitev končana, urediti je potrebno še nastavitve.
UseCanonicalName Off ... NameVirtualHost *:80 NameVirtualHost IP_strežnika:443 ... <VirtualHost *:80> ServerName idp.organizacija.si </VirtualHost>
<VirtualHost IP_strežnika:443>
<VirtualHost IP_strežnika:443> ServerName idp.organizacija.si Alias /simplesaml /opt/simplesamlphp/www ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log LogLevel warn SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW SSLCertificateFile /etc/pki/tls/certs/localhost.crt SSLCertificateKeyFile /etc/pki/tls/private/localhost.key #SSLCertificateChainFile /etc/ssl/www_.ca-bundle ServerSignature On </VirtualHost>Statusna stran nameščenega SimpleSAMLphp bo tako dostopna na naslovu: https://idp.organizacija.si/simplesaml
cd /opt/simplesamlphp touch modules/expirycheck/enable
'auth.adminpassword' => 'geslo', 'admin.protectindexpage'=> true, 'admin.protectmetadata' => false, /** * A possible way to generate a random salt is by running the following command from a unix shell: * tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz' </dev/urandom | dd bs=32 count=1 2>/dev/null;echo */ 'secretsalt' => '0123456789abcdefghijklmnopqrstuvwxyz', 'technicalcontact_name' => 'Administrator', 'technicalcontact_email' => 'podpora@domena.tld', /* * The timezone of the server. This option should be set to the timezone you want * simpleSAMLphp to report the time in. The default is to guess the timezone based * on your system timezone. * * See this page for a list of valid timezones: http://php.net/manual/en/timezones.php */ 'timezone' => 'Europe/Ljubljana', /* * Enable * * Which functionality in simpleSAMLphp do you want to enable. Normally you would enable only * one of the functionalities below, but in some cases you could run multiple functionalities. * In example when you are setting up a federation bridge. */ 'enable.saml20-idp' => true, 'enable.shib13-idp' => false, 'enable.adfs-sp' => false, 'enable.wsfed-sp' => false, 'enable.authmemcookie' => false, /* * Languages available, RTL languages, and what language is default */ 'language.available' => array('sl', 'en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'fr', 'it', 'nl', 'lb', 'cs', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-BR', 'tr', 'ja', 'zh-tw', 'ru', 'et', 'he'), 'language.rtl' => array('ar','dv','fa','ur','he'), 'language.default' => 'en', /* * 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 add URN Prefixces to all attributes 10 => array( 'lass' => 'core:AttributeMap', 'addurnprefix' ), */ /* Enable expirycheck module * * warndaysbefore - how many days before expiry date the "about to expire" warning will show to the user. * date_format - date format in PHP Date() syntax * */ 10 => array( 'class' => 'expirycheck:ExpiryDate', 'netid_attr' => 'eduPersonPrincipalName', 'expirydate_attr' => 'schacExpiryDate', 'warndaysbefore' => '60', 'date_format' => 'd.m.Y', ), // Enable the authproc filter below to automatically generated eduPersonTargetedID. 20 => 'core:TargetedID',
// Adopts language from attribute to use in UI 30 => 'core:LanguageAdaptor',
45 => array( 'class' => 'core:StatisticsWithAttribute',
'attributename' => 'realm',
'type' => 'saml20-idp-SSO', ),
/* When called without parameters, it will fallback to filter attributes ‹the old way› * by checking the 'attributes' parameter in metadata on IdP hosted and SP remote. */ 49 => array('class' => 'core:AttributeMap', 'name2oid', '%duplicate'),
50 => array( 'class' => 'core:AttributeLimit',
'default' => TRUE,
'eduPersonTargetedID', 'eduPersonAffiliation', ),
/* * Consent module is enabled (with no permanent storage, using cookies). */ 90 => array( 'class' => 'consent:Consent', 'store' => 'consent:Cookie', 'focus' => 'yes', 'checked' => TRUE ),
// If language is set in Consent module it will be added as an attribute. 99 => 'core:LanguageAdaptor', ),
// Example of a LDAP authentication source. 'ldap' => array( 'ldap:LDAP', // The hostname of the LDAP server. 'hostname' => 'localhost', // Whether SSL/TLS should be used when contacting the LDAP server. // 'enable_tls' => FALSE, // Whether debug output from the LDAP library should be enabled. // Default is FALSE. 'debug' => FALSE, // The timeout for accessing the LDAP server, in seconds. // The default is 0, which means no timeout. 'timeout' => 0,
// Which attributes should be retrieved from the LDAP server. // This can be an array of attribute names, or NULL, in which case // all attributes are fetched. 'attributes' => array('cn', 'sn', 'o', 'facsimileTelephoneNumber', 'postalAddress', 'postalCode', 'registeredAddress', 'displayName', 'givenName', 'mail', 'mobile', 'preferredLanguage', 'eduPersonAffiliation', 'eduPersonPrimaryAffiliation','eduPersonScopedAffiliation', 'eduPersonPrincipalName', 'eduPersonEntitlement', 'schacMotherTongue', 'schacGender', 'schacDateOfBirth', 'schacPlaceOfBirth', 'schacCountryOfCitizenship', 'schacSn1', 'schacSn2', 'schacHomeOrganization', 'schacHomeOrganizationType', 'schacPersonalPosition', 'schacPersonalUniqueCode', 'schacPersonalUniqueID', 'schacUUID', 'schacExpiryDate'), /* * The pattern which should be used to create the users DN given the username. * %username% in this pattern will be replaced with the users username. * * This option is not used if the search.enable option is set to TRUE. */ 'dnpattern' => 'eduPersonPrincipalName=%username%,dc=organizacija,dc=si', /* * As an alternative to specifying a pattern for the users DN, it is possible to * search for the username in a set of attributes. This is enabled by this option. */ 'search.enable' => FALSE, /* * The DN which will be used as a base for the search. * This can be a single string, in which case only that DN is searched, or an * array of strings, in which case they will be searched in the order given. */ 'search.base' => NULL, /* * The attribute(s) the username should match against. * * This is an array with one or more attribute names. Any of the attributes in * the array may match the value the username. */ 'search.attributes' => NULL, /* * The username & password the simpleSAMLphp should bind to before searching. If * this is left as NULL, no bind will be performed before searching. */ 'search.username' => "cn=root,dc=organizacija,dc=si", 'search.password' => "geslo", // If the directory uses privilege separation, // the authenticated user may not be able to retrieve // all required attribures, a privileged entity is required // to get them. This is enabled with this option. 'priv.read' => FALSE,
// The DN & password the simpleSAMLphp should bind to before // retrieving attributes. These options are required if // 'priv.read' is set to TRUE. 'priv.username' => NULL, 'priv.password' => NULL, ),
$metadata['https://idp.organizacija.si/idp/20110921'] = array( // The hostname of the server (VHOST) that this SAML entity will use. 'host' => 'idp.organizacija.si', // X.509 key and certificate. Relative to the cert directory. 'privatekey' => 'idp.organizacija.si.key.pem', 'certificate' => 'idp.organizacija.si.crt.pem', // Sign SAML requests 'redirect.sign' => true, 'redirect.validate' => false, // Authentication plugin to use. login.php is the default one that uses LDAP. 'auth' => 'ldap', // Show privacy policy - this will be shown on the consent page. %SPENTITYID% 'privacypolicy' => 'http://www.organizacija.si/pravila.html', // Set attribute name format 'AttributeNameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri', //Shibboleth Scope: all domains this IdP authenticates 'scope' => array ('organizacija.si', 'poddomena.organizacija.si', 'nasa-domena.si'), )
Kot skrbnik IdP morate zagotoviti, da ima IdP na voljo ažurne metapodatke ArnesAAI federacije. Le tako IdP pridobi informacije o novih storitvah, ki se pridružujejo federaciji. Periodično posodabljanje si zagotovite z avtomatizacijo ročnega postopka oz. zaporedja ukazov. Predhodno preverite, ali imate orodje samlsign na sistemu že nameščeno, v nasprotnem primeru ga namestite npr. tako:
Aktivirajte crontab in metadata autorefresh modula v SimplesamlPHP in pripravite vzorčne nastavitve za modula.
[root@simplesamlphp] cd /opt/simplesamlphp [root@simplesamlphp simplesamlphp] touch modules/cron/enable [root@simplesamlphp simplesamlphp] cp modules/cron/config-templates/*.php config/ [root@simplesamlphp simplesamlphp] touch modules/metarefresh/enable [root@simplesamlphp simplesamlphp] cp modules/metarefresh/config-templates/*.php config/
Ustvarite mape, v katere se bodo shranjevali metapodatki in jim dodelite ustrezne pravice.
[root@simplesamlphp] cd /opt/simplesamlphp/metadata [root@simplesamlphp simplesamlphp] mkdir ArnesAAI-eduGAIN [root@simplesamlphp simplesamlphp] mkdir arnes-rules [root@simplesamlphp simplesamlphp] chown apache:apache ArnesAAI-eduGAIN [root@simplesamlphp simplesamlphp] chown apache:apache arnes-rulesNastavite cron modul.
$config = array ( 'key' => 'skrivnogeslo', 'allowed_tags' => array('daily', 'hourly', 'frequent'), 'debug_message' => TRUE, 'sendemail' => TRUE, );Pojdite v brskalniku na naslov: https://simplesamlphp_machine/simplesaml/module.php/cron/croninfo.php in v crontab na vašem strežniku kopirajte predloge.
------------------------------------------------------------------------------------------------------------------- Cron is a way to run things regularly on unix systems. Here is a suggestion for a crontab file: # Run cron [daily] 02 0 * * * curl --silent "https://idp.organizacija.si/simplesaml/module.php/cron/cron.php?key=skrivnogeslo&tag=daily" > /dev/null 2>&1 # Run cron [hourly] 01 * * * * curl --silent "https://idp.organizacija.si/simplesaml/module.php/cron/cron.php?key=skrivnogeslo&tag=hourly" > /dev/null 2>&1 # Run cron [frequent] XXXXXXXXXX curl --silent "https://idp.organizacija.si/simplesaml/module.php/cron/cron.php?key=skrivnogeslo&tag=frequent" > /dev/null 2>&1 Click here to run the cron jobs: Run cron [daily] Run cron [hourly] Run cron [frequent] -------------------------------------------------------------------------------------------------------------------Crontab uredite z ukazom
crontab -eNastavite osveževanje metapodatkov v datoteki config/config-metarefresh.php. Priporočamo, da v datoteki /etc/php.ini memory_limit nastavite na vrednost 1024M.
#Nastavitev avtomatskega osveževanja metapodatkov in pretvorba v php objekte za hitrejše delovanje IdP-ja #Federativni metapodatki postajajo vse vecji, zato priporocamo, da ustrezno nastavite php.ini datoteko /etc/php.ini #Nastavitev je mozna tudi neposredno v kodi aplikacije ini_set('max_execution_time', 3600); ini_set('memory_limit', '1024M'); $config = array( 'sets' => array( 'ArnesAAI-eduGAIN' => array( 'cron' => array('hourly','daily'), 'sources' => array( array( 'src' => 'https://ds.aai.arnes.si/metadata/arnesaai-edugain.signed.xml', 'validateFingerprint' => '51:CC:76:0A:07:F1:A2:CC:01:98:68:F2:02:93:04:4E:AC:7C:08:22', 'template' => array( 'tags' => array('ArnesAAI-eduGAIN'), ), ), ), 'expireAfter' => 60*60*24*7, // Maximum 7 days cache time. 'outputDir' => 'metadata/ArnesAAI-eduGAIN/', 'outputFormat' => 'flatfile', ), ), );
V nastavitvah IdP config.php (v mapi /opt/simplesamlphp/config/) je v ta namen potrebno spremeniti blok "metadata.sources", tako kot prikazuje spodnji primer:
... #Nastavitev metapodatkov v obliki flatfile (pospeši delovanje IdP-ja) 'metadata.sources' => array( array('type' => 'flatfile'), array('type' => 'flatfile', 'directory' => 'metadata/arnes-rules'), #Datoteka s posebnimi pravili za določene SP-je array('type' => 'flatfile', 'directory' => 'metadata/ArnesAAI-eduGAIN'), ), ...Naslednji korak: Prilagojena predloga za SimpleSAMLphp IdP
Pripravili smo čarovnika, s katerim lahko uredite prilagojeno predlogo za vaš IdP.
Priprava predlogeIdP lahko registrirate v federacijo z uporabo Arnes Portala. Podrobna navodila za dodajanje najdete v AAI modulu.
Arnes Portal