Hi guys,
I'm trying to configure auth_memcookie to provide protection for a bunch of mod_wsgi python web applications.
Just trying to get the basic configuration working:
Memcache
Apache auth_memcookie
SP
So I have configured:
1. the SP (to talk to a remote IDP)
2. memcache (and auth_memcookie - built from source)
3. auth_memcookie (apache configuration)
4. auth_memcookie (simplesamlphp configuration)
What I am seeing is this:
In the apache error logs I see 64 identical entries of:
In the simplesamlphp logs I see 64 identical entries of:
Jul 06 17:15:22 simplesamlphp DEBUG [45aa2026f2] Session: Valid session found with 'default-sp'.
Jul 06 17:15:22 simplesamlphp DEBUG [45aa2026f2] Session: Valid session found with 'default-sp'.
Jul 06 17:15:22 simplesamlphp DEBUG [45aa2026f2] Session: Valid session found with 'default-sp'.
...
So it looks like simplesamlphp is doing it's job properly (both the SP and the IDP), it seems that auth_memcookie has no idea of the authenticated session (and keeps redirecting back to the login handler).
Any help would be greatly appreciated!
Kind Regards,
Gavin
Here are some of my config files:
(Apache config - note the Auth_memCookie_Memcached_AddrPort option seems to have changed recently):
LoadModule mod_auth_memcookie_module /usr/lib/apache2/modules/mod_auth_memcookie.so
LoadModule authz_groupfile_module /usr/lib/apache2/modules/mod_authz_groupfile.so
LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so
<IfModule mod_auth_memcookie.c>
<Location />
# This is a list of memcache servers which Auth MemCookie
# should use. It is a ','-separated list of
# host:port-pairs.
# Note that this list must list the same servers as the
# 'authmemcookie.servers'-option in config.php in the
# configuration for simpleSAMLphp.
Auth_memCookie_CookieName myauthcookie
# This must be set to 'on' to enable Auth MemCookie for
# this directory.
Auth_memCookie_Authoritative on
# This adjusts the maximum number of data elements in the
# session data. The default is 10, which can be to low.
Auth_memCookie_SessionTableSize "100"
# These two commands are required to enable access control
# in Apache.
AuthType Cookie
AuthName "My Login"
# This command causes apache to redirect to the given
# URL when we receive a '401 Authorization Required'
# error. We redirect to "/simplesaml/authmemcookie.php",
# which initializes a login to the IdP.
ErrorDocument 401 "/simplesaml/authmemcookie.php"
</Location>
</IfModule>
# to protect juste user authentification
<Location "/myprotectedurl">
require valid-user
</Location>
# to protect acces to user in group1
<Location "/myprotectedurlgroup1">
require group group1
</Location>
(Simplesamlphp config):
<?php
/**
* This is the configuration file for the Auth MemCookie example.
*/
$config = array(
/*
* The authentication source that should be used.
*
* This must be one of the authentication sources configured in config/authsources.php.
*/
'authsource' => 'default-sp',
/*
* This is the name of the cookie we should save the session id in. The value of this option must match the
* Auth_memCookie_CookieName option in the Auth MemCookie configuration. The default value is 'AuthMemCookie'.
*
* Default:
* 'cookiename' => 'AuthMemCookie',
*/
'cookiename' => 'myauthcookie',
/*
* This option specifies the name of the attribute which contains the username of the user. It must be set to
* a valid attribute name.
*
* Examples:
* 'username' => 'uid', // LDAP attribute for user id.
* 'username' => 'mail', // LDAP attribute for email address.
*
* Default:
* No default value.
*/
'username' => 'uid',
/*
* This option specifies the name of the attribute which contains the groups of the user. Set this option to
* NULL if you don't want to include any groups.
*
* Example:
* 'groups' => 'edupersonaffiliation',
*
* Default:
* 'groups' => NULL,
*/
'groups' => 'isMemberOf',
/*
* This option contains the hostnames or IP addresses of the memcache servers where we should store the
* authentication information. Separator is a comma. This option should match the address part of the
* Auth_memCookie_Memcached_AddrPort option in the Auth MemCookie configuration.
*
* Examples:
* 'memcache.host' => '192.168.93.52',
*
* Default:
* 'memcache.host' => '127.0.0.1',
*/
'memcache.host' => '127.0.0.1',
/*
* This option contains the port number of the memcache server where we should store the
* authentication information. This option should match the port part of the
* Auth_memCookie_Memcached_AddrPort option in the Auth MemCookie configuration.
*
* Default:
* 'memcache.port' => 11211,
*/
'memcache.port' => 11211
);