[mod_python] req.user and SSL?

Bud P. Bruegger bud at comune.grosseto.it
Fri Feb 17 09:05:56 EST 2006


Hello everyone,

I have a problem reading req.user when using mod-SSL with the 
+FakeBasicAuth option and setting SSLUser:  req.user always seems to be 
undefined.  Also, neither Authen nor Authz handers run.   Any help would be 
highly appreciated!

Here some details of what I try:

#-- Apache 2 conf ------------------------------
NameVirtualHost *:443
<VirtualHost *:443>
         LogLevel debug
         SSLEngine on
         SSLCertificateFile /etc/apache2/ssl/apache.pem
         SSLCACertificateFile /etc/apache2/ssl/caCerts.pem
         SSLVerifyDepth 3
         SSLVerifyClient require
         #SSLUserName SSL_CLIENT_S_DN_X509
         DocumentRoot /var/www/

         <Directory /var/www/sc>
             SSLRequireSSL
             SSLOptions +StdEnvVars +FakeBasicAuth
             AuthType Basic
             SetHandler mod_python
             PythonHandler test
             PythonAccessHandler test
             PythonAuthenHandler test
             PythonAuthzHandler test
             PythonFixupHandler test
             PythonDebug On
         </Directory>
</VirtualHost>

#--- test.py ----------------------------------------------------
from mod_python import apache

def genHandler(req, handlerName):
     req.add_common_vars()
     req.get_basic_auth_pw()
     user = req.user
     dn = req.subprocess_env.get('SSL_CLIENT_S_DN', req.subprocess_env.keys())
     userLabel = 'XXX-%s-user' % handlerName
     dnLabel = 'XXX-%s-dn' % handlerName
     req.subprocess_env[userLabel]=str(user)
     req.subprocess_env[dnLabel]=str(dn)
     return apache.OK


def accesshandler(req):
     return genHandler(req, 'access')

def authenhandler(req):
     return genHandler(req, 'authen')

def authzhandler(req):
     return genHandler(req, 'authz')

def fixuphandler(req):
     return genHandler(req, 'fixup')
#------------------------------------------------------

many thanks in advance

-b



-------------------------------------------------------------------------------------------------
Ing. Bud P. Bruegger, Ph.D.                 +39-0564-488577 
(voice),  -21139 (fax)
Servizio Elaborazione Dati                    e-mail:  bud at comune.grosseto.it
Comune di Grosseto                            jabber:  bud at jabber.no
Via Ginori, 
43                                      http://www.comune.grosseto.it/cie/
58100 Grosseto (Tuscany, 
Italy)           http://www.comune.grosseto.it/interopEID/ 



More information about the Mod_python mailing list