Shibboleth Service Provider. Bart Ophelders - Philip Brusten shib@kuleuven.be



Similar documents
Shibboleth SP Hands-on. Shilen Patel - shilen@duke.edu Rob Carter - rob@duke.edu Gonzalo Guzman - gonz@mcnc.org

Shibboleth Service Provider Workshop

Federating with Web Applications

This chapter describes how to use the Junos Pulse Secure Access Service in a SAML single sign-on deployment. It includes the following sections:

Shibboleth SP Simple Installation Guide For LINUX

Integration of Shibboleth and (Web) Applications

Standalone SAML Attribute Authority With Shibboleth

Shibboleth SP Simple Installation Guide For Windows and IIS

Shibboleth 2: A Guide for Deployers. Scott Cantor cantor.2@osu.edu Internet2 / The Ohio State University

OIOSAML 2.0 Toolkits Test results May 2009

Configuring. Moodle. Chapter 82

FERMILAB CENTRAL WEB HOSTING SINGLE SIGN ON (SSO) ON CWS LINUX WITH SAML AND MOD_AUTH_MELLON

Shibboleth Identity Provider (IdP) Sebastian Rieger

Authentication Methods

Federated Identity Management. Willem Elbers (MPI-TLA) EUDAT training

Using Shibboleth for Single Sign- On

SAML single sign-on configuration overview

Apache and Virtual Hosts Exercises

AA enabling a closed source legacy application

Fairsail. Implementer. Single Sign-On with Fairsail and Microsoft Active Directory Federation Services 2.0. Version 1.92 FS-SSO-XXX-IG R001.

Using EMC Unisphere in a Web Browsing Environment: Browser and Security Settings to Improve the Experience

Installing an SSL certificate on the InfoVaultz Cloud Appliance

Federation of OpenStack clouds

DARIAH / DASISH AAI Workshop

Using SAML for Single Sign-On in the SOA Software Platform

esoc SSA DC-I Part 1 - Single Sign-On and Access Management ICD

The GOV.UK Verify onboarding process

PHP Integration Kit. Version User Guide

Setup Guide Access Manager 3.2 SP3

CA Performance Center

Tenrox. Single Sign-On (SSO) Setup Guide. January, Tenrox. All rights reserved.

Howto: Create a virtual platform Shibboleth

Implementation Guide SAP NetWeaver Identity Management Identity Provider

Integrating VMware Horizon Workspace and VMware Horizon View TECHNICAL WHITE PAPER

Logout Support on SP and Application

Viktigaste uppgift: Web Browser SSO

An overview of configuring WebEx for single sign-on. To configure the WebEx application for single-sign on from the cloud service (an overview)

APACHE HTTP SERVER 2.2.8

Introducing Shibboleth

Novell Access Manager

1 of 24 7/26/2011 2:48 PM

XIA Configuration Server

Shibboleth User Verification Customer Implementation Guide Version 3.5

Integration Guide. SafeNet Authentication Service. Using SAS as an Identity Provider for Drupal

Security Workshop. Apache + SSL exercises in Ubuntu. 1 Install apache2 and enable SSL 2. 2 Generate a Local Certificate 2

PingFederate. Salesforce Connector. Quick Connection Guide. Version 4.1

Shibboleth Authentication. Information Systems & Computing Identity and Access Management May 23, 2014

Connected Data. Connected Data requirements for SSO

McAfee Cloud Identity Manager

GlobalSign Enterprise Solutions Google Apps Authentication User Guide

WebSpy Vantage Ultimate 2.2 Web Module Administrators Guide

An overview of configuring WebEx for single sign-on. To configure the WebEx application for single-sign on from the cloud service (an overview)

Installing an open source version of MateCat

Policy Guide Access Manager 3.1 SP5 January 2013

multiple placeholders bound to one definition, 158 page approval not match author/editor rights, 157 problems with, 156 troubleshooting,

BlackShield ID Agent for Terminal Services Web and Remote Desktop Web

Running Multiple Shibboleth IdP Instances on a Single Host

Siteminder Integration Guide

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

FileMaker Server 13. FileMaker Server Help

MassTransit 6.0 Enterprise Web Configuration for Macintosh OS 10.5 Server

Apache Security with SSL Using Linux

Tonido Cloud Admin Guide

FileMaker Server 11. FileMaker Server Help

INTEGRATION GUIDE. DIGIPASS Authentication for SimpleSAMLphp using IDENTIKEY Federation Server

