Jump to content

Modsecurity/Mod_Rewrite and FilesMatch apache directive


oka

Recommended Posts

Hi all.

 

I had setup modsecurity with prestashop with mod_rewrite for friendly url.

 

Now what i need is to set a <FilesMatch> directive in apache for catch a variable in authentication.php so i write this directive :

 

<FilesMatch "authentication\.php">
SecRule ARGS:email [email protected]
</FilesMatch>

 

But it is not matching anything

 

Then i set up this:

 

<FilesMatch "AuthController\.php">
SecRule ARGS:email [email protected]
</FilesMatch>

 

and does not work, so i think my mod_rewrite brokes the hability to FilesMatch a script.

 

The question is how to match a script in apache with mod_rewrite (i think)?

 

Regards.

Link to comment
Share on other sites

Hi oka,

 

mod_rewrite and mod_security are 2 different modules.

 

mod_rewrite main purpose is to rewrite URLS to a more user friendly style. The fact that it uses regular expressions to match a rewrite can be used as a first level of defense. But its main purpose is to rewrite :rolleyes:

 

mod_security on the other hand has been evolved to a very powerful web application firewall. So, in your case you would need to read and experiment with it. A word of warning, never experiment with mod_security in a production environment.

Link to comment
Share on other sites

Hi gkontos.

 

I know what is modsec and rewrite ;)

 

The problem is if i setup prestashop wihtout rewrite i can do this :

<FilesMatch "authentication\.php">
SecRule ARGS:email [email protected]
</FilesMatch>

 

And with prestashop with mod_rewrite enabled i can't do it.

 

Regards.

 

Ok then I apologize for the lesson -_-

 

Depending on the languages you use, how about something like that:

 

FilesMatch ^en/authentication$

 

Cheers,

 

George

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...