The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

modsec to iptables

Discussion in 'Security' started by sehh, Sep 9, 2008.

  1. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    I've enabled Mod Security and its functioning properly so far.

    Is it possible to pass the IP address of the attacker to iptables (or some shell script which calls iptables) in order to ban the IP from the firewall?

    For example, it would be nice if we could ban IP's from attacks with severity of 4 or higher.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,448
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Europe
    I found a solution. I created a rule in modsec which uses the "exec" command to execute a small command, which in turn runs iptables and blocks the IP address right away. The whole thing works perfectly!

    CSF/BFD and the rest of them are too passive in case of a DoS attack, while this solution blocks them immediately.
     
Loading...

Share This Page