Flexible Identity Federation

FileMaker Server 9. Custom Web Publishing with PHP

Setup Guide Access Manager Appliance 3.2 SP3

Web+Center Version 7.x Windows Quick Install Guide 2 Tech Free Version Rev March 7, 2012

FileMaker Server 12. FileMaker Server Help

SAML Security Option White Paper

Single Sign-On for the UQ Web

Apache2 Configuration under Debian GNU/Linux. Apache2 Configuration under Debian GNU/Linux

SAP NetWeaver AS Java

SAML Authentication within Secret Server

Moodle and Office 365 Step-by-Step Guide: Federation using Active Directory Federation Services

SAML Single-Sign-On (SSO)

TROUBLESHOOTING RSA ACCESS MANAGER SINGLE SIGN-ON FOR WEB-BASED APPLICATIONS

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

CA SiteMinder. SAML Affiliate Agent Guide. 6.x QMR 6

SAML Authentication Quick Start Guide

2 Downloading Access Manager 3.1 SP4 IR1

Agenda. How to configure

Talk Internet User Guides Controlgate Administrative User Guide

FileMaker Server 12. Custom Web Publishing with PHP

BlackShield ID Agent for Remote Web Workplace

Installation of PHP, MariaDB, and Apache

IAM Application Integration Guide

Description of Microsoft Internet Information Services (IIS) 5.0 and

Computer Services Documentation

FileMaker Server 14. Custom Web Publishing Guide

ENABLING RPC OVER HTTPS CONNECTIONS TO M-FILES SERVER

For details about using automatic user provisioning with Salesforce, see Configuring user provisioning for Salesforce.

Richmond SupportDesk Web Reports Module For Richmond SupportDesk v6.72. User Guide

Single Sign-On Implementation Guide

Implementing HTTPS in CONTENTdm 6 September 5, 2012

IMPLEMENTING SINGLE SIGN- ON USING SAML 2.0 ON JUNIPER NETWORKS MAG SERIES JUNOS PULSE GATEWAYS

This section includes troubleshooting topics about single sign-on (SSO) issues.

LabVIEW Internet Toolkit User Guide

Single Sign-On Implementation Guide

Transcription:

Shibboleth Service Provider Bart Ophelders - Philip Brusten shib@kuleuven.be November 2011

Shibboleth Service provider workshop This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. 2

Acknowledgements [SAMLConf] http://docs.oasis-open.org/security/saml/v2.0/samlconformance-2.0-os.pdf Shibboleth 2.0 InstallFest Service Provider Material Ann Arbor, MI SP Hands-on Session SWITCH https://wiki.shibboleth.net/confluence/display/shib2/home 3

Program Installation Bootstrapping SP Configuration 4

Environment Parameters $WORKSH_IDP: the hostname of your IdP Shibboleth standard base for this workshop $HOSTNAME: hostname of your machine (i.e. shibsp01-ws2.lab.iamfederated.org) $PKI: /etc/ssl $WEB_SERVER: /etc/apache2 $WEB_DOCROOT: /var/www/shib $WEB_LOG: /var/log/apache2 $SHIB_HOME: /etc/shibboleth $SHIB_CONF: /etc/shibboleth $SHIB_RUN: /var/run/shibboleth $SHIB_LOG: /var/log/shibboleth 5

Environment Tools An absolute must: Syntax friendly editor $ apt-get install vim :syntax on HTTP client links Check your time now! Always work case sensitive! 6

Environment Key/Certificate generation Webserver Signed by TERENA SSL CA Located at $PKI Shibboleth SP Self-signed Located at $SHIB_HOME Parse certificates openssl x509 in $cert issuer noout 7

SSL certificates Use of self-signed certificates in backend No need for commercial certificates Longer lifetime No truststore to maintain for commercial CAs Revocation (just remove certificate) Trustbase of commercial signed certificates can become quite large Separate certificate for front- and backend 8

Installation - Overview Shibboleth service Apache Shibboleth handler /Shibboleth.sso mod_auth mod_shib mod_ssl... Unix socket 9

Webserver - Installation Done for you! J $ apt-get install libapache2-mod-php5 DocumentRoot: /var/www ($WEB_DOCROOT) Configuration: /etc/apache2 ($WEB_SERVER) Logs: /var/log/apache2 ($WEB_LOG) Start/Stop/Restart service $ apache2ctl start stop restart 10

