Shibplone
Shibplone
Shibplone
Alan Brenner
http://tid.ithaka.org/shibplone.pdf
Overview
• Zope and Plone
• Zope as the Application Server
• Plone as the Content Management System running in Zope
• End User Login Sequence Overview
• Apache Configuration
• Apache as the Shibboleth Service Provider
• Getting data from Apache to Zope
• AutoUserMakerPASPlugin
• Overview and Installation
• Configuration options
• Python Source
• ShibbolethLogin
• Installation, Configuration and Python Source
• ShibbolethPermissions
• Installation and Configuration
• Users grant permissions to their stuff
• Python Source
Who is Ithaka and Who am I?
• “Ithaka is an independent not-for-profit organization with a mission to
accelerate the productive uses of information technologies for the
benefit of higher education worldwide.”
• Research, Strategic Services, Shared Services (IT, HR, etc.)
• Affiliated with JSTOR and ARTstor
• “Incubating” Aluka, NITLE and Portico
• http://www.ithaka.org/
3
Zope and Plone
• Python
• Both Zope and Plone are (mostly) written in Python, with a bit of C in
Zope for performance in it’s built-in database
• http://www.python.org/
• Zope
• “An open source application server for building content management
systems, intranets, portals and custom applications”
• http://www.zope.org/
• Plone
• “A ready-to-run content management system”
• Like Zope, it is extensible with ‘Products’ and Python modules
• http://plone.org/
• Currently at 3.0. The Shibboleth integration code is still for Plone 2.5.
4
Initial Login Sequence
5
Plone: Login Sequence #1
6
Plone: Login Sequence #2
7
Login Sequence #3
8
Plone: Login Sequence #4
9
Apache Configuration
• Install mod_shib
• mod_php is helpful during setup.
• Create an index.php like:
<html><head><title>env</title></head><body><?php phpinfo(); ?></body></html>
• This shows all of the values that are (or are not) getting set by mod_shib
• Configure Apache to proxy HTTP connections for Zope
• Configure Apache to rewrite HTTPS connections for Zope
10
Apache: httpd.conf and modules
• This can go in the httpd.conf:
11
Apache: HTTP Proxy
• (Almost) Minimal configuration:
<VirtualHost 192.168.191.1:80>
ServerName alan.ithaka.org
ServerAdmin alan.brenner@ithaka.org
DocumentRoot /usr/local/apache-httpd-2.2.4/htdocs
ProxyRequests Off
ProxyPass /index.php !
ProxyPass / http://127.0.0.1:8253/VirtualHostBase/http/alan.ithaka.org:
80/test/VirtualHostRoot/
</VirtualHost>
• This configures Apache to get pages from localhost port 8253.
• This tells Zope that pages it returns have http://alan.ithaka.org/ as the
base URL.
• It also tells Zope to fetch all pages from its /test folder (my Plone install).
• You might want to add Apache caching, other non-proxied URLs, etc.
• This is standard Apache in front of Zope, as documented at Plone’s
web site.
12
Apache: HTTPS Rewriting 1
• Apache listens on 443
<VirtualHost 192.168.191.1:443>
• Tell Apache to Proxy everything
• Sort of, since we don’t tell Apache to proxy
• This gets most of the HTTP Headers passed through to Zope
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
13
Apache: HTTPS Rewriting 2
• Tell Apache not to rewrite these (my IdP is on the same Apache)
RewriteCond %{REQUEST_URI} !^/(shibboleth-(sp|idp)|Shibboleth.sso|SAML)
• Tell Apache to rewrite everything else to Zope
• Mostly like the HTTP proxy.
• Add $1 to the end of the Zope URL to pass the rest of the URL.
RewriteRule ^/(.*) http://127.0.0.1:8253/VirtualHostBase/https/
alan.ithaka.org:443/test/VirtualHostRoot/$1 [L,P]
require shibboleth
</Location>
</VirtualHost>
14
AutoUserMakerPASPlugin Overview
• Overview
• PAS is the “Pluggable Authentication System” added to Plone 2.5
• AutoUserMakerPASPlugin allows Zope to delegate authentication
• Works with any authentication system available to Apache, not just Shibboleth
• Can use values from Apache for authorization (to set Plone roles) as well
• Origin
• Originally a Zope/Plone Product called apachepas by Rocky Burt on behalf of Zest
Software (http://zestsoftware.nl/)
• Updated and turned in to AutoMemberMakerPASPlugin by Erik Rose of the WebLion
project at Penn State (http://weblion.psu.edu/)
• Installation
• Standard Plone Product install (same for ShibbolethLogin and ShibbolethPermissions)
• Unzip in the Plone $INSTANCE_HOME/Products directory
• Restart Zope
• Go to the Add/Remove Products page, click the checkbox by the product
name and the install button
15
Plone: Installing the Products
16
Plone: After Installing the Products
17
AutoUserMakerPASPlugin Configuration
• Configured through the “Zope Management Interface”, ZMI
• Configure domain name removal (if needed--probably should change)
• The default is to remove all domain names from user ID’s
• This can map multiple people to the same Plone account
(abrenner@ithaka.org and abrenner@internet2.edu both are abrenner to Plone)
• Configure the HTTP headers to look for (if needed)
• Configure the headers to user for authorization (if needed)
• If you add headers to the the User Mappings field, the AuthZ tab will allow
you to assign Plone roles and groups, and to map existing Plone users, to
header values.
• If you add headers to the User Sharing fields, users can grant permissions
to people who have not ever logged in (limited to what they have
permissions on). AutoUserMakerPASPlugin will assign the granted
permissions to a new user, immediately after it creates the user.
18
ZMI: acl_users
The AutoUserMakerPASPlugin
and other entries are links to
the configuration pages.
19
ZMI: AutoUserMakerPASPlugin 1
20
ZMI: AutoUserMakerPASPlugin 1 Example
I recommend a
configuration like this,
unless you absolutely
know you will not have
user ID conflicts.
21
ZMI: AutoUserMakerPASPlugin 2
22
Plone: Display of the User Setup Headers
AutoUserMakerPASPlugin fills
these values in, when the
User Setup Headers have data.
As mentioned in the login
sequence, Plone shows the
“Full Name” instead of the
userid when this has data.
23
ZMI: AutoUserMakerPASPlugin 3
24
ZMI: AutoUserMakerPASPlugin 3 Example
25
ZMI: AutoUserMakerPASPlugin AuthZ 1
26
ZMI: AutoUserMakerPASPlugin AuthZ 2
29
ShibbolethLogin
• Installing this modifies the default login_form, adding a section that
show the configured Identity Providers.
• This only works when you haven’t modified the default login_form.
• You can use the tal:block in a customized form:
<tal:block tal:define="wayf here/acl_users/ShibbolethLogin">
<p i18n:translate="description_external_login"
tal:repeat="idp python:wayf.getWayf(came_from)">
Log in with a <a href="" tal:attributes="href python:idp[1]"><span
tal:content="python: idp[0]">PROVIDER</span></a> user id.
</p>
</tal:block>
30
ZMI: ShibbolethLogin Configuration
31
ShibbolethLogin Python
• ShibbolethLogin/Extensions/Install.py
• Instantiates an instance in the acl_users folder
• Gets the default login_form, modifies it to add the TAL block, and saves
the updated form in portal_skins/custom
• Installs a custom logout_form that redirects users back to the HTTP site.
• ShibbolethLogin/redirector.py
• Defines a ShibbolethLogin class
• retrieves configuration values for the login and logout forms
• Defines a ShibbolethLoginHandler class
• handles the ZMI configuration forms
32
ShibbolethPermissions
• Installing this modifies the default Plone sharing page, adding a
section for granting permissions to new users based on incoming
attributes.
• Already existing Plone users, regardless of how they authenticate, are
handled by the existing Plone sharing mechanism.
• Site administrators configure the fields available to users in the
AutoUserMakerPASPlugin ZMI page.
• The ShibbolethPermissions ZMI page shows all existing grants.
• The administrator can delete them on this page.
• This page has links to each page that has user sharing; edit them there.
• Users grant permissions by clicking on the “sharing” tab of any page
that they have permissions on.
• This will probably require some user education.
• Fields are regular expressions, which includes simple strings.
• Some fields can have complex values like LDAP distinguishing names.
• Fields that don’t have values match everybody.
• There is no simple match everybody except syntax. 33
Plone: User Sharing 1
34
Plone: User Sharing 2
35
Plone: User Sharing 3
36
ZMI: ShibbolethPermissions
37
ShibbolethPermissions Python
• ShibbolethPermissions/Extensions/Install.py
• Instantiates an instance in the acl_users folder
• Gets the default folder_localrole_form, inserts the TAL based Shibboleth
forms, and saves the updated form in portal_skins/custom
• Installs several small functions that get called by the forms to get and set
the configuration
• ShibbolethPermissions/permissions.py
• Defines the ShibbolethPermissions class
• Handles the storage of the user’s permission sharing (CRUD)
• Defines the ShibbolethPermissionsHandler class
• Handles the ZMI forms
38
Summary
• The software is available at:
• http://www.python.org/
• http://www.zope.org/
• http://plone.org/
• The Plone site has complete python/zope/plone installers for Windows, OS X and SuSE
Linux, with a “Unified Installer” for other Linuxes, BSDs and Solaris.
• Installing by hand is just the common ./configure; make; make install process for
Zope, running mkzopeinstance to create a directory tree and unzipping Plone in it.
• http://tid.ithaka.org/software/
• AutoUserMakerPASPlugin
• ShibbolethLogin
• ShibbolethPermissions
39