Shibboleth Target Deployment Guide

Shibboleth Target Deployment Guide
Shibboleth Version 1.2
April 4, 2004

This version of the deploy guide is for Shibboleth v1.2. For documentation related to prior versions of Shibboleth, please consult the appropriate branch in the Shibboleth CVS.

The default configuration of Shibboleth is not secure and should not be used for protection of production content. The example private key bundled with the distribution is publically available, widely circulated, and well-known; also, the default federation and trust metadata is for testing purposes only. For information about securing a Shibboleth deployment, please refer to the production guide. Shibboleth should only be used to protect sensitive content when deployed carefully in conjunction with proper trust settings and policies.

Insert features here.

Before starting, please sign up for all applicable mailing lists. Announcements pertinent to Shibboleth deployments and developments and resources for deployment assistance can be found here.

Please send any questions, concerns, or eventual confusion to mace-shib-users@internet2.edu. This should include, but not be limited to, questions about the documentation, undocumented problems, installation or operational issues, and anything else that arises. Please ensure that you have the appropriate tarball for your operating system.





Shibboleth Target -- Table of Contents

  1. Shibboleth Overview

    1. Origin
    2. Target
    3. WAYF
    4. Federations
  2. Planning

    1. Requirements
    2. Join a Federation
    3. Security Considerations
    4. Server Certificates
    5. Attribute Release Policies
    6. Attribute Acceptance Policies
    7. Browser Requirements
    8. Clocks
    9. Other Considerations
  3. Installation

    1. Software Requirements
    2. Deploy the Shibboleth Package
    3. Configuring Apache 1.3.x
    4. Configuring IIS
    5. Running the SHAR on Windows
  4. Getting Running

    1. Configuring shibboleth.xml
    2. Dynamic Error Page Generation
    3. Key Generation and Certificate Installation
    4. Protecting Web Pages
    5. Defining Attributes and Acceptance Policies
    6. Using Attributes in Applications
    7. siterefresh
    8. MySQL Session Cache
  5. Troubleshooting

    1. Basic Testing
    2. Common Problems




1. Shibboleth Overview

Shibboleth is a system designed to exchange attributes across realms for the primary purpose of authorization. It provides a secure framework for one organization to transmit attributes about a web-browsing individual across security domains to another institution. In the primary usage case, when a user attempts to access a resource at a remote domain, the user's own home security domain can send certain information about that user to the target site in a trusted exchange. These attributes can then be used by the resource to help determine whether to grant the user access to the resource. The user may have the ability to decide whether to release specific attributes to certain sites by specifying personal Attribute Release Policies (ARP's), effectively preserving privacy while still granting access based on trusted information.

When a user first tries to access a resource protected by Shibboleth, they are redirected to a service which asks the user to specify the organization from which they want to authenticate. If the user has not yet locally authenticated to a WebISO service, the user will then be redirected to their home institution's authentication system. After the user authenticates, the Shibboleth components at the local institution will generate a temporary reference to the user, known as a handle, for the individual and send this to the target site. The target site can then use the handle to ask for attributes about this individual. Based on these attributes, the target can decide whether or not to grant access to the resource. The user may then be allowed to access the requested materials.

There are several controls on privacy in Shibboleth, and mechanisms are provided to allow users to determine exactly which information about them is released. A user's actual identity isn't necessary for many access control decisions, so privacy often is needlessly compromised. Instead, the resource often utilizes other attributes such as faculty member or member of a certain class. While these are commonly determined using the identity of the user, Shibboleth provides a way to mutually refer to the same principal without revealing that principal's identity. Because the user is initially known to the target site only by a randomly generated temporary handle, if sufficient, the target site might know no more about the user than that the user is a member of the origin organization. This handle should never be used to decide whether or not to grant access, and is intended only as a temporary reference for requesting attributes.

1.a. Origin

There are four primary components to the origin side in Shibboleth: the Attribute Authority (AA), the Handle Service (HS), the directory service, and the local sign-on system (SSO). The AA and HS are provided with Shibboleth, and an open-source WebISO solution Pubcookie is also supplied; the directory is provided by the origin site. Shibboleth is able to interface with a directory exporting an LDAP interface or a SQL database containing user attributes, and is designed such that programming interfaces to other repositories should be readily implemented. Shibboleth relies on standard web server mechanisms to trigger local authentication. A .htaccess file can be easily used to trigger either the local WebISO system or the web server's own Basic Auth mechanism, which will likely utilize an enterprise authentication system, such as Kerberos.

From the origin site's point of view, the first contact will be the redirection of a user to the handle service, which will then consult the SSO system to determine whether the user has already been authenticated. If not, then the browser user will be asked to authenticate, and then sent back to the target URL with a handle bundled in an attribute assertion. Next, a request from the Shibboleth Attribute Requester (SHAR) will arrive at the AA which will include the previously mentioned handle. The AA then consults the ARP's for the directory entry corresponding to the handle, queries the directory for these attributes, and releases to the SHAR all attributes the SHAR is entitled to know about that user.

1.b. Target

There are three primary components to the target side in Shibboleth: the Shibboleth Indexical Reference Establisher (SHIRE), the Shibboleth Attribute Requester (SHAR), and the resource manager (RM). An implementation of each of these is included in the standard Shibboleth distribution. These components are intended to run on the same web server.

From the target's point of view, a browser will hit the RM with a request for a Shibboleth-protected resource. The RM then allows the SHIRE to step in, which will use the WAYF to acquire the name of a handle service to ask about the user. The handle service (HS) will then reply with a SAML authentication assertion containing a handle, which the SHIRE then hands off to the SHAR. The SHAR uses the handle and the supplied address of the corresponding attribute authority (AA) to request all attributes it is allowed to know about the handle. The SHAR performs some basic validation and analysis based on attribute acceptance policies (AAP's). These attributes are then handed off to the RM, which is responsible for using these attributes to decide whether to grant access.

1.c. Where are you from? (WAYF)

The WAYF service can be either outsourced and operated by a federation or deployed as part of the SHIRE. It is responsible for allowing a user to associate themself with an institution of their specification, then redirecting the user to the known address for the handle service of that institution.

1.d. Federations

A federation is one way to provide part of the underlying trust required for function of the Shibboleth architecture. A federation in the context of Shibboleth is a group of organizations(universities, corporations, content providers, etc.) who agree to exchange attributes using the SAML/Shibboleth protocols and abide by a common set of policies and practices. In so doing, they must implicitly or explicitly agree to a common set of guidelines. Joining a federation is not explicitly necessary for operation of Shibboleth, but it dramatically expands the number of targets and origins that can interact without defining bilateral agreements between all these parties.

A federation can be created in a variety of formats and trust models, but to support Shibboleth, it must provide a certain set of services to federation members. It needs to supply a registry to process applications to the federation and distribute membership information to the origin and target sites. This must include distribution of the PKI components necessary for trust between origins and targets. There also needs to be a set of agreements and best practices defined by the federation governing the exchange, use, and population of attributes before and after transit, and there should be a way to find information on local authentication and authorization practices for federation members.


2. Planning

There are several essential elements that must be present in the environment to ensure Shibboleth functions well, both political and technical. Shibboleth currently runs on a specific range of platforms and web server environments. The SHAR and SHIRE are implemented entirely in C/C++. These are the recommendations and requirements for a successful implementation of a Shibboleth target.