Webserver - Configuration Edit ServerName Set UseCanonicalName to On $ vim /etc/apache2/apache2.conf ServerName $HOSTNAME UseCanonicalName On Otherwise RequestMap could be bypassed!! 11

Webserver - SSL $ a2enmod ssl $ vim /etc/apache2/sites-available/default-ssl SSLCertificateFile /etc/ssl/certs/lab.iamfederated.org.crt SSLCertificateKeyFile /etc/ssl/lab.iamfederated.org.key SSLCertificateChainFile /etc/ssl/lab.iamfederated.org/ lab.iamfederated.org.chain $ a2ensite default-ssl $ apache2ctl configtest $ /etc/init.d/apache2 restart $ openssl s_client connect localhost:443 12

Webserver - Configuration Prepare test application $ a2ensite shibsp $ mkdir /var/www/shib/secure $ vim /var/www/shib/secure/index.php <?php header('location: https://'.$_server['server_name'].'/shibboleth.sso/session');?> 13

Shibboleth SP installation Install Shibboleth 2.4.3 (done for you J ) $ apt-get install libapache2-mod-shib2 Generate self signed certificate $ /usr/sbin/shib-keygen h $HOSTNAME e $ENTITYID y $YEARS_VALID $ENTITYID = https://$hostname/shibboleth $YEARS_VALID=3 Change ownership of key-file $ chown _shibd $SHIB_CONF/sp-key.pem 14

Shibboleth SP installation Configuration files provided by deb packages /etc/apache2/mods-available/shib2.load /etc/init.d/shibd Create /etc/apache2/mods-available/shib2.conf or Edit /etc/apache2/sites-available/shibsp <Location /secure> AuthType shibboleth require shibboleth </Location> $ a2enmod shib2 $ /etc/init.d/shibd restart $ /etc/init.d/apache2 restart 15

Sanity checks Access Shibboleth handler from your browser https://$worksh_host/shibboleth.sso à Access session handler from your browser https://$worksh_host/shibboleth.sso/session à A valid session was not found. See how a Shibboleth error looks like https://$worksh_host/shibboleth.sso/foo à 16

Program Installation Bootstrapping SP Configuration 17

Bootstrapping the SP Goals: 1. Working SP against a single IdP 2. Enable debugging of session attributes 18

Bootstrapping the SP Choose your entityid https://$hostname/shibboleth Should be: Unique Locally scoped Logical representative Unchanging Seen on the wire, configuration files, metadata, log files, etc 19

Bootstrapping the SP Relax some requirements, set your entityid and default IdP entityid $SHIB_CONF/shibboleth2.xml <Host name= $HOSTNAME redirecttossl="443"> <ApplicationDefaults entityid= https://$hostname/shibboleth REMOTE_USER="eppn persistent-id targeted-id > <SSO entityid="https://$worksh_idp/saml2/idp/metadata.php" > SAML2 SAML1 </SSO> <Handler type="session" Location="/Session" showattributevalues="true"/> 20

Bootstrapping the SP Provide metadata remotely from your IdP $SHIB_CONF/shibboleth2.xml <MetadataProvider type="chaining"> <MetadataProvider type="xml" uri="https://$worksh_idp/saml2/idp/metadata.php" backingfilepath="idp-metadata.xml" reloadinterval="3600"/> Backup at $SHIB_RUN Uncomment whole <MetadataProvider> Comment <MetadataFilter> Provide your SP s metadata to IdP Metadata self-generated by your Service Provider https://$worksh_host/shibboleth.sso/metadata 21

Bootstrapping the SP Quick test Make sure configuration works $ shibd tc $SHIB_CONF/shibboleth2.xml Service Provider reloads shibboleth2.xml automatically when it changes Try it with a browser https://$worksh_host/secure/ /secure/ is protected by shibboleth2.xml (<RequestMap>) Get session information https://$worksh_host/shibboleth.sso/session (you should see various attributes) 22

Bootstrapping SP - Logout Local logout https://$hostname/shibboleth.sso/logout This won t delete your session on the IdP! Close the browser in order to remove ALL your session cookies (~Firefox restore session functionality) Or delete session cookies using the browser or an extension, e.g.: Firefox Web Developer extension à Server side session remains and needs to timeout. 23

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 24

Basic configuration Goals: 1. Understand purpose and structure of SP configuration files 2. Increase log level to DEBUG 3. Configure metadata and add signature verification 25

