I've been getting some bots trying to get hold of my database by mass attacking /sertup/scripts.php of various database program. I wanna ban such activities.

The closest I found was this: http://www.rubyrobot.org/article/protect-your-web-server-from-spambots

What is the best way, or is there any scripts to ban bots from attacking?


  • Are there any similarities in the requests made by the bots? Are the requests/min high? Would a normal user/visitor access that script? – Mark Mar 12 '11 at 8:36
  • No, user/visitor won't be able to access the script. The request so far is minimum, once a week. All they were trying were various setup scripts from phpmyadmin, and other mysql controller scripts. – Victor Mar 12 '11 at 8:43
  • Cakemox answer would be the correct one. Fail2ban will track the logs for the requests made and ban them using iptables. – Mark Mar 12 '11 at 8:50

Fail2ban will turn the logs of the attacks into firewall rules to block them. It may suit your needs.


I use fail2ban as well, but what proved much more useful was moving the entire site to SSL and doing a redirect. Apparently most, if not all (?) bots can't do either the redirect or SSL, so since then my fail2ban seldomly finds anything anymore.

Benefits: If you have name-based vhosts, your setup gets much simpler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.