Hi, all.

I've been following the #apache channel on freenode, and it seemed to me that 
a lot of people trying to configure apache have trouble with mod_access 
configurations. So it occurred to me that it would be easier for them if 
mod_access produced more informative logs, identifying the filename and line 
number of the directive which caused the denial (including in .htaccess 
files).

The patch here: <http://drbacchus.com/files/access_logging_patch.txt> for 
2.0.49 creates logs that look like this:

[Fri May 28 22:19:16 2004] [notice] Apache/2.0.49 (Unix) configured -- 
resuming
normal operations
[Fri May 28 22:19:24 2004] [error] [client 192.168.1.33] client denied by 
order directive at line 362 of /opt/apache2/conf/httpd.conf for:
/opt/apache2/htdocs/bar
[Fri May 28 22:19:33 2004] [error] [client 192.168.1.33] client denied by deny
directive at line 2 of /opt/apache2/htdocs/foo/.htaccess for: /opt/apache2/
htdocs/foo
[Fri May 28 22:19:45 2004] [error] [client 192.168.1.33] client denied by deny
directive at line 2 of /opt/apache2/htdocs/foo/.htaccess for: /opt/apache2/
htdocs/foo/file
[Fri May 28 22:19:54 2004] [error] [client 192.168.1.33] client denied by deny
directive at line 411 of /opt/apache2/conf/httpd.conf for: /opt/apache2/
htdocs/foo/.htaccess

There should not be much performance impact from this patch -- the only thing 
it does is copy a filepath (limited to a maximum of 80 characters) into 
mod_access's config for each mod_access directive. Of course, those 80 
characters will add up in a big complex config file; but I figured it would 
not be likely that it would be used on a production server. Probably the best 
thing would be to have both mod_access and the patched mod_access as loadable 
modules, so you could enable or disable by changing the LoadModule line.

I hope this helps someone (and thanks to DrBacchus for hosting the patch and 
providing the kick to do it.)

Rici Lake

Reply via email to