linuxgeek
Rogue Scholar
- Joined
- Feb 1, 2004
- Posts
- 32,729
Joaquin1975 said:Ah I get you now. I was wondering what was the check to blacklist.
Again, sounds like a very useful app.
The way I have it segmented out, easily expandable to multiple servers doing firewall blacklisting. Basically 4 scripts.
One logdog calls when an invalid user login is attempted. It pulls out the IP address and send it via socket to another script
Second script keeps a hash of the ip addresses sent to it, when the ip first offended, the last time it offended, and how many times it has offended. If the number of offenses is greater than 3 a second or 20 a minute, this program sends via socket to a script on each of the Internet facing boxes the IP address to block. If more than one address is coming from a class C subnet, the subnet is sent.
Script on the internet facing boxes adds the offending address to the blacklist file read in when the firewall is restarted and adds it to the firewall iptable chain of addresses to drop packets from.
Have one last script that I use to send commands from the command line to the script keeping the hash so I can age out any address that haven't offended in the last 12 hours and restart, stop, clear the hash tables, email the the hash tables to me, etc. Mainly use it to run the aging process via cronjob.
