Twiki and shibboleth

Jehan Procaccia -

29 juin 2006

Table des matières

1  Introduction

This is an howto enable shibboleth access control to tiwiki.This is the step by step procedure followed on an Fedora Core 4 system with TWiki-4.0.2.

2  References

3  Packages Dependancies

$ yum install mod_perl

$ yum install perl-Config-IniFiles perl-Algorithm-Diff perl-Text-Diff perl-CGI-Session perl-Digest-SHA1 patch rcs diff

 Package                 Arch       Version          Repository        Size
 patch                   i386       2.5.4-24         base               62 k
 perl-Algorithm-Diff     noarch     1.1901-1.2.fc4.rf  dries              46 k
 perl-CGI-Session        noarch     4.09-1.fc4.rf    dries             112 k
 perl-Config-IniFiles    noarch     2.39-3.fc4       extras             45 k
 perl-Digest-SHA1        i386       2.10-1           base               48 k
 perl-Text-Diff          noarch     0.35-2.fc4       extras             33 k
 rcs                     i386       5.7-28           base              299 k
 diffutils               i386       2.8.1-15         base              208 k
Installing for dependencies:
 perl-DBD-Pg             i386       1.41-2           base              102 k
 perl-FreezeThaw         noarch     0.43-2           extras             16 k
 postgresql-libs         i386       8.0.8-1.FC4.1    updates-released  184 k

4  Twiki installation

4.1  Untar

[root@xserv /var/www/html]
$ mkdir twiki ; cd twiki/
[root@xserv /var/www/html/twiki]
$ tar xvfz /root/TWiki-4.0.2.tgz

4.2  Owner of twiki tree

should be the apache user
[root@xserv /var/www/html]
$ chown -R apache twiki

5  Twiki Configuration

5.1  Conf file

Prepare a configuration file from the sample given in the tarball
[root@xserv /var/www/html/twiki/lib]
$ cp LocalSite.cfg.txt LocalSite.cfg

5.2  Paths

Adjust path to our local installation in /var/www/html/twiki:
[root@xserv /var/www/html/twiki/lib]
$ vi LocalSite.cfg
replace path, vi command:
3 substitutions on 3 lines

5.3  Apache configuration

Copy an enable (.conf) the twiki sample apache configuration file:
[root@xserv /etc/httpd/conf.d]
$ cp /var/www/html/twiki/twiki_httpd_conf.txt ./twiki_httpd.conf

5.4  Paths

Adjust path to our local installation in /var/www/html/twiki:

10 substitutions on 10 lines

5.5  Restart apache

restart apache apache so that it take s care of the new twiki conf file:
$ /etc/init.d/httpd restart
Arrêt de httpd :                                           [  OK  ]
Démarrage de httpd :                                       [  OK  ]

6  Adjust confuguration from a browser

6.1  Configure web script

go to:

check warnings an errors, correct them !
If everything seems OK click next.

6.2  configure a password

now we are ask for a ``Enter the configuration password''
click ``set and save''
if you get the following message, it's a mode acces problem to the LocalSite.cfg file:
Failed to open /var/www/html/twiki/lib/LocalSite.cfg for write at /var/www/html/twiki/bin/configure line 1108.

indeed !
[root@xserv /var/www/html/twiki/lib]
$ ls -al LocalSite.cfg
-r--r-----  1 apache root 2123 jun  7 17:25 LocalSite.cfg
[root@xserv /var/www/html/twiki/lib]
$ chmod 640 LocalSite.cfg

6.3  configure confirmation

if everything goes right, the configure script racalls what have been done:
Password changed
Updating configuration
new /var/www/html/twiki/locale
new iso-8859-15
new en
new en-us
5 configuration items changed.
Return to configuration

6.4  Test first install

We can now go to and see our public (twikiguest) twiki !
to set preferences :

7  User auth

go to the doc :

From philip.brusten AT advices :
in {LoginManager} choose TWiki::Client::ApacheLogin

more info: \url{}

The \verb+REMOTE_USER+ might contain some exotic characters that aren't WikiName-conform. Therefore, we need to map this \verb+REMOTE_USER+ (also LoginName) to a WikiName.
{MapUserToWikiName} checked 

When using Shibboleth for authentication, of course you don't need to provide a password at registration.
{PasswordManager} None 

Let the LoginName field appear in the registration form.
{Register}{AllowLoginName} checked 