Important directories $SHIB_CONF Master and supporting configuration files Locally maintained metadata files HTML templates (customize them to adapt look&feel to your application) Logging configuration files (*.logger) Credentials (certificates and private keys) $SHIB_RUN UNIX socket Remotely fetched files (metadata, attribute-map) $SHIB_LOG shibd.log & transaction.log $WEB_LOG (written by Shibboleth module) native.log 26

Configuration files in $SHIB_CONF shibboleth2.xml main configuration file apache*.config Apache module loading attribute-map.xml attribute handling attribute-policy.xml attribute filtering settings *.logger logging configuration *Error.html HTML templates for error messages locallogout.html SP-only logout template globallogout.html single logout template Recommendation: Adapting *.html files to match the look & feel of the protected application improves user experience. 27

shibboleth2.xml structure Outer elements of the shibboleth2.xml configuration file <OutOfProcess> / <InProcess> <UnixListener> / <TCPListener> <StorageService> <SessionCache> <ReplayCache> <ArtifactMap> <RequestMapper> Needed for session initiation and access control <ApplicationDefaults> Contains the most important settings of your SP <SecurityPolicies> 28

ApplicationDefaults structure You are most likely to change something in here: <ApplicationDefaults> <Sessions> Defines handlers and how sessions are initiated and managed <Errors> Used to display error messages. Provide here logo, e-mail and CSS <RelyingParty> (*) To modify settings for certain IdPs/federations <MetadataProvider> Defines the metadata to be used by the SP <TrustEngine> Which mechanisms to use for signatures validation <AttributeExtractor> Attribute map file to use <AttributeResolver> Plugin for attribute querying <AttributeFilter> Attribute filter file to use <CredentialResolver> Defines certificate and private key to be use <ApplicationOverride> (*) Can override any of the above for certain applications 29

Logging First thing to do in case of problems shibd.log and transaction.log written by shibd, native.log written by Shibboleth module *.logger files contain predefined settings for output location and default logging level (INFO) along with useful categories to raise to DEBUG Log time is in UTC (~GMT) 30

Logging Raise categories $ vim $SHIB_CONF/shibd.logger log4j.rootcategory=debug, shibd_log To implement *.logger changed: $ touch shibboleth2.xml $ tail f /var/log/shibboleth/shibd.log Try again https://$worksh_host/secure/ 31

Metadata features Metadata describes the other components (IdPs) that the Service Provider can communicate with Three primary methods built-in: Local file (you manage it) Remote file (periodic refresh, local backup), i.e. https://$hostname/$path/saml2/sp/metadata.php (simplesamlphp SP) https://$hostname/shibboleth.sso/metadata (Shibboleth SP) https://$hostname/$path/saml2/idp/metadata.php (simplesamlphp IdP) https://$hostname/idp/shibboleth (Shibboleth IdP) Dynamic resolution of entityid (=URL) Security comes from metadata filtering, either by you or the SP: Signature verification White and blacklists 32

Exercise: Signature verification The Test IdPs metadata is signed. Until now, it was loaded without checking, which is not secure and not recommended! First, increase security: $SHIB_CONF/shibboleth2.xml Uncomment MetadataFilter for signature verification: <MetadataProvider type="xml [ ] uri= https://$worksh_idp/idp/saml2/idp/metadata.php > <MetadataFilter type="signature certificate="sp-cert.pem"/> </MetadataProvider> 33

Exercise: Signature verification cont d Run $ shibd tc $SHIB_CONF/shibboleth2.xml and in the output you will see: WARN OpenSAML.MetadataFilter.Signature [3]: filtering out group at root of instance after failed signature check: ERROR OpenSAML.Metadata.Chaining [3]: failure initializing MetadataProvider: SignatureMetadataFilter unable to verify signature at root of metadata instance. Metadata could not be loaded because it was signed with a different key (we broke the setup). So, let s get the right key 34

Exercise: Signature verification cont d Download the correct certificate Then fix it: $SHIB_CONF/shibboleth2.xml <MetadataProvider type="xml [ ] > <MetadataFilter type="signature certificate= $METADATA_SIGNING_CERTIFICATE"/> </MetadataProvider> Run again $ shibd tc $SHIB_CONF/shibboleth2.xml 35

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 36

Attribute handling Goals: 1. Understand how attributes are transported 2. Learn how attributes are mapped and filtered 3. See how attributes can be used as identifiers 4. Add an attribute mapping and filtering rule 37

SP attribute terminology Push Delivering attributes with SSO assertion via web browser Pull Querying for attributes after SSO via back-channel (SP -> IdP) Extraction Decoding SAML information into neutral data structures mapped to environment or header variables Filtering Blocking invalid, unexpected, or unauthorized values based on application or community criteria Resolution Resolving a SSO assertion into a set of additional attributes (e.g. queries) 38

Scoped attributes Common term for attributes that consist of a relation between a value and a scope, usually an organizational domain name E.g. affiliation = student@kuleuven.be Makes values globally usable and unique Lots of special treatment in Shibboleth to make them more useful and "safe" Alternatively, split value and scope into separate attributes: affiliation= student and homeorganization= kuleuven.be 39

Attribute mappings SAML attributes from any source are "extracted" using the configuration rules in /etc/shibboleth/attribute-map.xml Each element is a rule for decoding a SAML attribute and assigning it a local id which becomes its mapped variable name Attributes can have one or more id s and multiple attributes can be mapped to the same id The id can also be used as header name in the webserver for this attribute, not by default for Apache. 40

Dissecting an Advanced Attribute Rule <Attribute id="affiliation" aliases="aff affil" name="urn:oid:1.3.6.1.4.1.5923.1.1.1.9"> <AttributeDecoder xsi:type="scopedattributedecoder" </Attribute> casesensitive="false"/> id The primary "id" to map into, also used in web server environment aliases Optional alternate names to map into name SAML attribute name or NameID format to map from AttributeDecoder xsi:type Decoder plugin to use (defaults to simple/string) casesensitive How to compare values at runtime (defaults to true) https://wiki.shibboleth.net/confluence/display/shib2/nativespattributeextractor 41

Adding attribute mappings Add first and lastname SAML 2 attribute mappings: $SHIB_CONF/attribute-map.xml <Attribute name="urn:oid:2.5.4.4" id="sn aliases= surname /> <Attribute name="urn:oid:2.5.4.42" id="givenname"/> After saving, changes take effect immediately but NOT for any existing sessions Therefore, restart your browser (or delete your session cookies) and continue on next slide 42

Example: K.U.Leuven attribute mappings Attribute-map published on webserver, can be downloaded by all Shibboleth SP s Warning: no possibility to sign à no verification possible $SHIB_CONF/shibboleth2.xml <! <AttributeExtractor type="xml" validate="true" path="attributemap.xml"/> --> <AttributeExtractor type="xml" uri="https://shib.kuleuven.be/ download/sp/2.x/attribute-map.xml" backingfilepath="attributemap.xml" reloadinterval="7200"/> 43

Example: K.U.Leuven attribute mappings Attribute-map made compatible with Shibboleth 1.3 (SAML1.1) naming conventions: Old: <Attribute name="urn:mace:dir:attributedef:edupersonscopedaffiliation" id="affiliation"> <AttributeDecoder xsi:type="scopedattributedecoder" casesensitive="false"/> </Attribute> New: <Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" id="affiliation"> <AttributeDecoder xsi:type="scopedattributedecoder" casesensitive="false"/> </Attribute> 44

Common identifiers Local userid/netid/uid ( intranet userid ), e.g. u1234567 Usually readable, persistent but not permanent, often reassigned, not unique email address, e.g. Foo.bar@kuleuven.be Usually readable, persistent but not permanent, often reassigned, unique edupersonprincipalname, e.g. u1234567@kuleuven.be Usually readable, persistent but not permanent, can be reassigned, unique edupersontargetedid / SAML 2.0 persistent ID Not readable, semi-permanent, not reassigned, unique 45

REMOTE_USER Special single-valued variable that all web applications should support for container-managed authentication of a unique user. Any attribute, once extracted/mapped, can be copied to REMOTE_USER Multiple attributes can be examined in order of preference, but only the first value will be used. IIS doesn t support setting REMOTE_USER https://wiki.shibboleth.net/confluence/display/shib2/nativespattributeaccess 46

Exercise: Changing REMOTE_USER In case your application needs to have a remote user for authentication, you just could make Shibboleth put an attribute (e.g. sn ) as REMOTE_USER: $SHIB_CONF/shibboleth2.xml REMOTE_USER= sn eppn persistent-id targeted-id" If sn attribute is available, it will be put into REMOTE_USER Attribute sn has precedence over eppn in this case This allows very easy shibbolization of some web applications 47

