Web-server – Fail2Ban on Apache Server to protect against DoS attacks

apache-2.2denial-of-servicefail2banweb-server

I asked a question on the IT security StackExchange about protecting against DoS attacks.
One of the answers was to install Fail2Ban.

I talked to the people that administer the server and they told me Fail2ban is installed by default to watch for failed SSH login attempts. They asked if I wanted it to watch other services on the server.

What services should I have watched by Fail2ban to protect against the DoS attacks?

Would this just be the HTTP services – watch for multiple requests from the same IP within x amount of time?

One of the attacked appeared to create a lot of connection to the MySQL database with the command sleep.

Best Answer

Fail2Ban is most effective in banning IPs for 'failed attempts'. As such, it's really not the most appropriate tool for watching for actual DoS attacks. I set Fail2Ban to watch Apache's httpd-error log file. IPs that have 20 "bad" requests within 5 minutes get banned for 5 minutes. This cuts down on script kiddies and the like, but really wouldn't protect at all against a targeted attack.

Mod_evasive and mod_security cam help cut down on potential DoS vectors, but without knowing how your site works I couldn't provide any silver bullet solutions.

Related Topic