5

How can I find out if mod_security is installed on my apache server? I would also like to learn its version.

I'm having some upload issues and I tried to disable mod_security using .htaccess. But that started producing 500 internal server errors.

I read somewhere that depending on my mod_security version I might not be able to disable it using .htaccess. So I would like to understand if I have mod_security installed and what version it is.

I'm on a centos 5 box.

Thanks!

UPDATE -1 xxxxxxxxxxxxx

Does the below output mean I do not have mod_security installed?

[root@u11 htdocs]# httpd -l

Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
Haluk
  • 903
  • 2
  • 15
  • 20

2 Answers2

4

No - the output listed above just describes the pre-compiled in modules.

The presence of the mod_so.c entry however means that Apache is capable of dynamically loading additional modules.

If you have access to the central configuration you could just go look at this and check to see if there's a line like:

LoadModule security_module modules/mod_security.so

If there is then you have mod_security loaded - NOTE: this could be within an included configuration file as well.

Assuming your configuration is located in /etc/httpd - you could run the following to find if the config is present:

grep -ir security_module /etc/httpd

(Replace /etc/httpd with the central configuration directory).

If you don't have access to the server config you could use an <IfModule mod_security.c> statement within your .htaccess to see if it's enabled:

<IfModule mod_security.c>

... Perform some kind of redirect or re-writing in here ...

</IfModule>

Hope this helps.

DaveG
  • 1,077
  • 6
  • 13
0

In some environments mod_security is not required because firewall policy is implemented via hardware; using Debian you should find information about this module typing

grep -ir security_module /etc/apache2/mods-enabled/mod-security.conf

If this file is not present, could be NOT included by hosting provider so check situation also with them.

squillman
  • 37,618
  • 10
  • 90
  • 145