Child pages
  • Fetching Metadata and Attribute Filter and caching them locally
Skip to end of metadata
Go to start of metadata

This documents an alternative solution to managing refreshes to the metadata and attribute filter files.  The easier solution recommended in the installation manual is to let the IdP manage the refreshes.

This implementation is based on using an external script ( This script loads the XML file (over an HTTPS connection), checks the XML document for well-formedness, optionally verifies the signature on the downloaded XML document - and if all tests are passed, replaces the original file with a single "mv".

The script takes three arguments: the remote URL, the local file name, and an email address to send any errors to (no email sent if everything goes well).

An extra optional step (documented below) is to install XmlSecTool for verifying the signature. Otherwise, downloading the file over HTTPS and checking the XML structure provides also reasonable guarantees. If using XmlSecTool, the script takes a fourth argument, the certificate to check the signature with. And in this case, XmlSecTool must be found either in the PATH or in the XMLSECTOOL environment variable.

To deploy this solution without XmlSecTool:

  • Download the script into /opt/shibboleth-idp/bin

    wget -O /opt/shibboleth-idp/bin/
    chmod +x /opt/shibboleth-idp/bin/
  • Determine the URLs you will be loading the files (metadata and attribute filter) from and locations you will be putting them into - same as in the standard implementation above.
  • Download the metadata signing certificate into $IDP_HOME/credentials:

    wget -O $IDP_HOME/credentials/tuakiri-metadata-cert.pem
  • Invoke once to download the metadata:

    /opt/shibboleth-idp/bin/ /opt/shibboleth-idp/metadata/tuakiri-metadata-signed.xml
  • Invoke once to download the attribute filter for your IdP (note that you have to request one to be published, same as in the standard implementation above):

    /opt/shibboleth-idp/bin/ /opt/shibboleth-idp/conf/tuakiri-attribute-filter.xml
  • Configure a 3.x IdP to load the Tuakiri metadata and atribute filter files:
    • Configure the IdP to load the Federation Metadata in /opt/shibboleth-idp/conf/metadata-providers.xml by adding the following snippet into the ChainingMetadataProvider.

          <MetadataProvider id="TuakiriMetadata"
                  <MetadataFilter xsi:type="SignatureValidation"
                  <MetadataFilter xsi:type="EntityRoleWhiteList">


    • Edit $IDP_HOME/conf/services.xml and add the additional attribute filter as an additional value in the shibboleth.AttributeFilterResources util:list bean:




  • For archival purposes, we also keep the original instructions for configuring the Tuakiri metadata and attribute filter on a 2.x IdP - unfold the box below to see the IdP 2.x compatible syntax:

     Legacy IdP 2.x syntax for loading metadata and attribute filter
    • Load the metadata from the local file: add the following into $IDP_HOME/conf/relying-party.xml (the variation from the standard implementation above is using a FilesystemResource instead of a FileBackedHttpResource)
      • Add the following snippet into the ChainingMetadataProvider:

                <!-- Tuakiri -->
                <metadata:MetadataProvider id="Tuakiri" xsi:type="metadata:ResourceBackedMetadataProvider">
                  <metadata:MetadataFilter xsi:type="metadata:ChainingFilter" xmlns="urn:mace:shibboleth:2.0:metadata">
                    <metadata:MetadataFilter xsi:type="metadata:SignatureValidation" xmlns="urn:mace:shibboleth:2.0:metadata"
                                    requireSignedMetadata="true" />
                  <metadata:MetadataResource xsi:type="resource:FilesystemResource" file="/opt/shibboleth-idp/metadata/tuakiri-metadata.xml" />
      • Same as in the standard implementation, uncomment the <security:TrustEngine id="shibboleth.MetadataTrustEngine" xsi:type="security:StaticExplicitKeySignature"> element if it is still commented out and add in this snippet to load the metadata signing certificate

                <security:Credential id="Tuakiri-FederationCredentials" xsi:type="security:X509Filesystem">
    • Load the attribute filter from a local file: Add the following entry into <srv:Service id="shibboleth.AttributeFilterEngine" in $IDP_HOME/conf/service.xml:

              <srv:ConfigurationResource file="/opt/shibboleth-idp/conf/tuakiri-attribute-filter.xml" xsi:type="resource:FilesystemResource" />
  • Create a cron job to periodically (every 2 hours) download the metadata and the attribute filter: run crontab -e and add the following entry (matching the command you had run on the command line earlier):

    02 */2 * * * /opt/shibboleth-idp/bin/ /opt/shibboleth-idp/metadata/tuakiri-metadata.xml
    02 */2 * * * /opt/shibboleth-idp/bin/ /opt/shibboleth-idp/conf/tuakiri-attribute-filter.xml

Optional: Installing XmlSecTool

  • Download latest version (2.0.0 as of July 2016) from into ~/inst
    • Unzip into /opt/xmlsectool-$XMLSECTOOL_VERSION
    • Symlink as /opt/xmlsectool

      export XMLSECTOOL_VERSION="2.0.0"
      wget -P ~/inst/$XMLSECTOOL_VERSION/xmlsectool-$
      cd /opt
      unzip ~/inst/xmlsectool-$
      ln -s xmlsectool-$XMLSECTOOL_VERSION xmlsectool
  • Set JAVA_HOME to your Java installation:

    export JAVA_HOME=/usr/lib/jvm/java
  • Invoke as /opt/xmlsectool/
  • Modify fetch-xml.shcron jobs to use XmlSecTool to verify signature:
    • Add /opt/shibboleth-idp/credentials/tuakiri-metadata-cert.pem as an additional argument (the certificate to verify signatures with)
    • Prefix the commands with environment variable settings to tell the script where to find XmlSecTool and tell XmlSecTool where to find Java: JAVA_HOME=/usr/lib/jvm/java XMLSECTOOL=/opt/xmlsectool/
    • The final form of the cron jobs is:

      02 */2 * * * JAVA_HOME=/usr/lib/jvm/java XMLSECTOOL=/opt/xmlsectool/ /opt/shibboleth-idp/bin/ /opt/shibboleth-idp/metadata/tuakiri-metadata.xml /opt/shibboleth-idp/credentials/tuakiri-metadata-cert.pem
      02 */2 * * * JAVA_HOME=/usr/lib/jvm/java XMLSECTOOL=/opt/xmlsectool/ /opt/shibboleth-idp/bin/ /opt/shibboleth-idp/conf/tuakiri-attribute-filter.xml /opt/shibboleth-idp/credentials/tuakiri-metadata-cert.pem
  • No labels