2

Update I think we've solved this; the problem appears to have been a result of the /modsec_storage directory having an incorrect value for its SELinux context type.

However, we're still not sure, because although after I changed the SELinux context type value, Apache was able to create files in that directory for the global and ip collections (global.dir/global.pag and ip.dir/ip.pag), the new files still have zero bytes.

I'm new to ModSecurity and am not sure if the files are empty because something is wrong with the configuration or if ModSecurity has simply determined it doesn't need to store IP addresses persistently after each transaction ends.

Anyone able to offer guidance here?


I've recently installed ModSecurity (v2.5.12 / CRS v2.0.8) on our production server, and everything works great, except for these errors that it keeps writing to the Apache error log:

Failed to access DBM file "/modsec_storage/global": Permission denied [hostname "www.internationalstudent.com"] [uri "/includes/soc_bookmarks/images/delicious.png"] [unique_id "LZ6jc38AAAEAAFO6408AAABO"]
Failed to access DBM file "/modsec_storage/ip": Permission denied [hostname "www.internationalstudent.com"] [uri "/includes/soc_bookmarks/images/delicious.png"] [unique_id "LZ6jc38AAAEAAFO6408AAABO"]

After following the instructions for file permission settings in the ModSecurity handbook by Ivan Ristic, with no success, I created a /modsec_storage directory, set the owner & group to apache, and set the permissions for the directory recursively to 777.

However, ModSecurity is still reporting the same permission errors, so I am stumped. Can anyone tell me how to fix this?

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
tommytwoeyes
  • 155
  • 1
  • 7

1 Answers1

1

Try setenforce 0

It's very possible it's an SELinux issue in which case I believe you may need to assign an httpd context to the folder. If the above fixes it you might try:

chcon -R system_u:object_r:httpd_sys_content_t /modsec_storage

Is the folder modesec_storage under your root folder?

Joshua Enfield
  • 3,404
  • 8
  • 41
  • 58