[Zope] Re: Zope User in Apache Logs

Josef Meile jmeile at hotmail.com
Thu May 18 11:14:34 EDT 2006


>>>  > If your Zope auth solution can put a header in the http response, 
>>> then > you can use a custom apache logging directive to put this in your
>>>  > Apache log in place of what it thinks the username is.
>>> I put this on the "log" method of the medusa/http_server.py file:
>>> self.response.setHeader('remote_user',name)
> 
> As you've found out, this is the wrong level to do this ;-)
Yes, I must confess I didn't read your suggestion the first time.

>>> and set my apache access log like this:
>>> CustomLog /home/apache/httpd/logs/access_log combined
>>>
>>> [Some Apache config comes here]...
 >>> There you see the %l and %u directives, which are the "Remote
 >>> logname" and the "Remote user".
> 
> Yeah, these aren't the ones you want to be using ;-)
> 
>>> But apache still doesn't get the zope authenticated user. So, Chris, 
>>> do you remember what header you set, where, and which method you used?
>> Ok, Answering to this question. I guess I had to set the header inside 
>> the authenticate method of the BasicUserFolder class. Here is what I did:
>>
>> def authenticate(self, name, password, request):
 >>
 >> [Some code comes here]...
>>      request.response.setHeader('remote-user',logUser)
> 
> Well, I wouldn't use that header, try using X-MyUserName instead, and 
> then in the apache config you'd use %{X-MyUserName}o
Thanks Chris, that was exactly what I was looking for. Now Apache logs
the correct authenticated user.

Regards
Josef



More information about the Zope mailing list