2.a. Requirements

Shibboleth currently supports Windows NT/2000/XP/2003, Linux, and Solaris. At present, Shibboleth consists of Apache (or IIS) plugins and a separate SHAR process. The plugins use the ONC RPC mechanism to communicate with the SHAR over Unix domain or TCP sockets. The target's web servers must be running Apache 1.3.26+, or Microsoft IIS 4.0+, but not Apache 2. More precise technical details are discussed in 3.a.

2.b. Join a Federation

While it is not necessary for a target or origin to join a federation, doing so greatly facilitates the implementation of multilateral trust relationships. Each federation will have a different application process.

For more information on federations, refer to 1.d or the Shibboleth v1.0 architectural document.

To use Shibboleth without a federation, manual configuration of target and origin trust and site information will be needed to insure that sites interoperate. Most identifiers, such as site names, should be URI-based, and should be chosen in accordance with DNS domains under the control of the parties involved, much as Java package naming is coordinated. In other words, don't use a URI containing a DNS domain or hostname that you do not control.

2.c. Security Considerations

Shibboleth's protocols and software have been extensively engineered to provide protection against many attacks. However, the most secure protocol can be compromised if it is placed in an insecure environment. To ensure Shibboleth is as secure as possible, there are several recommended security precautions which should be in place at local sites.

  1. SSL use is optional for target sites, but should be used if at all possible, at least in the processing of incoming sessions (called the SHIRE URL or assertion consumer service). Federation guidelines should be considered when determining whether to implement SSL, and, in general, SSL should be used for interactions with client machines to provide the necessary authentication and encryption to ensure protection from man-in-the-middle attacks. It is strongly suggested that all password traffic or similarly sensitive data should be SSL-protected. Assessment of the risk tradeoff against possible performance degradation should be performed for all applications.
  2. Many other attacks can be made on the several redirection steps that Shibboleth takes to complete attribute transfer. The best protection against this is safeguarding the WAYF service and ensuring that rogue targets and origins are not used, generally by development of the trust model underneath Shibboleth. Shibboleth also leverages DNS for security, which is not uncommon, but attacks concerning bad domain information should be considered.
  3. Information regarding origin users is generally provided by the authoritative enterprise directory, and the acceptance of requests from target applications can be carefully restricted to ensure that all requests the SHAR performs are authorized and all information the origin provides is accurate. Use of plaintext passwords is strongly advised against.
  4. Server platforms should be properly secured, commensurate with the level that would be expected for an organization's other security services, and cookie stores on client machines should be well protected.

2.d. Server Certs

In the Shibboleth architecture, the SHAR, HS, and AA must all have various client and/or server certificates for use in signing assertions and creating SSL channels. These should be issued by a commonly accepted CA, which may be stipulated by your federation. After understanding the CA's acceptible to your federations, consult chapter 4.c for information on certificate and key generation.

2.e. Attribute Release Policies