Enter the configuration password
click save changes
Updating configuration
old none
new TWiki::Client::ApacheLogin
old TWiki::Users::HtPasswdUser
new none
new 1

3 configuration items changed.

Return to configuration

7.0.1  Localization

Updating configuration
old en_US.ISO-8859-1
new fr_FR.ISO-8859-15
old en
new us

2 configuration items changed.

Return to configuration

8  Apache shibboleth twiki config

8.1  Apache configuration

[root@wpublic /etc/httpd/conf.d]
$ tail -20  twiki_httpd.conf

#Make sure the shibboleth module is loaded for the entire application
<Directory "/var/www/html/twiki">
#  AuthType Shibboleth
#  require shibboleth
AuthType shibboleth
ShibRequireSession On
ShibExportAssertion On
require statut permanent

# /bin/logon needs to be secured with authentication
# require valid-user will take care of authentication only
<Files "/var/www/TWiki/bin/logon*">
 AuthType shibboleth
 ShibRequireSession On
 require valid-user

8.2  Map attributes

Here we need to map the uid attribute retrieve from the IDP through LDAP to the REMOTE_USER http env variable, which will eventually be the logged in user !

8.2.1  Resolver.xml on the IDP

resolver.xml defines which attributes should be retrieved from the IDP.
[root@shibidp /usr/local/shibboleth-idp/etc]
$ vim resolver.xml

<AttributeResolver xmlns:xsi="" xmlns="urn:mace:shibboleth:resolver:1.0" xsi:schemaLocation="urn:mace:shibboleth:resolver:1.0 shibboleth-resolver-1.0.xsd">
 <SimpleAttributeDefinition id="urn:mace:dir:attribute-def:uid">
                <DataConnectorDependency requires="get-test"/>

 <JNDIDirectoryDataConnector id="get-test">
                <Search filter="uid=%PRINCIPAL%">
                        <Controls searchScope="SUBTREE_SCOPE" returningObjects="false" />
                <Property name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory" />
                <Property name="java.naming.provider.url" value="ldap://,dc=int-evry,dc=fr" />        <!--    <Property name="" value="ssl" /> -->
        <!--    <Property name="" value="cn=admin,dc=example,dc=edu" /> -->
        <!--    <Property name="" value="examplepw" /> -->

8.2.2  arp on the IDP

On the file we define which attributes we allow to send to Service Providers, so here we need to include the uid attribute .
[root@shibidp /usr/local/shibboleth-idp/etc/arps]
$ vim

<AttributeReleasePolicy xmlns:xsi="" xmlns="urn:mace:shibboleth:arp:1.0" xsi:schemaLocation="urn:mace:shibboleth:arp:1.0 shibboleth-arp-1.0.xsd" >
        <Description>ARP GET</Description>
<Attribute name="urn:mace:dir:attribute-def:uid">
                        <AnyValue release="permit"/>


8.2.3  arp on the IDP

Finally on the SP, we need to define which attribute we get from the IDP on the AAP.xml file. Here the uid attribute is sent in the http headers as the REMOTE_USER environement variable .
[root@wpublic /etc/shibboleth]
$ vim AAP.xml

<AttributeAcceptancePolicy xmlns="urn:mace:shibboleth:1.0">
 <AttributeRule Name="urn:mace:dir:attribute-def:uid" Header="REMOTE_USER" Alias="uid">


8.3  Test it

go to

redirected to the WAYF:

Select state in france on the WAYF map:

redirected to CAS for INT site:

Auth success and attribute maps (status= permanent and REMOTE_USER = uid) so we get access to the service: as the shibboleth logged in user :-) .

Next step, map that logged in user to a twiki user ....

9  Individuals Registration

9.1  Procedure

While going to the root twiki page: you are going through the WAYF (select your region and site for GET users !), the the SSO to get authenticated on your local directory. By doing that you have gone through an authentification process and through a autoristion process as well. Indeed , acces to twiki/bin/view is protect by the apache shibboleth module which restrict acces to GET 'permanent' only users.

9.2  Registration

Now that you are authentificated and authorized to get in twiki, locals twiki acces restriction needs you to get a TWIKIUSERNAME , it will give you also a personnal page. To do that you need once to register. Choose TwikiRegistration

Fill the form

You'll get an email confirmation

10  AddOns

10.1  WYSIWYG twiki

Installed: perl-HTML-Parser.i386 0:3.45-1
Dependency Installed: perl-HTML-Tagset.noarch 0:3.04-1

Ce document a été traduit de LATEX par HEVEA.