|
perry.tew at cibavision.novartis.com
perry.tew at cibavision.novartis.com
Wed Oct 1 16:39:32 EST 2003
Hello,
I'm trying to port a mod_perl handler to mod_python.
The mod_perl handler was based off an Authentication Handler discussed
in Chapter 6 of the "Writing Apache Modules in Perl and C" book by
MacEachern
(page 326 for those who have the book). At any rate, concerning how to
access
environment variables set by mod_ssl, the book states correctly the
following:
"""
The handler then issues a subrequest and retrieves the value of
SSL_CLIENT_DN from
the subrequest's environment table. The subrequest is necessary because
the parsed
certificate fields aren't placed into the table until the fixup stage,
which ordinarily occurs
after the authorization phase.
"""
So, my perl code looks like this:
##########################################
my $subr = $r->lookup_uri($r->uri);
my $env = $subr->subprocess_env;
my $cn = $env->{'SSL_CLIENT_S_DN_CN'};
my $dn = $env->{'SSL_CLIENT_S_DN'};
##########################################
I'm trying to do the same thing in python with this:
############################################
req.internal_redirect(req.unparsed_uri)
req.add_common_vars()
for k, v in req.subprocess_env.items():
msg = k + "=" + v
apache.log_error( msg , apache.APLOG_NOTICE )
############################################
However, the SSL vars aren't in the env table when my handler dumps the
items to the log.
The handler is being called and it dumps a lot of
env variables to the log, but no SSL vars. The PythonAuthenHandler that
contains the code above
protects the printenv script, which I call to test the handlers. The
printenv script is displaying all
of the SSL env vars correctly, so I know I have the mod_ssl directives
correct.
Does anyone see an error in what I'm doing wrong (or need to do)? This is
my first attempt as writing an AuthenHandler
and I would greatly appreciate any insight.
Thanks,
Perry Tew
|