Wednesday, September 19, 2012

Installing shibboleth on linux

Installing shibboleth on RHEL

First start with this reference:

They will tell you to use "yum" to install shibboleth as follows:

$ yum install shibboleth.x86_64
But before we can do that, we need to know what version of Red Hat Linux is being used. To do that use the following command:

lsb_release -i -r

If the command is not recognized, you'll need to install the tool:
# yum install redhat-lsb

My version was 5. We will need to know this version to know which shibboleth repo to use

Now follow this link to see the list of available repos:

Next we need to add the shibboleth repo so that 'yum' knows where to find it. To do that create a new file called shibboleth.repo under the folder /etc/yum.repos.d

name=Shibboleth Repo


Now we can execute the yum install command

$ yum install shibboleth.x86_64

When I did this the first time, I got an error about a missing KEY. To ignore key verification execute the following command:

$ yum install --nogpgcheck shibboleth.x86_64

The shibboleth installation directory will be found in /etc/shibboleth

Here I assume you've already installed Apache web server (HTTPD)
To restart apache:
/etc/init.d/httpd restart

Then to startup shibboleth
/sbin/service shibd start

Now to test the connection, in your browser, visit the following URL:

You should see this error message:

The system encountered an error at Thu Sep 20 15:47:58 2012

To report this problem, please contact the site administrator at root@localhost.

Please include the following message in any email:

shibsp::ConfigurationException at (http://your.server/secure)

No MetadataProvider available.

This is fine because we know you haven't fully configured shibboleth yet, but at least we know shibboleth is running and is able to accept web requests


According to the shibboleth wiki, they do not officially support SELinux and it is well known that shibboleth will not work with SELinux turned on. To set SELinux into permissive mode run the following commands

[root@webserver shibboleth]# getenforce
[root@webserver shibboleth]# setenforce 0
[root@webserver shibboleth]# getenforce

Reference: SELinux and Shibboleth

Now let's get the shibboleth URL identified to enable webservices. To do that add the following to the file /etc/httpd/conf.d/shib.conf
<Location /Shibboleth.sso>
    SetHandler shib
<Location /c/portal/login>
  AuthType shibboleth
#  ShibUseHeaders On
  ShibRequestSetting requireSession 1
  require valid-user 

The ShibUseHeaders parameter is required to copy the session attributes into the request headers. The request headers will contain details about who's logging in to your web application.

Update (22/12/2015):  The use of ShibUseHeaders is not recommended due to some potential security threats. I've updated the above configuration to have ShibUseHeaders commented out. Instead it is advisable to use AJP and have shibboleth pass in the attributes as environment variables in tomcat. Reference: Avoid ShibUseHeaders

There are many online examples on how to configure apache to proxy requests to tomcat via AJP. Here's one reference: Apache and Tomcat AJP configuration 

Since I am using Liferay portal server, I protect the login url '/c/portal/login'

Again, restart httpd
/etc/init.d/httpd restart

To test that the shibboleth web service is running, in your browser visith the following URL:

You should get back a response to download a Metadata file
You will use this Metadata file to now configure and test a live Shibboleth connection by following instructions here:

Configuration attribute-map.xml

To map shibboleth attributes to an alias you can configure the /etc/shibboleth/attribute-map.xml file.
For my configuration I had uncomment the list of attributes at the bottom:

    <Attribute name="urn:oid:" id="cn"/>
    <Attribute name="urn:oid:" id="sn"/>
    <Attribute name="urn:oid:" id="givenName"/>
    <Attribute name="urn:oid:2.16.840.1.113730.3.1.241" id="displayName"/>
    <Attribute name="urn:oid:0.9.2342.19200300.100.1.3" id="mail"/>
    <Attribute name="urn:oid:" id="telephoneNumber"/>
    <Attribute name="urn:oid:" id="title"/>
    <Attribute name="urn:oid:" id="initials"/>
    <Attribute name="urn:oid:" id="description"/>
    <Attribute name="urn:oid:2.16.840.1.113730.3.1.1" id="carLicense"/>
    <Attribute name="urn:oid:2.16.840.1.113730.3.1.2" id="departmentNumber"/>
    <Attribute name="urn:oid:2.16.840.1.113730.3.1.3" id="employeeNumber"/>
    <Attribute name="urn:oid:2.16.840.1.113730.3.1.4" id="employeeType"/>
    <Attribute name="urn:oid:2.16.840.1.113730.3.1.39" id="preferredLanguage"/>
    <Attribute name="urn:oid:0.9.2342.19200300.100.1.10" id="manager"/>
    <Attribute name="urn:oid:" id="seeAlso"/>
    <Attribute name="urn:oid:" id="facsimileTelephoneNumber"/>
    <Attribute name="urn:oid:" id="street"/>
    <Attribute name="urn:oid:" id="postOfficeBox"/>
    <Attribute name="urn:oid:" id="postalCode"/>
    <Attribute name="urn:oid:" id="st"/>
    <Attribute name="urn:oid:" id="l"/>
    <Attribute name="urn:oid:" id="o"/>
    <Attribute name="urn:oid:" id="ou"/>
    <Attribute name="urn:oid:" id="businessCategory"/>
    <Attribute name="urn:oid:" id="physicalDeliveryOfficeName"/>

The attribute I used to identify my users is by their email address. So I needed to map

The 'mail' attribute will then be included in the request headers which will be used to log the user into my webapp.

Configuring shibboleth2.xml

  • For configuration modify the /etc/shibboleth/shibboleth2.xml file
  • Look for the root element ApplicationDefaults and assign the entityID which must match what was assigned to you by the federation authority that you've registered with. I registered with the following:  
  • For AJP configurations we'll need to set the AJP prefix as attributePrefix="AJP_" as follows:
="https://your_domain/shibboleth.sso/shibboleth" attributePrefix="AJP_" REMOTE_USER="eppn persistent-id targeted-id">
  • Once you've submitted your request to register, then they will respond to grant you access. They'll provide you some information on how to manage your server as a 'Service Provider' and choose some attributes you want to expose. 
  • In the Sessions element, set handlerSSL to true and cookieProps to https as follows:

        <Sessions lifetime="28800" timeout="3600" relayState="ss:mem"
                  checkAddress="false" handlerSSL="true" cookieProps="https">
  • Look for the SSO element and remove the entityID attribute and set the discoveryURL as follows:

     discoveryProtocol="SAMLDS" discoveryURL="">

  • Look for the MetadataProvider element and edit the uri attribute

        <MetadataProvider type="XML" uri=""
              backingFilePath="metadata.aaf.signed.complete.xml" reloadInterval="7200">
            <MetadataFilter type="RequireValidUntil" maxValidityInterval="2419200"/>


  • Look for the CredentialResolver element and make sure it looks like the following
<CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>

This is what will be used decode/encode communication between the service provider (you) and the IdP (Identity provider).
When registering with the federation authority you be asked for a certificate. Use the SSL certificate provided by your authority as the sp-cert.pem file, and use your private key as sp-key.pem for decoding.

If you encounter errors with shibboleth, you can find error logs at


Other intersting ways to configure shibboleth:

Configuring Apache mod_proxy_ajp with tomcat:


No comments:

Post a Comment