Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Member
    Join Date
    Jan 2006
    Posts
    26

    Default mod_security rules

    Is there any way to create rules in mod_security that will block an IP from the server completely if they are found to be accessing a certain address or access it more than once?

  2. #2
    Member celliott's Avatar
    Join Date
    Jan 2006
    Location
    United Kingdom
    Posts
    460

    Default

    Why not just ban the IP on your firewall?

  3. #3
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    Indeed, that's not what mod_security is for. As celliott says, use your iptables firewall (if you're using linux) or block using the standard apache allow/deny directives in httpd.conf.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  4. #4
    Member sh4ka's Avatar
    Join Date
    May 2005
    Posts
    434

    Default

    It would be great to make some rule to communicate an "x" attacker IP (when mod security already detected apache is being attacked) with the firewall rules to automatically block those bad guys... Does anyone know how to do this with for example APF?

    thkz!

  5. #5
    Member
    Join Date
    Jan 2006
    Posts
    26

    Default

    I was just curious if it could be made to block an IP via iptables. Blocking them manually is typically a fruitless effort as most are using proxies which change everyday, but if I can identify certain rules to block an IP after one or two attempts it could stop their scan of a bunch of other address on the server at the time.

  6. #6
    Member xisn's Avatar
    Join Date
    Dec 2004
    Posts
    117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Add it into APF.. Works great for us...

  7. #7
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Talking

    Quote Originally Posted by Jimmyftw
    Blocking them manually is typically a fruitless effort as most are using proxies which change everyday, but if I can identify certain rules to block an IP after one or two attempts it could stop their scan of a bunch of other address on the server at the time.
    LOL! ROFL! Sorry about the laughing .... there is sort of an inside joke related
    to your comment but I will do my best to try to explain:

    Our hosting service developed a new technology that allows us to see backwards
    through any proxy server or even a chain of proxy servers back to the real IP
    effectively rendering all anonymous / privacy type services totally useless.

    It's pretty funny to watch bad users try to beat our bans. Most give up quickly
    but we had one guy keep trying for 3 weeks before he finally gave up while
    we just sat back and enjoyed the show.

  8. #8
    Member sh4ka's Avatar
    Join Date
    May 2005
    Posts
    434

    Question

    How did you did it ?? please tell us

    Quote Originally Posted by xisn
    Add it into APF.. Works great for us...

  9. #9
    Member rpmws's Avatar
    Join Date
    Aug 2001
    Location
    back woods of NC, USA
    Posts
    1,858

    Default

    Quote Originally Posted by Spiral
    LOL! ROFL! Sorry about the laughing .... there is sort of an inside joke related
    to your comment but I will do my best to try to explain:

    Our hosting service developed a new technology that allows us to see backwards
    through any proxy server or even a chain of proxy servers back to the real IP
    effectively rendering all anonymous / privacy type services totally useless.

    It's pretty funny to watch bad users try to beat our bans. Most give up quickly
    but we had one guy keep trying for 3 weeks before he finally gave up while
    we just sat back and enjoyed the show.
    huh??? how??
    Just keeping my "eye" on things....
    R. Paul Mathews
    RPMWS - diehard cPanel Nutcase

  10. #10
    Member celliott's Avatar
    Join Date
    Jan 2006
    Location
    United Kingdom
    Posts
    460

    Default

    Quote Originally Posted by sh4ka
    How did you did it ?? please tell us
    If you have APF installed on your system you should know the basic commands to make proper use of it.

    Go into ssh as root and type "apf -d xx.xx.xxx.x.xx" without quotes obviously. replace xx.xx etc with the IP or Host you wish to ban. This will add the entry into Iptables. You should then reload apf by running /usr/local/sbin/apf -s

  11. #11
    Member serversphere's Avatar
    Join Date
    Jan 2004
    Posts
    658

    Default

    Quote Originally Posted by celliott
    If you have APF installed on your system you should know the basic commands to make proper use of it.
    I think he meant how did user Spiral implement his anti-proxy technology.

  12. #12
    Member sh4ka's Avatar
    Join Date
    May 2005
    Posts
    434

    Default

    Quote Originally Posted by celliott
    If you have APF installed on your system you should know the basic commands to make proper use of it.

    Go into ssh as root and type "apf -d xx.xx.xxx.x.xx" without quotes obviously. replace xx.xx etc with the IP or Host you wish to ban. This will add the entry into Iptables. You should then reload apf by running /usr/local/sbin/apf -s
    Of course I know this, :S
    Like the other guy said... It would be great to communicate and ban from APF automatically an offending IP taked from mod security logs, i mean, automatically

    Anyone have some ideas about how can be done?

    thkz!

  13. #13
    Member
    Join Date
    Jun 2003
    Posts
    280

    Default

    If you use BFD (from RFXNetworks - like APF), you can then add a rule to scan the Apache logs and if a certain string appears more than a certain amount, it can auto-add the IP add to the firewall blocklist (I've configued BFD to scan my exim_rejectlog for "Mail delivery failed due to listing in RBL ...." style messages and auto-blacklist after 5 mails: the amount of processing my server has to do scanning email has slumped! Wouldn't recommend this way for a shared hosting environment though as it's a bit too "paranoid").

  14. #14
    Member sh4ka's Avatar
    Join Date
    May 2005
    Posts
    434

    Default

    Can you give us details about how did you configure it, maybe an example rule ?

    thkz!

  15. #15
    Member
    Join Date
    Apr 2003
    Posts
    193

    Default

    That would not work well since WHM + mod-sec uses a db to store audit_log after a while.

    I'm looking to implement this I have seen more than 5 violations per sec on in my logs.

Similar Threads & Tags
Similar threads

  1. mod_security rules
    By big_bull in forum Security
    Replies: 1
    Last Post: 06-11-2010, 09:08 PM
  2. mod_security best rules
    By webstyler in forum Security
    Replies: 8
    Last Post: 02-13-2010, 11:46 AM
  3. Help with mod_security rules
    By PPNSteve in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-25-2008, 12:51 PM
  4. rules mod_security..what about?
    By Creazioni in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 10-03-2006, 07:34 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube