UC Davis Shibboleth Service Provider (2.x) Configuration Guide

Note: Shibboleth SP 3.x is current and 2.x is no longer supported. This guide remains to be updated.

An outline of considerations for installing and configuring the Shibboleth SAML Service Provider in the UC Davis environment. Specific issues not addressed here may well be found via the References section at the bottom.

Preparation

  1. Choose an entityID for the service to be protected by Shibboleth.

  2. Think about any restrictions on identifiers sent by Identity Providers (IdPs) with respect to privacy in your application (i.e. opaque identifiers vs. not).

  3. Think about the types of information (attributes) that might be useful for your application, e.g. name, email address.

Install

Configuration - Sandbox

Configuration - Development and Production

Test Initial Configuration and Start

https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPInitialTesting

  1. Check the configuration
    Note: libcurl on RedHat 6 and 7 Linux variants is linked against NSS instead of OpenSSL libraries. The Shibboleth SP requires some OpenSSL features, so for these platforms will additionally be installed with a version of libcurl linked against OpenSSL. For these, override LD_LIBRARY_PATH on the command line to test the configuration.

    # LD_LIBRARY_PATH=/opt/shibboleth/lib64 /usr/sbin/shibd -t
    [possible output]
    overall configuration is loadable, check console for non-fatal problems
    # 


  2. Start shibd and httpd, e.g. RedHat Linux

    $ sudo /sbin/service shibd start
    $ sudo /sbin/service httpd start
    


  3. Status — check from localhost
    Note: the default /Status handler has an access control directive restricting connections to the local host (check with a web browser on the local host or use a command line utility).
    Look for <OK/> in <SessionCache> and <Status>

    $ curl -k https://localhost/Shibboleth.sso/Status
    
    <?xml version="1.0"?>
    <StatusHandler time="2011-05-09T15:07:10Z">
      <Version Xerces-C="3.1.1" XML-Tooling-C="1.4.1" XML-Security-C="1.6.0" OpenSAML-C="2.4.1" Shibboleth="2.4.2"/>
      <NonWindows sysname="Linux" nodename="myapp-dev.ucdavis.edu" release="2.6.18-238.9.1.el5" version="#1 SMP Fri Mar 18 12:42:39 EDT 2011" machine="x86_64"/>
      <SessionCache>
        <OK/>
      </SessionCache>
      <Application id="default" entityID="https://myapp-dev.ucdavis.edu/shibboleth"/>
      <Handlers>
        <Handler type="ArtifactResolutionService" Location="/Artifact/SOAP" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
        <Handler type="AssertionConsumerService" Location="/SAML2/POST" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
        <Handler type="AssertionConsumerService" Location="/SAML2/POST-SimpleSign" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign"/>
        <Handler type="AssertionConsumerService" Location="/SAML2/Artifact" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
        <Handler type="AssertionConsumerService" Location="/SAML2/ECP" Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"/>
        <Handler type="AssertionConsumerService" Location="/SAML/POST" Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post"/>
        <Handler type="AssertionConsumerService" Location="/SAML/Artifact" Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"/>
        <Handler type="SessionInitiator" Location="/Login"/>
        <Handler type="SingleLogoutService" Location="/SLO/SOAP" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
        <Handler type="SingleLogoutService" Location="/SLO/Redirect" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
        <Handler type="SingleLogoutService" Location="/SLO/POST" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
        <Handler type="SingleLogoutService" Location="/SLO/Artifact" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
        <Handler type="LogoutInitiator" Location="/Logout"/>
        <Handler type="MetadataGenerator" Location="/Metadata"/>
        <Handler type="Status" Location="/Status"/>
        <Handler type="Session" Location="/Session"/>
        <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>
      </Handlers>
      <md:KeyDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" use="signing">
        <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
          <ds:KeyName>myapp-dev.ucdavis.edu</ds:KeyName>
          <ds:X509Data>
            <ds:X509SubjectName>CN=myapp-dev.ucdavis.edu</ds:X509SubjectName>
            <ds:X509Certificate>MIIDADCCAeigAwIBAgIJAPF32CZrN4DZMA0GCSqGSIb3DQEBBQUAMB4xHDAaBgNV
    BAMTE3BzbC0xMDMudWNkYXZpcy5lZHUwHhcNMDgxMDE2MTEyMTUzWhcNMTgxMDE0
    ...
    FZu/SaAnDBZY4FN1xrPxLrWbrI9JOecV+b74izOpE9Di7l4jSRdEl9m//4fiReQh
    VZDzDg==
    </ds:X509Certificate>
          </ds:X509Data>
        </ds:KeyInfo>
      </md:KeyDescriptor>
      </md:KeyDescriptor>
      <md:KeyDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" use="encryption">
        <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
          <ds:KeyName>myapp-dev.ucdavis.edu</ds:KeyName>
          <ds:X509Data>
            <ds:X509SubjectName>CN=myapp-dev.ucdavis.edu</ds:X509SubjectName>
            <ds:X509Certificate>MIIDADCCAeigAwIBAgIJAPF32CZrN4DZMA0GCSqGSIb3DQEBBQUAMB4xHDAaBgNV
    BAMTE3BzbC0xMDMudWNkYXZpcy5lZHUwHhcNMDgxMDE2MTEyMTUzWhcNMTgxMDE0
    ...
    FZu/SaAnDBZY4FN1xrPxLrWbrI9JOecV+b74izOpE9Di7l4jSRdEl9m//4fiReQh
    VZDzDg==
    </ds:X509Certificate>
          </ds:X509Data>
        </ds:KeyInfo>
      </md:KeyDescriptor>
      <Status>
        <OK/>
      </Status>
    </StatusHandler>
    


Metadata

Attributes

Choose which attributes you need to support your application and ensure they're enabled in your configuration, cf. references above. Some common ones are

/etc/shibboleth/attribute-map.xml
<Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" id="eppn">
    <AttributeDecoder xsi:type="ScopedAttributeDecoder"/>
</Attribute>
<Attribute name="urn:mace:dir:attribute-def:eduPersonPrincipalName" id="eppn">
    <AttributeDecoder xsi:type="ScopedAttributeDecoder"/>
</Attribute>

<Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" id="affiliation">
    <AttributeDecoder xsi:type="ScopedAttributeDecoder" caseSensitive="false"/>
</Attribute>
<Attribute name="urn:mace:dir:attribute-def:eduPersonScopedAffiliation" id="affiliation">
    <AttributeDecoder xsi:type="ScopedAttributeDecoder" caseSensitive="false"/>
</Attribute>

<Attribute name="urn:oid:0.9.2342.19200300.100.1.3" id="mail"/>
<Attribute name="urn:mace:dir:attribute-def:mail" id="mail"/>

<Attribute name="urn:oid:2.16.840.1.113730.3.1.241" id="displayName"/>
<Attribute name="urn:mace:dir:attribute-def:displayName" id="displayName"/>

<Attribute name="urn:oid:2.5.4.4" id="sn"/>
<Attribute name="urn:mace:dir:attribute-def:sn" id="sn"/>

<Attribute name="urn:oid:2.5.4.42" id="givenName"/>
<Attribute name="urn:mace:dir:attribute-def:givenName" id="givenName"/>

Note: When differing definitions exist, both SAML2 OID and SAML1 URN definitions need to be uncommented/defined for each attribute.

Configure /etc/shibboleth/attribute-policy.xml as necessary to accept attributes you wish to use.

Logging

To assist in diagnosing errors, if needed, set to DEBUG cf. https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogging

Example Apache httpd configuration directive

https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig
https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPhtaccess

<Location /shib>
  DirectoryIndex index.shtml index.html
  AddHandler server-parsed .shtml
  Options +IncludesNoExec
  AuthType shibboleth
  ShibRequestSetting requireSession 1
  require valid-user
</Location>

Note: in some deployments you may see ShibRequireSession On instead of the requireSession directive. The former is from Shibboleth 1.x and is backward compatible.

Access control is usually done in the application itself, but may be done with an Apache httpd Require directive e.g.

Require affiliation student@ucdavis.edu

Test Scripts

/var/www/html/shib/index.shtml
<html>
<head></head>
<body>
<p>Hi, I'm protected by Shibboleth.</p>
<p>REMOTE_USER =
<!--#echo var="REMOTE_USER"-->
</p>
</body>


/var/www/html/shib/t.php
<html>
<head></head>
<body>
<pre style="font-size:10pt">
<?php print_r($_SERVER) ?>
</pre>
</body>
</html>

Session Initialization

Visit a protected location.
Note: SP metadata must be registered with the tested IdP or with a federation before these will work

View your session

InCommon Metadata Registration

Incommon metadata registration calls for a number of elements in addition to standard metadata. Please review the following and include with your registration request.

User Interface Elements in SP Metadata

Requested Attributes

Troubleshooting

https://wiki.shibboleth.net/confluence/display/SHIB2/Troubleshooting

References 

http://shibboleth.internet2.edu/
http://shibboleth.net
https://wiki.shibboleth.net/confluence/display/SHIB2/Installation
https://wiki.shibboleth.net/confluence/display/SHIB2/Configuration
https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPConfigurationElements
https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPEnableApplication
https://spaces.internet2.edu/display/InCCollaborate/X.509+Certificates+in+Metadata
https://spaces.internet2.edu/display/InCCollaborate/Technical+Guide
http://www.incommon.org/federation/attributes.html
http://www.incommon.org/federation/attributesummary.html
http://middleware.ucdavis.edu/ldap_attribute.php
http://middleware.internet2.edu/dir/docs/internet2-mace-dir-saml-attributes-200804.pdf