Attribute filtering Answers the "who can say what" question on behalf of an application Service Provider can make sure that only allowed attributes and values are made available to application Some examples: constraining the possible values or value ranges of an attribute (e.g. edupersonaffiliation, telephonenumber,...) limiting the scopes/domains an IdP can speak for (e.g. university x cannot assert faculty@university-z.edu) limiting custom attributes to particular sources 48

Default filter policy As default, attributes are filtered out unless there is a rule! Shared rule for legal affiliation values Shared rule for scoped attributes Generic policy applying those rules and letting all other attributes through. Check $SHIB_LOG/shibd.log for signs of filtering in case of problems with attributes not being available. You would find something like no rule found, removing all values of attribute (#attribute name#) https://wiki.shibboleth.net/confluence/display/shib2/idpaddattributefilter 49

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 50

Session initiation Goals: 1. Learn how to initiate a Shibboleth session 2. Understand their advantages and disadvantages 3. Know where to require a session, what to protect 51

Content protection and session initiation Before access control (will be covered later on) can occur, a Shibboleth session must be initiated Session initiation and content protection go hand in hand Requiring a session means the user has to authenticate Only authenticated users can access protected content 52

Content protection settings Protect hosts, directories, files or queries.htaccess (dynamic) or apache2.conf (static) RequestMap Requires Shibboleth to know exact hostname Very powerful and flexible thanks to boolean/regex operations Try accessing https://$hostname/ You should get access because the directory is not protected https://wiki.shibboleth.net/confluence/display/shib2/nativespaccesscontrol 53

Content protection with.htaccess Prepare webserver (<Directory name= $DOCROOT >) AllowOverride AuthConfig Let s protect the directory by requiring a Shibboleth session: $ mkdir $WEB_DOCROOT/secure2 $ vim $WEB_DOCROOT/secure2/.htaccess AuthType shibboleth ShibRequestSetting requiresession 1 require valid-user https://wiki.shibboleth.net/confluence/display/shib2/nativespaccesscontrol 54

Test content protection rule Clear session and then access https://$hostname/ secure2 Authentication is enforced and access should be granted By now, all authenticated users get access Content protection with authorization will be covered later 55

Content protection with RequestMap $ vim $WEB_DOCROOT/secure2/.htaccess AuthType shibboleth require shibboleth $SHIB_CONF/shibboleth2.xml <Host name= $HOSTNAME redirecttossl= 443 > <Path name= secure2 authtype= shibboleth requiresession= true / > </Host> Module (mod_shib) provides request URL to shibd to process it Clearing session and then accessing /secure2/ now, one also is forced to authenticate 56

RequestMap Fragility By default, Apache "trusts" the user s web browser about what the requested hostname is and reports that value internally To illustrate the problem, try accessing this URL: https://$ip/secure2 Script can be accessed unprotected/without a session? How to fix? Make Apache use configured ServerName apache2.conf UseCanonicalName On 57

Other content settings Requesting types of authentication E.g enforce X.509 user certificate authentication Redirect to SSL Custom error handling pages to use Redirection-based error handling In case of an error, redirect user to custom error web page with error message/type as GET arguments forceauthn Disable Single-Sign on and force a re-authentication ispassive Check whether a user has an SSO session and if he has, automatically create a session on SP without any user interaction Supplying a specific IdP to use for authentication https://wiki.shibboleth.net/confluence/display/shib2/nativespcontentsettings 58

Lazy Sessions The mode of operation so far prevents an application from running without a login. Two other very common cases: Public and private access to the same resources Separation of application and SP session Semantics are: if valid session exists process it as usual (attributes in environment array, REMOTE_USER, etc.) But if a session does NOT exist or is invalid, ignore it and pass on control to webserver/scripts 59

Lazy Sessions example Construct URL https://$hostname/shibboleth.sso/login?target=https://$hostname/shibboleth.sso/session Shibboleth handler: https://$hostname/shibboleth.sso Session Initiator: /Login Target location:?target=https://$hostname/shibboleth.sso/session Other options: https://wiki.shibboleth.net/confluence/shib2/ NativeSPSessionCreationParameters Most parameters can come from three places, in order of precedence: Query string parameter to Shibboleth handler A content setting (Webserver config or RequestMap) <SessionInitiator> element 60

Exercise: Lazy Sessions $ vim $WEB_DOCROOT/secure3/.htaccess AuthType shibboleth require shibboleth Save and extract PHP script from http://shib.kuleuven.be/download/sp/test_scripts/ lazy_session.tar.gz at $WEB_DOCROOT/secure3/lazy_session.php Access https://$hostname/secure3/lazy_session.php 61

Where to require a Shibboleth session Whole application with required Shibboleth session Easiest way to protect a set of documents No other authentication methods possible Whole application with lazy Shibboleth session Also allows for other authentication methods Authorization can only be done in application Only page that sets up application session Well-suited for dual login Application can control session time-out Generally the best solution 62

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 63

Access control Goals: 1. Create some simple access control rules 2. Get an overview about the three ways to authorize users 3. Understand their advantages and disadvantages 64

Access control Two implementations are provided by the SP:.htaccess "require" rule processing XML-based policy syntax attached to content via RequestMap Third option: Integrate access control into webapplication https://wiki.shibboleth.net/confluence/shib2/nativespaccesscontrol 65

Access control 1.a apache2.conf 1.b.htaccess 2. XML AccessControl 3. Application Access Control + Easy to configure Can also protect locations or virtual files URL Regex Dynamic Easy to configure Platform independent Powerful boolean rules URL Regex Dynamic Very flexible and powerful with arbitrarily complex rules URL Regex Support - Only works for Apache Not dynamic Very limited rules Only works for Apache Only usable with real files and directories XML editing Configuration error can prevent SP from restarting You have to implement it yourself You have to maintain it yourself 66

1. Apache httpd.conf or.htaccess Work almost like known Apache require rules require affiliation staff require sn bar Special rules: shibboleth (no authorization) valid-user (require a session, but NOT identity) user (REMOTE_USER as usual) group (group files as usual) authncontextclassref, authncontextdeclref Default is boolean "OR, use ShibRequireAll for AND rule Regular expressions supported using special syntax: require mail ~ ^.*@(icts law).kuleuven.be$ 67

Side note: Aliases If in the attribute-map.xml file, there is a definition like: <Attribute name="urn:mace:dir:attribute-def:edupersonaffiliation" id="shib-ep-affiliation" aliases="affiliation aff affil"> [ ]/> This allows using aliases in authorization rules, e.g.: require affiliation staff #instead of require Shib-EP-Affiliation staff Aliases can also be used in RequestMap 68

1. Example.htaccess file Require a user to be staff member $WEB_DOCROOT/staff-only/.htaccess AuthType Shibboleth ShibRequestSetting requiresession 1 require unscoped-affiliation staff Access https://$worksh_host/staff-only with user staff, access should be granted Try the same with user without staff attribute, access should be denied 69

1. Advanced.htaccess file Require a user to be a student or to have an entitlement: $ mkdir $WEB_DOCROOT/student $ vim $WEB_DOCROOT/student/.htaccess AuthType Shibboleth ShibRequestSetting requiresession 1 require unscoped-affiliation student require entitlement ~.*extra_access.* Access: https://$worksh_host/student with user student and staff, access should be granted. Other users, access will be denied. 70

2. XML access control Can be used for access control independent from web server and operating system XML Access control rules can be embedded inside RequestMap or can also be dynamically loaded from external file. WARNING: Can bring down entire webserver Same special rules as.htaccess, adds boolean operators (AND,OR,NOT) 71

2. XML access control example Same as previous example but now with XML access control embedded in RequestMap $ vim $DOCROOT/student/.htaccess AuthType Shibboleth require shibboleth $ vim $SHIB_CONF/shibboleth2.xml <Host name= $WORKSH_HOST"> [..] <Path name= student" authtype="shibboleth" requiresession="true"> <AccessControl> <OR> <RuleRegex require="entitlement">.*extra_access.*</ruleregex> <Rule require="unscoped-affiliation">student</rule> </OR> </AccessControl> </Path> </Host> 72

3. Application managed access control Application can access and use Shibboleth attributes by reading them from the web server environment Attributes then can be used for authentication/access control/authorization #PHP: if ($_SERVER[ affiliation ] == staff ) { grantaccess() } #Perl: if ($ENV{ affiliation } == staff ) { &grantaccess() } #ASP: if (Request.ServerVariables( affiliation ) == staff ){ { grantaccess() } http://shib.kuleuven.be/download/sp/test_scripts/ 73

3. Application managed access control Default is to use environment variables instead of HTTP headers (Apache) Cannot be manipulated in any way from outside Unfortunately not all webservers support a mechanism to create custom variables within webserver (IIS,Sun/ iplanet) Solution: AuthType shibboleth ShibRequestSetting requiresession 1 require shibboleth ShibUseHeaders On 74

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 75

Adding a separate (Shibboleth) application Goals: 1. Define another application 2. Protect new application 3. Know how to configure them if necessary 76

Terminology Service Provider (physical) An installation of the software on a server Service Provider/ Resource (logical) Web resources viewed externally as a unit Each entityid identifies exactly one logical SP SP Application Web resources viewed internally as a unit Each applicationid identifies exactly one logical application A user session is bound to exactly one application 77

Virtualization concepts A single physical SP can host any number of logical SPs A logical SP can then include any number of "applications" Web virtual hosting is often related but is also independent Applications can inherit or override default configuration settings on a piecemeal basis Multiple physical SPs can also act as a single logical SP Clustering for load balancing and failover 78

Adding an application Goal: Add a second application with a different entityid living in its own virtual host $SHIB_CONF/shibboleth2.xml <RequestMap applicationid="default"> <Host name= $WORKSH_HOST2 applicationid="alt"/> [..] <ApplicationOverride id="alt" entityid="https://$worksh_host2"/> </ApplicationDefaults> 79

Adding an application Test application: https://$worksh_host2/secure The IdP will throw an ERROR (entityid is not trusted) Error Message: SAML 2 SSO profile is not configured for relying party 'https://$worksh_host2' Check logging $SHIB_LOG/shibd.log and $WEB_LOG/native.log (DEBUG) You should see the new entityid 80

Adding an application <ApplicationOverride> Rule of thumb is that any settings you don't override inside the element will be inherited from the <ApplicationDefaults> element that surrounds the override. Limitations: You have to supply all the settings needed in the <Sessions> element because of the need to override the handlerurl. You do NOT have to redefine all of the handler child elements. The handlerurl MUST be unique for each SP and MUST map to the same applicationid Respect the XML sequence! 81 https://wiki.shibboleth.net/confluence/display/shib2/nativespapplicationoverride

Clustering Configure multiple physical installations to share an entityid, and possibly credentials Configuration files often can be identical across servers that share an external hostname Session management: SP itself now clusterable via ODBC or memcached Host shibboleth service on one system 82

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 83

Service provider handlers Goals: 1. Understand the idea of a handler 2. Get an overview about the different types of handlers 3. Know how to configure them if necessary 84

SP handlers "Virtual" applications inside the SP with API access: SessionInitiator (requests) E.g. /Shibboleth.sso/Login AssertionConsumerService (incoming SAML response) E.g. /Shibboleth.sso/SAML/POST LogoutInitiator (SP signout) E.g. /Shibboleth.sso/Logout SingleLogoutService (incoming SLO) ManageNameIDService (advanced SAML) ArtifactResolutionService (advanced SAML) Generic (diagnostics, other useful features) E.g. /Shibboleth.sso/Session /Shibboleth.sso/Status /Shibboleth.sso/Metadata https://wiki.shibboleth.net/confluence/display/shib2/nativesphandler 85

SP handlers The URL of a handler = handlerurl + the Location of the handler. e.g. for a virtual host testsp.example.org with handlerurl of "/ Shibboleth.sso", a handler with a Location of "/Login" will be https://testsp.example.org/shibboleth.sso/login Handlers aren t always SSL-only, but usually should be (handlerssl="true"). Metadata basically consists of entityid, keys and handlers Handlers are never "protected" by the SP But sometimes by IP address (e.g. with acl= 127.0.0.1 ) 86

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 87

ForceAuthn Extra layer of security Request reauthentication by the IdP Configuration: forceauthn Content settings (RequestMap, SessionInitiator,.htaccess) query string parameter (overrides every previous setting) Easily overwritten à implement check if honored maxtimesinceauthn authncontextclassref == urn:oasis:names:tc:saml: 2.0:ac:classes:PasswordProtectedTransport à Try It! J 88

Passive logon SP tries to login user without user interaction User interaction needed à logon fails quietly Send a passive authentication request Lazy session Javascript to initiate session and remember (set cookie) if failed Configuration: Content settings (RequestMap, SessionInitiator.htaccess) query string parameter (overrides every previous setting) à Try It! J https://wiki.shibboleth.net/confluence/display/shib2/ispassive 89

Program Installation Bootstrapping SP Configuration Basic configuration Attribute handling Session Initiation Access control (Adding a separate application) (Service provider handlers) Extra features 90

Questions 91