Disabling mod_security for a specification app and ip

General Discussion of atomic repo and development projects.

Ask for help here with anything else not covered by other forums.
rnolds
Forum User
Forum User
Posts: 25
Joined: Tue Sep 16, 2008 9:59 am

Disabling mod_security for a specification app and ip

Unread post by rnolds »

Hello,

I have a problem with MovableType and one of our in house workflow applicaions (which is only accessible by authorised users). triggering mod_security false positives. I'd like to disable the mod_security just for these applications and just for certain IP addresses.

The applications are:
http://www.[mydomain].com/cmsdev/public/?action=main.listJobs
http://www.[mydomain].com/cgi-bin/mt.cgi

I followed the instructions in the wiki here:
https://www.atomicorp.com/wiki/index.php/Mod_security

First I modified:
/var/www/vhosts/<DOMAINNAME>/conf/vhost.conf

Adding on the first domain:
<LocationMatch /public/cmsdev/index.php>
SecRule REMOTE_ADDR "@pmFromFile /etc/asl/whitelist" "nolog,phase:1,allow"
</LocationMatch>

And on the second domain:
Adding:
<LocationMatch /cgi-bin/mt.cgi>
SecRule REMOTE_ADDR "@pmFromFile /etc/asl/whitelist" "nolog,phase:1,allow"
</LocationMatch>

I then make sure my IP address was in:
/etc/asl/whitelist

Finally I restart Apache.
/etc/init.d/httpd restart

However I'm still triggering false positives (mostly the rule that detects http:// in forms submitted) on these applications. i.e. mod_security hasn't been disabled for my IP address on these apps.

What might I be doing wrong?
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4155
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: Disabling mod_security for a specification app and ip

Unread post by mikeshinn »

Hard to say offhand, it could be anything. Whats the false positive you are getting, and what version of the rules are you running?
rnolds
Forum User
Forum User
Posts: 25
Joined: Tue Sep 16, 2008 9:59 am

Re: Disabling mod_security for a specification app and ip

Unread post by rnolds »

Hi,

Thanks for the response.

In movabletype editing templates triggers the rule that detects for 'http://' in posts. (Naturally the source code for web pages contains http:// quite often).
And similarly on our internal workflow software the same - whenever clients submit briefs that contain 'http://' it's triggered.

Basically though I would like to be able to turn off mod_security completely for certain IP addresses and for certain applications on domains. Am I following the correct procedure?

Kind regards,


Peter
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: Disabling mod_security for a specification app and ip

Unread post by breun »

Did you run /usr/local/psa/admin/bin/websrvmng -v -a (or run it for the specific domains instead of using the -a flag) after creating vhost.conf? This adds the include for vhost.conf to httpd.include so what you added actually gets used. :)
Lemonbit Internet Dedicated Server Management
rnolds
Forum User
Forum User
Posts: 25
Joined: Tue Sep 16, 2008 9:59 am

Re: Disabling mod_security for a specification app and ip

Unread post by rnolds »

Ah. I hadn't but I just did now; and then restarted apache again.

Unfortunately still the same problem.

Might there be something else?

(Thanks for hanging in with me here)
rnolds
Forum User
Forum User
Posts: 25
Joined: Tue Sep 16, 2008 9:59 am

Re: Disabling mod_security for a specification app and ip

Unread post by rnolds »

OK I found this worked:
I created:
/etc/httpd/modsecurity.d/00_asl_custom_exclude.conf
with the contents
SecRule REQUEST_FILENAME "^/cmsdev/public/" "phase:1,t:none,pass,nolog,ctl:ruleEngine=Off"
and restarted apache.

However it would still be nice to only have this exclusion for certain IPs if I can.
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4155
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: Disabling mod_security for a specification app and ip

Unread post by mikeshinn »

Can you post the false positive? It might be something easily fixed in themselves.
rnolds
Forum User
Forum User
Posts: 25
Joined: Tue Sep 16, 2008 9:59 am

Re: Disabling mod_security for a specification app and ip

Unread post by rnolds »

In movabletype editing templates triggers the rule that detects for 'http://' in posts. (Naturally the source code for web pages contains http:// quite often).
And similarly on our internal workflow software the same - whenever clients submit briefs that contain 'http://' it's triggered.
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: Disabling mod_security for a specification app and ip

Unread post by scott »

If you click on the "report false positive" button in ASL Web it will send us what we need to look into this further.
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4155
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: Disabling mod_security for a specification app and ip

Unread post by mikeshinn »

We need to see the audit_log entry in its entirety. Saying it triggers on http:// doesnt really tell us anything, we know to know where in the applications submission this occurs. URLs can be malicious, so simply allowing them for MT is not a good idea - its very dangerous.

If you could post the entire audit_log entry for this or just hit the False Positive button in ASL that would send us the information needed to debug the FP.
rnolds
Forum User
Forum User
Posts: 25
Joined: Tue Sep 16, 2008 9:59 am

Re: Disabling mod_security for a specification app and ip

Unread post by rnolds »

Hello

I clicked the 'false positive' button. But nothing happened. Should there be a confirmation message or something?

Thank you,


Peter
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: Disabling mod_security for a specification app and ip

Unread post by breun »

No, there is no visual feedback (would be nice, has been requested before I believe).
Lemonbit Internet Dedicated Server Management
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: Disabling mod_security for a specification app and ip

Unread post by scott »

Im pretty sure we have that added into SVN now
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4155
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: Disabling mod_security for a specification app and ip

Unread post by mikeshinn »

If you hit the FP button it will automatically open a case in the support portal for your account. If you system sends the FP without enough identifying information we have to manually associate the case with the account - so for some users there may be a delay.

One easy way to create this association is to make sure your support portal account has the same email address you use to send your ASL alerts. Then its really easy for the system to associate FPs with accounts.

Anyway, if you hit the FP button we got the case and put out an update. Are you still having the problem?
Post Reply