Bug 1015268 - configtest does not fail if RewriteLog directive points to non-existent directory
configtest does not fail if RewriteLog directive points to non-existent direc...
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: httpd (Show other bugs)
x86_64 Linux
unspecified Severity low
: rc
: ---
Assigned To: Web Stack Team
BaseOS QE - Apps
Depends On:
  Show dependency treegraph
Reported: 2013-10-03 14:52 EDT by stein
Modified: 2014-10-27 12:09 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-10-27 12:09:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description stein 2013-10-03 14:52:07 EDT
Description of problem:
'service httpd configtest' returns successfully with 'Syntax OK' if the mod_rewrite RewriteLog directive is used and points to a directory that does not exist.  However, Apache fails to start (service httpd start/restart) with this error in the configuration and logs "[error] (2)No such file or directory: mod_rewrite: could not open RewriteLog file /invalid/directory/rewrite.log"

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Add a RewriteLog directive referencing an invalid directory, to an Apache configuration file:

 RewriteLog "/invalid/directory/rewrite.log"

2. Run 'service httpd configtest'.  It will not detect an error and returns 'Syntax OK'
3. Restart Apache, 'service httpd restart'

4. Apache fails to start and logs a "No such file or directory" error in the error_log

Actual results:
'service httpd configtest' returns 'Syntax OK'

Expected results:
'service httpd configtest' should return an error

Additional info:
Comment 1 Joe Orton 2013-10-03 16:15:59 EDT
Thanks for contacting us.

"configtest" aims to check whether the configuration file is syntactically valid, and does not guarantee the server will start up.

I am generally reluctant to try adding such validation features because it is impossible in many cases to guard against false positives.  Is there a particular problem you are trying to solve here?
Comment 2 stein 2013-10-03 17:13:39 EDT
I am using puppet to automate the management of some Apache config files.  When a config file changes, puppet is set up to restart Apache, but I also run a configtest first to make sure Apache will restart OK.

/sbin/service httpd configtest && /sbin/service httpd graceful

I expect configtest to catch any errors that would cause Apache to fail to start.

Another way of looking at this problem is whether mod_rewrite should cause Apache to fail if it encounters an invalid path in a RewriteLog directive.  Could mod_rewrite log the error, but allow Apache to continue to load?
Comment 5 Joe Orton 2014-10-27 12:09:12 EDT
Looking again: there's actually not a good place to hook in such a feature in 2.2 unfortunately. 

In 2.4 there is no RewriteLog directive any more, since we have fine-grained error log control.  But we do have a new hook which allows more sophisticated validation of directives, and ErrorLog does have a specific check for directory existence.

So probably an unsatisfactory answer, sorry, but "upgrade to RHEL 7" is probably the best answer we have here.

Note You need to log in before you can comment on or make changes to this bug.