The Attribute Authority maintains a set of rules called Attribute Release Policies (ARP's) that define which attributes are released to which targets. When a browser user tries to access a resource, the SHAR asks the origin site AA to release all the attributes it is allowed to know, possibly restricted to specifically desired subset. The SHAR provides its own name and an optional URL on behalf of which the attribute request is made which can further refine the information the SHAR is allowed to know. The AA processes this request using all applicable ARP's, determines which attributes and values it will release, and then obtains the values actually associated with the browser user. The AA sends these attributes and values back to the SHAR.

Targets should work together with expected origin sites to ensure that the sets of attributes that both sites expect to correspond using are congruent.

2.f. Attribute Acceptance Policies

When a target receives a set of attributes, it must evaluate them in the context of the Attribute Authority that is providing them, to assess their "reasonableness". For example, if the value of an attribute is expected to be from a small set of enumerated choices, the value should be compared against that list. If a particular attribute or value is only trusted when asserted by specific origins, that too should be checked.

Targets are configured to accept specific attributes that they understand and care about, and are also configured with the rules to apply before accepting the attributes for use by the RM or an application. Attributes and values that don't meet the target's requirements are filtered out. The set of configuration rules to make these decisions is called an Attribute Acceptance Policy (AAP).

2.g. Browser Requirements

A primary Shibboleth design consideration was to require very little or no modification to client machines. The only requirement is that a browser is used which supports cookies, redirection and SSL. Browser users will have to perform an additional click to submit the authentication assertion if JavaScript is not functional.

2.h. Clocks

NTP should be run on all web servers. Shibboleth employs a short handle issuance time to protect against replay attacks. Because of this, any significant degree of clock skew can hinder the ability of users to access sites successfully.

2.i. Other Considerations

Especially for higher education, there are a handful of laws enacted which may have important ramifications on the disclosure of personal information and attributes. Since Shibboleth does not necessarily need to transmit identity, it is an ideal solution for many higher education situations. Nevertheless, all parties within the United States of America are strongly advised to consult the Family Educational Rights and Privacy Act of 1974(FERPA), and all other relevant state and federal legislation before deploying Shibboleth.



3. Installation

3.a. Software Requirements

The Shibboleth project makes binary packages available for Solaris and Linux that are precompiled against recent releases of various required libraries such as OpenSSL. It is highly advisable to build from source when using Shibboleth in a production environment in order to permit patching or updating of packages as security holes and bugs are fixed. Building from source is necessary to give you complete control over your deployment platform. The binary packages represent a snapshot in time only. To build from source, see the INSTALL.txt files in the doc folder of the OpenSAML and Shibboleth source distributions.

The software requirements listed correspond to the binary distributions. In general, source builds should work against all recent versions of the operating systems and software dependencies listed below. For specific questions, inquire to the support mailing list, or give it a try. Note that OpenSSL releases frequent security updates; the version listed may not be the most current, but most minor "letter" updates should be usable.

Operating System:

3.b. Deploy the Shibboleth Package

For the sake of clarity, this deployment guide assumes that standard directories are used for all installations. These directories may be changed for local implementations, but must be done so consistently.

  1. Ensure that you have obtained the proper tarball or installer for your operating system.
  2. On Unix, the tarballs expand into /opt/shibboleth, and should be expanded as root from /. If you use a different layout or location, you will need to adjust your configuration files. You should see the following directory structure (date and size details notwithstanding):

    $ ls -l
    drwxr-xr-x 2 root root 4096 Oct 24 03:54 bin
    drwxr-xr-x 2 root root 4096 Oct 24 03:54 data
    drwxr-xr-x 2 root root 4096 Oct 24 03:54 doc
    drwxr-xr-x 4 root root 4096 Oct 24 03:54 etc
    drwxr-xr-x 9 root root 4096 Oct 24 03:54 include
    drwxr-xr-x 4 root root 4096 Oct 24 03:55 lib
    drwxr-xr-x 2 root root 4096 Oct 24 03:55 libexec
    drwxr-xr-x 4 root root 4096 Oct 24 02:02 share

    On Windows, if the installer is not used, the zip file should be unpacked beneath the root of the system drive, where it will create an \opt\shibboleth tree that resembles the Unix layout above. This will allow the standard configuration options to work. The C:\opt\shibboleth\lib directory MUST be added to the system path to enable proper operation. If you use a different location, changes to various configuration files must be made by hand. The installer can do this for you, and is recommended in such cases.

3.c. Configure Apache 1.3.x

  1. Shibboleth includes configuration directives in the file /opt/shibboleth/etc/shibboleth/apache.config which must be added to the httpd.conf file used locally. It is recommended that these directives simply be added to the end of the existing httpd.conf file rather than trying to merge it in-line; step 2 describes the necessary modifications to the Apache startup script. The default configuration will often work, but if customization is necessary, these options may be modified:
    LoadModule <module> <pathname>
    Specifies the title and location of the shibrm_module resource manager and shire_module SHIRE modules. These are installed by default at /opt/shibboleth/libexec/mod_shibrm.so and /opt/shibboleth/libexec/mod_shire.so
    SHIREConfig <pathname>
    Specifies the pathname of the SHIRE's configuration file. Defaults to /opt/shibboleth/etc/shibboleth/shibboleth.xml.
    SHIREURL <url>
    <Location <url>>
      SetHandler <method>
    </Location>
    Specifies the URL and the method the target uses to handle requests for Shibboleth-protected resources. Currently, shib-shire-post is the only available handler method. SHIREURL is used by Shibboleth when re-directing the user to the WAYF and <Location> by Apache; for this reason, both URL specifications must match. Note that the configuration file itself contains <>'s, and Location should not be replaced.

    The referenced URL can be either a partial path or an absolute URL. The partial path allows each virtual server to use its own hostname and port in the SHIRE for session cookie purposes, while the absolute URL forces HTTP virtual servers to use HTTPS for the SHIRE. Use of a full https:// URL is advised.

    ShibMapAttribute <attribute-uri> <HTTP-header> [alias]
    This command has been deprecated in favor of the configuration support available in the Attribute Acceptance Policy file. See section 4.e. It may be removed in a future release.
  2. These modifications must be made to the Apache startup script on Unix:

    Add the following environment variable:

    SHIBCONFIG=/opt/shibboleth/etc/shibboleth/shibboleth.xml
    export SHIBCONFIG

    If the SHIBCONFIG environment variable is not specified, Shibboleth will use /opt/shibboleth/etc/shibboleth/shibboleth.xml by default.

    On Windows, the installer will set the path and SHIBCONFIG variable for you in the system path, enabling Apache or IIS to be used.

  3. If the OpenSSL libraries are not in the system's search path, they should be added to LD_LIBRARY_PATH. Generally libtool's linker options will insure that the modules can locate the Shibboleth libraries, but if not, you may need to add /opt/shibboleth/lib to LD_LIBRARY_PATH as well.
  4. The SHAR must be started along with Apache. Among other methods on Unix, this can be done either by creating a separate SHAR startup script or by modifying Apache's RC script to start/stop the SHAR before httpd. It is suggested that Apache's script be modified by adding:

    /opt/shibboleth/bin/shar -f &

    Sample init.d scripts may be included with future releases. Ensure that the environment variable referenced in 3.c.2 are in place.

    On Windows, the SHAR is a service and is managed separately.

  5. By default, the Shibboleth modules are configured to log information on behalf of Apache to the file /opt/shibboleth/etc/shibboleth/shire.log, though this can be changed. For this log to be created, Apache must have permission to write to this file, which may require that the file be manually created and permissions assigned to whatever user Apache is configured to run under. If the file does not appear when Apache runs with the modules loaded, check for permission problems.
  6. The options in shibboleth.xml must be configured as documented in 4.a. Apache content will then need to be modified for Shibboleth authentication. This is discussed in 4.d. It is recommended that the target then be tested as detailed in section 5.a.

3.d. Configure Microsoft IIS

  1. The package includes an ISAPI filter and bundled extension for SHIRE POST processing in a single library, libexec\isapi_shib.dll. This filter is configured using commands in C:\opt\shibboleth\etc\shibboleth\shibboleth.xml. Make sure you've added the library directory to the path as directed in section 3.b.

    Installing the extension into IIS is a two step process:

    1. First, add the filter using the Internet Services Manager MMC console. Right click on the machine icon on the left, and edit the WWW Service master properties. On the "ISAPI Filters" tab, add a new filter called Shibboleth and specify the DLL named above. The priority should be High, and once the filter is loaded, make sure it appears in the list below the "sspifilt" entry. Restart IIS and make sure the filter shows up with a green arrow. Check the Windows event log if it fails to load. The default configuration options are sparse, but they should allow the filter to at least initialize.
    2. Secondly, map a special file extension, such as .shire, to the ISAPI library so that virtual URLs can be specified to invoke the SHIRE handler for each web site. Right click on the machine icon on the left, and edit the WWW Service master properties. On the "Home Directory" tab, add a script mapping using the "Configuration" button. The "Executable" box should point to isapi_shib.dll, and the "Extension" can be set to anything unlikely to conflict, but .shire is assumed (and the dot must be included). You should select the option to limit verbs to POST, and you must uncheck the "Check that file exists" box.
    3. (IIS 6 Only) A new Web Service Extension must be defined for Shibboleth; without this, the mapping from *.shire to isapi_shib.dll won't occur and a file error will show. Add this extension with an arbitrary name and associate it with isapi_shib.dll.
  2. All other aspects of configuration are handled via the shibboleth.xml file and associated XML-based policy files described in subsequent sections. Particular use is made of the per-hostname section feature that allows global settings to be overridden per-site, and this permits different IIS instances to be separately configured.
  3. A special section must be added/uncommented in the shibboleth.xml file to support IIS usage. The [isapi] section must be used to map IIS Instance ID numbers to fully-qualified hostnames that correspond to named sections later in the file. Instance IDs are used in the IIS metabase to identify web sites. They are applied starting with the number 1 and number the web sites in order in the Internet Services Manager from top to bottom. In the [isapi] section, add lines in the following form:

    1=hostname.domain.com
    2=hostname2.domain.com
    (etc...)

    At least an empty configuration section named hostname.domain.com should then be added to the end of the file. Any options specific to that web site can be added as documented in later sections.

  4. See the following section for information on running the SHAR service on Windows.
  5. The options in shibboleth.xml must be configured as documented in 4.a. It is recommended that the target then be tested as detailed in section 5.a.

3.e. Running the SHAR on Windows

The SHAR is a console application that is primarily designed to be installed as a Windows service. To run the process in console mode for testing, the -console parameter is used. Otherwise, parameters are used to install (or remove) the SHAR from the service database and subsequent control is via the Service Control Manager applet. The following command line parameters can be used:

-console
Allows the process to be started from a command prompt. Since the console will exit if the desktop user logs out, this is not suitable for production use, but may be useful for testing.
-config <pathname>
Specifies the pathname of the SHAR's configuration file. Defaults to \opt\shibboleth\etc\shibboleth\shibboleth.xml or the value of the SHIBCONFIG environment variable, if it is set.
-install <servicename>
Installs the SHAR as a named service in the Windows service database. A name should be provided if multiple instances of the SHAR need to be run on different ports, and thus installed separately. The -config option can be provided to include a specific configuration file on the service's command line.
-remove <servicename>
Removes the named service instance of the SHAR from the Windows service database.



4. Getting Running

4.a. Configuring shibboleth.xml

The configuration for the target is mostly contained within shibboleth.xml, located by default at \opt\shibboleth\etc\shibboleth\shibboleth.xml. The target comes pre-configured with certificates and settings that will work against a dummy origin; however, there are several values that must later be changed to interoperate with other sites securely and effectively.

The following is a hyperlinked version of a basic configuration file, followed by a list of elements and attributes that must be modified. The actual example shipped with Shibboleth includes many more options that are commented out and other elements necessary to support dummy functionality. Click on any attribute or element for more information on its population and definition.

<ShibbolethTargetConfig xmlns="urn:mace:shibboleth:target:config:1.0"
        logger="/opt/local/shibboleth-1.2/etc/shibboleth/shibboleth.logger">


    <Extensions>
        <Library path="/opt/local/shibboleth-1.2/libexec/xmlproviders.so" fatal="true"/>
    </Extensions>

    <SHAR logger="/opt/local/shibboleth-1.2/etc/shibboleth/shar.logger">

        <Extensions>
            <Library path="/opt/local/shibboleth-1.2/libexec/shib-mysql-ccache.so" fatal="false"/>
        </Extensions>
    
        <UnixListener address="/tmp/shar-socket"/>

        <!-- Primarily for IIS Deployments:
        <TCPListener address="127.0.0.1" port="12345" acl="127.0.0.1"/>
        -->
        
        <MemorySessionCache cleanupInterval="300" cacheTimeout="3600" AATimeout="30" AAConnectTimeout="15"
            defaultLifetime="1800" retryInterval="300" strictValidity="true" propagateErrors="false"/>

            
    </SHAR>
    
    <SHIRE logger="/opt/local/shibboleth-1.2/etc/shibboleth/shire.logger">

        <RequestMapProvider type="edu.internet2.middleware.shibboleth.target.provider.XMLRequestMap">
            <RequestMap applicationId="default">
                <Host name="localhost" scheme="https">
                    <Path name="secure" requireSession="true" exportAssertion="true"/>
                </Host>
                <Host name="localhost" scheme="http">
                    <Path name="secure" requireSession="true" exportAssertion="true"/>
                </Host>
            </RequestMap>
        </RequestMapProvider>
      <!-- IIS only:
        <Implementation>
            <ISAPI normalizeRequest="true">
                <Site id="1" host="localhost"/>
            </ISAPI>
        </Implementation>
       -->
    </SHIRE>

    <Applications xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
     applicationId="default" providerId="https://localhost/shibboleth/target">

        <Sessions lifetime="7200" timeout="3600" checkAddress="true"
            shireURL="/Shibboleth.shire" shireSSL="false" cookieName="shib-default-app" cookieProps="; path=/"
            wayfURL="https://wayf.internet2.edu/InQueue/WAYF"/>


        <Errors shire="/opt/local/shibboleth-1.2/etc/shibboleth/shireError.html"
            rm="/opt/local/shibboleth-1.2/etc/shibboleth/rmError.html"
            access="/opt/local/shibboleth-1.2/etc/shibboleth/accessError.html"
            supportContact="root@localhost"
            logoLocation="/logo.gif"/>

            
        <Policy signRequest="false" signedResponse="false" signedAssertions="false">
            <AAPProvider type="edu.internet2.middleware.shibboleth.target.provider.XMLAAP" uri="/opt/local/shibboleth-1.2/etc/shibboleth/AAP.xml"/>
            
            <FederationProvider type="edu.internet2.middleware.shibboleth.common.provider.XMLMetadata"
                uri="/opt/local/shibboleth-1.2/etc/shibboleth/sites.xml"/>

            
            <TrustProvider type="edu.internet2.middleware.shibboleth.common.provider.XMLTrust"
                uri="/opt/local/shibboleth-1.2/etc/shibboleth/trust.xml"/>

                        
            <saml:Audience>urn:mace:inqueue</saml:Audience>
        </Policy>
        
        <CredentialUse TLS="defcreds" Signing="defcreds">
            <RelyingParty Name="urn:mace:inqueue" TLS="inqueuecreds" Signing="inqueuecreds"/>
        </CredentialUse>

    </Applications>
    
    <CredentialsProvider type="edu.internet2.middleware.shibboleth.common.Credentials">
        <Credentials xmlns="urn:mace:shibboleth:credentials:1.0">
            <FileResolver Id="defcreds">
                <Key format="PEM">
                    <Path>/opt/local/shibboleth-1.2/etc/shibboleth/shar.key</Path>
                </Key>
                <Certificate format="PEM">
                    <Path>/opt/local/shibboleth-1.2/etc/shibboleth/shar.crt</Path>
                </Certificate>
            </FileResolver>
        </Credentials>
    </CredentialsProvider>

</ShibbolethTargetConfig>

The following changes must be made to the default configuration before the target will interoperate in a federation.

  1. The main Applications element's providerId attribute must be changed to reflect the URN this target will use to identify itself with its primary relying party. This will often be supplied by a federation.

  2. The supportContact for the target found in the Errors element should be changed to ensure that users have a proper support mechanism.

  3. Proper credentials for this target signed by an authority that the primary relying party recognizes must be referenced by the Credentials element. The default configuration points at flat files with widely-available, insecure keys and certificates. Note that keys are supported in a variety of formats: DER, PEM, encrypted PEM, PKCS8, and encrypted PKCS8. If a keystore must be used instead, consult section 5.a for appropriate structure and details on population.

For Apache (but not IIS), there is also information that must be configured in /usr/local/apache/conf/httpd.conf (or equivalent);  for more information, refer to 3.c.

Information in the logging configuration files referenced by shibboleth.xml may require additional changes to meet local needs. The logging level can be raised to INFO or DEBUG if additional detail is needed for testing. It is recommended that after initial installation is completed, the log level in both files be left at either INFO or WARN.

All elements are optional unless otherwise specified. All attributes of an element are optional unless designated mandatory by a purple background.

<AAPProvider type="edu.internet2.middleware.shibboleth.target.provider.XMLAAP" uri="pathname"/>
This element is used to specify individual attribute acceptance policies that will apply to this application and may appear one or more times within the Attributes element. For information about these policies and their format, refer to section 4.e.
<Application id="identifier" providerId="identifier">
Individual applications that require different attributes, credentials, sessions, etc. can be differentiated from the default configuration as specified in the Applications element, which contains this element. It must still contain a Sessions element, but use of the Errors, Policy, and CredentialUse elements is optional.
<Applications id="identifier" providerId="identifier">
The Applications element must appear once and contains default settings for requests handled by the target whose applicable request mapping using matching RequestMap, Host, and Path elements has no declared applicationId attribute. It must contain at least one each of the Sessions, Errors, Policy, and CredentialUse elements, and may contain individual Application elements. Contained by the main ShibbolethTargetConfig element.
<Attributes signRequest="true/false" signedResponse="true/false" signedAssertions="true/false">
The Attributes element affects how this application handles attribute queries to AA's and the processing of these attributes upon receipt. It may contain one or more AAPProvider elements, each of which specifies a set of attribute acceptance policies; see section 4.e for details.
<CAPath>pathname</CAPath>
Paired with a Path element and contained by a FileResolver element, this element allows for the specification of additional certificates in the chain up to the trust anchor. As many CAPath elements as necessary to complete the chain may be specified. The expectations of the target and the federation may determine the necessity for the use of this field.
<CertAlias>string</CertAlias>
Specifies the alias for the certificate corresponding to the private key used by the HS. If no alias is specified, defaults to the private key's alias. Contained by the KeyStoreResolver element.
<Certificate format="type">
This specifies the certificate corresponding to this set of credentials. The certificate itself must be referred to using a Path element contained by this element. If this certificate isn't self-signed or signed by a root familiar to the origin, the files of certificates in the path to the root may be specified using one or more CAPath elements. Valid encodings are PEM and DER. It resides within the FileResolver element and must be paired with the corresponding private key using the Key element.
<Credentials xmlns="urn:mace:shibboleth:credentials:1.0">
This element is the container for credentials used by the credential mechanism specified by the CredentialsProvider element. For most deployments, the URN should be . It must contain one FileResolver element for flat key and certificate files or one KeyStoreResolver element for compound keystores.
<CredentialsProvider type="edu.internet2.middleware.shibboleth.common.Credentials">
This element is the container for credentials used by the target and is contained by the ShibbolethTargetConfig element. It must contain one Credentials element detailing the individual credentials to be used by the target in attribute transactions.
<Errors shire="pathname" rm="pathname" access="pathname" supportContact="e-mail" logoLocation="URL"/>
Shibboleth is capable of displaying customized error pages based on templates and special resources provided by these configuration attributes. These should all be customized to fit the web scheme of the target. For more information on configuration of the error page generation, please see section 4.b.
<Extensions>
Extension libraries for one of the Shibboleth components or the entire target can be specified using this element depending on where it's present. It may be contained by any of the SHAR, SHIRE, or ShibbolethTargetConfig elements. It should always contain one or more Library elements.
<FederationProvider type="edu.internet2.middleware.shibboleth.common.provider.XMLMetadata" uri="pathname"/>
This element, when specified within a Policy element, points to metadata in the form of a sites file for use by this application distributed by the federation under which it operates. This should be updated regularly; see section 4.g for further details.
<FileResolver Id="string">
This element defines a pair of files used to store a private key and certificate associated with a given identifier and is contained by the Credentials element. RelyingParty elements will refer to these identifiers allowing multiple resolver elements to be used to specify different credential storage for different applications. It must contain one Key element and should contain one Certificate element.
<Host scheme="protocol" name="fqdn" port="integer" applicationId="id" requireSession="true/false" exportAssertion>
Individual hosts that this target protects are enumerated by Host elements as contained by RequestMap element. If a request is received by Shibboleth for a URL on this host, these parameters will be applied to the handling. If there are Path elements within this element that match the URL and contain the applicationId, requireSession, or exportAssertion attributes, they will over-ride the ones in this element; similarly, the ones within this element will over-ride the ones in the containing RequestMap element.
<Implementation>
A container element placed inside the SHIRE element, the contents of this element will vary depending on the web server that this Shibboleth deployment serves. Multiple configurations may be specified, but only one per web server type. This element may contain the ISAPI element. .
<ISAPI normalizeRequest="true/false">
The configuration information for Shibboleth targets deployed behind ISAPI is stored inside this container element. This element must contain one or more Site elements, each of which maps IIS IID values to the vhost name. If normalizeRequest is true, all redirects and computed request URLs generated by Shibboleth will be created using the virtual server name assigned to the server. If false, the browser's supplied URL is sometimes used to compute the information. This sometimes has no effect, depending on the capabilities of the web server, since the correct behavior is almost always to rely on the server's API to report the hostname and ignore the browser. Contained by the Implementation element.
<Key format="type">
This specifies the file containing a private key to be used by a set of credentials. Valid encodings are PEM and DER. Keys are supported in a variety of formats: DER, PEM, encrypted PEM, PKCS8, and encrypted PKCS8. It resides within the FileResolver element, should be paired with a Certificate element, and contain a Path element.
<KeyAlias>string</KeyAlias>
Specifies the alias used for accessing the private key. Contained by the KeyStoreResolver element.
<KeyPassword>string</KeyPassword>
Specifies the password used to retrieve the private key. Contained by the KeyStoreResolver element.
<KeyStoreKeyAlias>string</KeyStoreKeyAlias>
Specifies the alias used for accessing the private key. Contained by the NameMapping element when a CryptoHandleGenerator type is specified.
<KeyStoreKeyPassword>string</KeyStoreKeyPassword>
Specifies the password used to retrieve the private key. Contained by the NameMapping element when a CryptoHandleGenerator type is specified.
<KeyStorePassword>string</KeyStorePassword>
Specifies the password to access the keystore containing the private key to be used for symmetric encryption. Contained by the NameMapping element when a CryptoHandleGenerator type is specified.
<KeyStorePath>string</KeyStorePath>
Specifies the location of the keystore containing the private key to be used for symmetric encryption to pass handles between the HS and AA. Contained by the NameMapping element when a CryptoHandleGenerator type is specified.
<KeyStoreResolver Id="string" storeType="type">
This element is contained by the Credentials element and to specify a keystore that contains both the certificate and private key for a given set of credentials. Typically, this will be a Java keystore, with a corresponding type of JKS. RelyingParty elements will refer to the Id allowing multiple resolver elements to be used to specify different credential storage for different federations or target sites. It must contain one Path element, one KeyAlias element, and one StorePassword element; it may optionally contain a KeyPassword element or a CertAlias element.
<Library path="pathname" fatal="true/false"/>
This element defines an extension library for one of Shibboleth's components when specified within an Extensions element.
<MemorySessionCache sessionCacheProperties/>
Shibboleth will cache sessions and received attributes in-memory if this element is part of shibboleth.xml. There's actually a great number of attributes that may be specified; consult the sessionCacheAttributes section for a full list and descriptions. This element must be contained by the SHAR element and is mutually exclusive with the MemorySessionCache element.
<MySQLSessionCache mysqlTimeout="seconds" sessionCacheProperties/>
Shibboleth will cache sessions and received attributes using a MySQL database if this element is part of shibboleth.xml. Arguments may be passed directly to MySQL by populating this element with additional Argument elements. There's actually a great number of attributes that may be specified; consult the sessionCacheAttributes section for a full list and descriptions. This element must be contained by the SHAR element and is mutually exclusive with the MemorySessionCache element.
<Path name="pathname" applicationId="id" requireSession="true/false" exportAssertion/>
This attribute allows for different application identifiers and session handling to be defined iteratively for subdirectories within a host. Requests are processed on a best-match basis, with the innermost element taking precedence; for more information, consult blah. Path elements may be contained by Host elements or other Path elements.
<Policy>
This element is the main container for specification of policies for attributes, trust, and federation handling by an application. It must be contained by the Applications and, if contained by an Application element, will over-ride the main policy element which would have been inherited by default. The configuration for policy is defined by these elements, each of which is optional: Attributes, FederationProvider, TrustProvider, RevocationProvider, and Audiences.
<RequestMap applicationId="id" requireSession="true/false" exportAssertion="true/false" uri="URI">

For a general description of how the target handles incoming requests, please refer to section 1.f.

Each RequestMap element contains a set of hosts, URLs, and applications that all share the same rules on session and assertion requirements in the form of individual Host elements. If session requirement or assertion handling conditions varies across that granularity, additional RequestMap elements may be specified for them. Alternatively, these conditions may be specified on Path and Host elements within this element which will override these settings.

<RelyingParty name="URN" TLS="id Signing="id"/

One or more RelyingParty elements may be contained by individual CredentialUse elements to enumerate relying parties for which an individual set of credentials should be used. Each one will contain a unique URN specified in transactions conducted with that relying party and may use different credentials for different aspects of the interaction with origins within that relying party.

<RequestMapProvider type="edu.internet2.middleware.shibboleth.target.provider.XMLRequestMap">

This element holds one or more request mapping providers, each of which defines how Shibboleth will perform sessions and access controls for a given mapping of a URL to a path. There must be one or more RequestMap elements within this element, each of which represents access controls and session definitions for a URL to pathname mapping.

<Sessions wayfURL="URL"
shireURL="URL"

shireSSL="true/false"
cookieName="URL"
cookieProps="URL"
lifetime="seconds"
timeout="seconds"
checkAddress="true/false"
/>
Configuration parameters that affect the way Shibboleth handles sessions for an individual application identifier are bundled in this element, which must be contained by each Application and Applications element. Note that these parameters only apply to Shibboleth sessions, and not any sessions applications initiate.
<SessionCacheProperties AAConnectTimeout="seconds" AATimeout="seconds" cacheTimeout="seconds" cleanupInterval="seconds" defaultLifetime="seconds" propagateErrors="true/false" retryInterval="seconds" strictValidity="true/false"
These attributes may all be specified as part of either the MySQLSessionCache element or the MemorySessionCache element. They are all optional.
<SHAR logger="pathname">
This is the container element for configuration information pertaining to the SHAR, the main component of the target, which is responsible for requesting information about browser users from AA's. Its single attribute, logger, points toward a Log4J logger file that can be used by the SHAR. It is contained by the ShibbolethTargetConfig element and may contain an Extensions element specifying additional libraries.

It must contain either a UnixListener element to listen to the Apache module on a UNIX domain socket or a TCPListener element to listen on a TCP port. Session caching for this SHAR must also be specified using a MemorySessionCache element to use in-memory session caching or a MySQLSessionCache element to store session information in a MySQL database.

<ShibbolethTargetConfig>
This is the main container element for the target configuration and must be present once and only once. It must always contain a SHAR element, a SHIRE element, an Applications element, one or more CredentialsProvider elements, and optionally an Extensions.
<SHIRE logger="pathname">
This is the container element for configuration information pertaining to the SHIRE, the part of the target that establishes sessions and passes on received attributes to applications. Its single attribute, logger, points toward a Log4J logger file that can be used by the SHIRE. It is contained by the ShibbolethTargetConfig element and may contain an Extensions element specifying additional libraries.

It must contain one Implementation element, within which configuration for the SHIRE which varies by platform will be specified.

One or more RequestMapProvider elements must be contained by this element, which serves to provide protection on individual pathnames served by the webserver.

<Site id="IID" host="fqdn"/>
This element is placed in the ISAPI element to specify a mapping from individual instance ID's to respective vhost domain names.
<TCPListener address="pathname" port="integer" acl="ip">
This element must be contained by the SHAR element and is mutually exclusive with the TCPListener element. It allows the SHAR to instead listen to the Apache module over TCP.
<TrustProvider type="edu.internet2.middleware.shibboleth.common.provider.XMLTrust" uri="pathname"/>
This element, when specified within a Policy element, provides information on signing keys and certificates for use in interactions with AA's. This should be updated regularly; see section 4.g for further details.
<UnixListener address="pathname"/>
Use this element to specify a UNIX domain socket located at the pathname specified in the address attribute the SHAR should listen for Apache module requests on rather than on a TCP port. This element must be contained by the SHAR element and is mutually exclusive with the TCPListener element. UnixListener cannot be specified for Windows-based installations.

4.b. Dynamic Error Page Generation

Shibboleth supports the dynamic generation of information in error pages referenced by shibboleth.xml. The Shib Target employs a special Markup Language Processor to insert special tags into the generated HTML. The parser will read the error file looking for any tag that looks like:

<shibmlp tag-name />

Shibboleth will replace tag-name with the appropriate markup tag from the table below:

supportContact
The value of the supportContact for this web site.
logoLocation
The value of the logoLocation for this web site. This is used to fill in the template error page only; if a custom error page is created, then the image may be linked to statically by the page itself.
requestURL
The user's requested URL.
errorType
The type of error.
errorText
The actual error message.
errorDesc
A textual description of the error intended for human consumption.
originContactName
The contact name for the origin site provided by that site's metadata.
originContactEmail
The contact email address for the origin site provided by that site's metadata.
originErrorURL
The URL of an error handling page for the origin site provided by that site's metadata.

This configuration is only for Apache servers, and is only used by resources protected by Shibboleth. See section 4.d.

Sample error templates for different kinds of errors are included in the Shibboleth distribution, and can be triggered by anything that will cause Shibboleth to be unable to make an authorization decision, including a bad sites file, certificate verification failures, or a skewed clock between sites.

You should edit these templates, provide or remove style sheets and images, and otherwise customize these templates to suit the user experience you want your users to have when errors occur. The defaults are not likely to meet the needs of any site.

4.c. Key Generation and Certificate Installation

The only target component that must have a private key and certificate is the SHAR. While the target server itself should support SSL in most cases for users, it is mandatory for the SHAR to authenticate when contacting an AA, and it must therefore be given a key and an SSL client certificate. It is permissible for the SHAR to use the same keypair and certificate used by the target web server itself, provided the certificate is signed by a CA accepted by the origin sites that will be queried for attributes.

On Unix, we require that OpenSSL be installed to use Shibboleth. On Windows, OpenSSL libraries and the command line tool are included in the package and can be used directly, if not otherwise available.

The certificate and key file location should be based on whether they will also be used for Apache. If they will be used as a server certificate as well, they should probably be in the Apache tree in the usual mod_ssl-defined locations inside the Apache configuration folder., and the SHAR can read them from there. If the SHAR is not running as root, permissions might need to be changed to allow this access. If the certificate and key will only be used for the SHAR, they can be put in the same folder with the shibboleth.xml file and protected appropriately.

Other web servers like IIS do not use the raw PEM format that Apache and Shibboleth can share, and therefore the components must generally use separate copies of the key and certificate if they are to be shared. Most other servers can export and/or import keys to and from PEM format or other formats that OpenSSL can convert. Refer to your server's documentation or ask for assistance from others who use it.

The SHAR is assigned a key and a certificate using shibboleth.xml's certFile, keyFile and keyPass settings, described in section 4.a. These files must currently be in PEM format. OpenSSL commands to generate a new keypair and a certificate request are shown here, assuming 2048 bit RSA keys are to be used:

$ openssl genrsa -des3 -out ssl.key 2048
$ openssl req -new -key ssl.key -out ssl.csr

The signed certificate file returned by the CA should be usable directly, or can be converted to PEM format using the openssl x509 command.

If the key is to be shared with Apache, the web server's child processes, often running as nobody, must be able to read them while the server is running, which may require permission changes.

This particularly applies when sharing the key and certificate used by mod_ssl, which are only readable by root by default. The password, if any, must be placed in the shibboleth.xml file, since the Apache module cannot prompt for it during initial startup as mod_ssl can. The issues surrounding how to securely obtain a key while running as nobody may be addressed in a later release. Since the password will be stored in clear text in a frequently examined file, it is suggested to use a password not used elsewhere.

Finally, the calist command provides the SHAR with a set of CA roots to trust when validating AA server certificates. In all cases, the SHAR verifies that the certificate's Subject CN equals the AA's hostname, but the CA list restricts the accepted signers to those permitted by the SHAR. The parameter can be omitted to skip such validation, but this is not secure.

4.d. Protecting Web Pages

Protection of web pages is primarily achieved through "mapping" attributes provided by an AA to a localized vocabulary for authorization rules. This was formerly accomplished in Apache with the ShibMapAttribute command, but this has been replaced with additional features in the AAP syntax, described in section 4.e. This applies to both Apache and IIS.

IIS

The IIS RM module supports the mapping of attributes via AAP files, but it does not support rule-based policies and therefore cannot protect static content at this time. In addition, all of the configuration settings are managed globally or per-site and are pulled from the shibboleth.xml file, so there are no additional commands to document at this time.

Apache

The Apache RM module provided can interpret AAP settings to map attributes to HTTP request headers and to Require rules, permitting protecting of both static and dynamic content. The commands described here can appear in content-specific configuration blocks or .htaccess files. They determine what content is to be protected, session policies, and static access control rules.

Any of the typical ways of protecting content may be used (.htaccess, Directory, Location, Files, etc.). There are two ways to trigger Shibboleth authentication: specifying an AuthType of shibboleth to use Shibboleth directly, or using ShibBasicHijack to process existing .htaccess files using Shibboleth instead. Support for authorization consists of mod_auth-style require directives, as well as support for mod_auth group files.

A complete list of the directives and their values is below:

AuthType <string>
Use shibboleth for direct invocation, or Basic plus the ShibBasicHijack option described below.
ShibSSLOnly <on/off>
Controls whether Shibboleth will reject non-SSL requests for resources from clients. Defaults to off.
ShibBasicHijack <on/off>
Controls whether Shibboleth should or should not ignore requests with AuthType Basic. Defaults to off.
ShibExportAssertion <on/off>
Controls whether the SAML attribute assertion provided by the AA is exported in a base64-encoded HTTP header, Shib-Attributes. Defaults to off. While this does require parsing the raw XML, it also permits an application to see attributes that may have been filtered by an AAP, or to forward the SAML assertion to a third party.
ShibAuthLifetime <seconds>
If set, sessions are always terminated after the specified number of seconds, resulting in a new redirect and request for authentication, just as if a new request without a session is received. Defaults to infinite.
ShibAuthTimeout <seconds>
If set, sessions are always terminated after the specified number of seconds of inactivity (defined as no requests received in that session), resulting in a new redirect and request for authentication, just as if a new request without a session is received. Defaults to infinite.
AuthGroupFile <pathname>
Same as mod_auth; collects values found in REMOTE_USER into a named group for access control. An attribute must be mapped to REMOTE_USER for this to work. Note that mod_auth will not support group files when mod_shibrm is loaded, since they share the same command.

This is implemented by placing a .htaccess file that references a group file stored at /pathname:

AuthGroupFile /pathname
require group workgroup

An AuthGroupFile used by Shibboleth might resemble:
workgroup: joe@example.edu, jane@demo.edu, jim@sample.edu

Require <string>
Enforce authorization using one of the following methods.
  • valid-user

    Any Shibboleth user from a trusted origin site is accepted, even if no actual attributes are received. This is a very minimal kind of policy, but is useful for testing or for deferring real policy to an application.

  • user

    A space-delimited list of values, such as from the urn:mace:dir:attribute-def:eduPersonPrincipalName attribute. Actually, any attribute can be mapped to REMOTE_USER, even if this doesn't always make sense.

  • group

    A space-delimited list of group names defined within AuthGroupFile files, again provided that a mapping to REMOTE_USER exists.

  • <alias>

    An arbitrary rule name that matches an Alias defined in an AAP file. The rule value is a space-delimited list of attribute values, whose format depends on the attribute in question (e.g. an affiliation rule might look like:

    require affiliation staff@osu.edu faculty@mit.edu

Additionally, for user and <alias>-based rules, if a tilde character is placed immediately following user or <alias>, the expressions that follow are treated as regular expressions. The syntax supported is generally based on the one defined by XML Schema. This specification borders on unreadable, but the syntax is generally Perl-like. Expressions should generally be "anchored" with the ^ and $ symbols to insure mid-string matches don't cause false positives.

For example, the rule:
    require affiliation ~ ^member@.+\.edu$
would evaluate to allowing anyone with an affiliation of member from a .edu domain.

4.e. Defining Attributes and Acceptance Policies

Shibboleth allows a user and a site to release a varying set of attributes to a destination site, and does not impose restrictions on the kinds of attribute information provided by an AA. Target implementations must be prepared to examine the attributes they receive and filter them based on policies about what information to permit an origin site to assert about its users.

Attribute acceptance is the process of defining acceptable attributes and filtering attribute values before passing them on to a resource manager, such as the mod_shibrm module. Data blocked by AAP filters will not be passed to the CGI environment or used when enforcing .htaccess rules. Note that the attribute assertion exported to the Shib-Attributes header is unfiltered.

The Shibboleth implementation supports Scoped and Simple attributes and filtering policies for different kinds of attributes, and is potentially extensible to more complex attributes in the future. An attribute is considered Scoped if the XML representation of its values contains a "Scope" attribute. As of 1.1, this is detected at runtime and requires no configuration in advance.

An essential part of the Shibboleth trust fabric is ensuring that sites only assert attributes for domains for which they are considered authoritative by the target. Typically, this means that Brown University will be trusted to assert attributes only scoped to brown.edu. Unless there are very specific circumstances requiring this restriction be removed, it is strongly encouraged that such policies be in place.

Scoped:

Scoped attributes are a special kind of attribute whose values are a combination of a value and a scope, or context for the value. An example is eduPersonScopedAffiliation, which adds a scope to the defined set of eduPersonAffiliation values, such as student, member, or faculty. Scopes are expressed as DNS domains and subdomains.

Any scoped attribute can be scoped only to the origin site's permitted domains. These domains are listed in the site metadata that provides policy information to the system. Domains can be explicit or regular expressions, and can be changed by a target to meet its needs. Targets can also override the rules specified for the site in their own AAPs, choosing to accept additional scopes or deny scopes that would ordinarily be accepted based on metadata provided by a federation. Thus, attribute acceptance processing for scoped attributes is based on site metadata and target-specified overrides in addition to the mechanism described below for simple attributes.

Scope rules specified in an AAP are additive with any domains permitted by site metadata, and the rules are applied by first looking for an applicable denial rule, and then looking at site metadata and any applicable site rules for an accept rule.

Simple:

Simple attributes are attributes whose value is expressed in XML as a Text node; that is, the value is just a string. Multiple values are permitted. eduPersonEntitlement, in which the values are URIs, is one example of a simple attribute.

Both Simple and Scoped attribute acceptance is controlled with an external policy file written in XML. The schema for the file is described by the shibboleth.xsd schema, and an example file is included, AAP.xml. It is mandatory to supply such a file, because attributes are recognized based on their presence in this file, and not by separate configuration processes. Only by listing an attribute in the file will it be accepted and processed by the RM.

The policy is a default-deny algorithm that requires permissible attributes and values be listed explicitly. That is, an empty file permits nothing. Each attribute to be supported must be listed in the file by name in an <AttributeRule>. Each such rule is a collection of <SiteRule> elements along with an optional <AnySite> default rule. In turn each site rule is a set of <Value> rules that specify matches to permit, either literal or regular expressions, or a wildcarded <AnyValue> default rule, which is equivalent to a single regular expression rule allowing anything.

A syntax summary follows:

<AttributeAcceptancePolicy

The top level element in the file.

<AttributeRule
    Name="urn:mace:dir:attribute-def:eduPersonScopedAffiliation"
    Header="Shib-EP-Affiliation" Alias="affiliation">

Specifies a rule for an attribute, named by its URI. The following XML attributes can be supplied:

Name The name of the Shibboleth attribute, usually a URI. This is the only required XML attribute.
Namespace If the attribute's name includes a SAML namespace, supply it here. Normally this is unused.
Header The HTTP request header to map the attribute's values to.
Alias A short name for the attribute, determines the name of the Apache Requires rule.

<AnySite>

Specifies a rule that always applies to the attribute, regardless of the asserting AA.

<SiteRule Name="host.domain.com">

A rule that applies to the origin site AA corresponding to the hostname.

<Scope Accept="true|false" Type="type">

Specifies a value to accept or deny, either directly using type literal, or using a set of matching expressions as type regexp. literal is the default if Type is not specified. Accept defaults to "true">.

<AnyValue>

Specifies a rule that always applies to the attribute and site, regardless of the value(s).

<Value Type="type">

Specifies a value to permit, either directly using type literal, or using a set of matching expressions as type regexp. literal is the default if Type is not specified.

The regular expression syntax is a subset of the usual Perl and Unix syntaxes that is described in the XML Schema specification by the W3C. Most typical expressions should work. Be sure to anchor them using ^ and $ to avoid unintentional matches midstring.

4.f. Using Attributes in Applications

Apart from the simple RM functionality provided, attribute information may be made available directly to applications via the standard practice of creating custom HTTP request headers before passing control to the application. Applications should make no assumption about the presence of specific attributes for their use unless they have intimate knowledge of the attribute release policies in place.

The AAP metadata controls this interface, and maps a Shibboleth attribute to a header name, such as Shib-EP-Affiliation. Using that example, any values of the mapped attribute will be placed in that header, delimited by semicolons. An application that uses a CGI-like syntax to access the header will find the values in the HTTP_SHIB_EP_AFFILIATION variable. Any attribute can be placed in any header, to drive legacy applications that expect information in a particular location.

The REMOTE_USER variable is a special case that is generally populated automatically by the web server based on an internal piece of data that represents the current username. Unlike many authentication modules, Shibboleth does not guarantee that REMOTE_USER will have any value, because users may remain anonymous in many cases. If it does have a value, it is set solely because of an AAP file that maps an attribute to that header name. For many purposes, the urn:mace:dir:attribute-def:eduPersonPrincipalName attribute should be mapped to REMOTE_USER. Even so, EPPN may not be provided by the AA, and REMOTE_USER might still be empty.

The Shib-Origin-Site variable will contain the unique name/identifier of the origin site of the user. Some applications may use this to lookup additional policy or application data. It normally takes the form of a URI but could be any string in some deployments.

Finally, configuration may instruct the web server to place the entire XML message containing the SAML attribute information from the AA into a base64-encoded header called Shib-Attributes. This is a raw interface that provides an application with the entire AA response, and is not a filtered view based on any attribute acceptance rules or even based on what attributes are recognized by the target. What was sent is what you see.

4.g. siterefresh

Shibboleth provides a simple tool called siterefresh in the /opt/shibboleth/bin folder of the distribution to maintain metadata files referenced by shibboleth.xml. It will return 0 on success and a negative number on failure and log errors to stderr. If the data in the new metadata file is bad or the signature is invalid, the existing copy is kept. The SHAR and SHIRE stat all metadata files each time the data is used, allowing them to detect and utilize updates in real-time operation.

siterefresh takes the following command-line parameters:

--url <URL>
Specifies the URL of the remote metadata file with which to update the local file.
--out <pathname>
Specifies the local file to which to write the new metadata.
--cert <pathname>
Specifies the location of a certificate stored in PEM format used to validate the signature of the metadata file. Since much of Shibboleth's security flows from metadata files, this option is highly recommended, and the certificate used should be verified independently.
--schema <pathname>
Optionally defines a base path for schemas to use when validating the file. Defaults to /opt/shibboleth/etc/shibboleth/.

A complete command issued to siterefresh might take the form:

/opt/shibboleth/bin/siterefresh --out sites.xml --cert internet2.pem \
--url http://wayf.internet2.edu/InQueue/sites.xml

It is recommended that similar commands be added to a crontab to keep the site and trust files refreshed. AAP files tend to be site-specific, but could be maintained and distributed centrally. If the command is invoked in a script that writes the file to a new location and compares it with the old contents before overwriting the original, the command could be run very often without impacting target operations, providing a high degree of currency in case sites become compromised.

4.h. MySQL Session Cache

Shibboleth includes a useful plugin that extends the default memory cache for storing session data in the SHAR with a backing cache using an embedded MySQL database. In most distributions, it is enabled by default. The plugin can be found in the /opt/shibboleth/libexec folder, and is loaded as an extension library using the [extensions:saml] section of shibboleth.xml. The following configuration options are available:

mysql-cache-timeout = <seconds>    (in [shar] section)
Specifies the duration in seconds that must elapse between user accesses before that user's session is purged from the persistent cache. Defaults to 28800 seconds, or 8 hours. This should generally be longer than the associated server's settings for session lifetime and timeout, and the memory cache's timeout.
<MySQL Arguments>    (one per line in [mysql] section)
To pass arguments to the MySQL engine, create argument lines in the [mysql] section in the form:

arg1=<argument>
arg2=<argument>
etc...

Important arguments you'll find by default include:

arg1 = --language=/opt/shibboleth/share/english
arg2 = --datadir=/opt/shibboleth/data

which set the message file path and the location of the cache's database files respectively. Make sure the data directory exists before starting the SHAR if you change this path.



5. Troubleshooting

This section provides basic information about testing Shibboleth targets. This information is not intended to be comprehensive, but instead rudimentary guidelines for basic configuration tests and problems. For more detailed information or answers to specific problems not addressed in this section, please mail mace-shib-users@internet2.edu with a thorough description of errors and configurations used.

5.a. Basic Testing

The target may be tested by generating a folder with very basic access controls on it, and accessing it using a web browser. Place a simple webpage such as index.html in /secure/. Then, add the following lines to httpd.conf, which should be removed when testing is over:

# Configure a test directory
<Location /secure>
  AuthType shibboleth
  require valid-user

  # Per-directory SHIRE Configuration
  #ShibBasicHijack On
  #ShibSSLOnly On
  #ShibAuthLifetime 60
  #ShibAuthTimeout 600

  # RM Configuration
  #AuthGroupFile /foo
  #ShibExportAssertion On
</Location>

For information regarding specific error messages that may be generated if the target does not work successfully, please refer to section 5.b., or write mace-shib-users@internet2.edu.

5.b. Common Problems

A knowledge base is being developed in the Shibboleth Deployer's FAQ. Please mail mace-shib-users@internet2.edu with any additional questions or problems encountered that are not answered by this basic guide.