Preventing Brute Force Attacks With BlockHosts On Debian Etch - Page 2
3 Creating A BlockHosts Cron Job For Non-TCP_WRAPPERS ServicesTo block hosts from non-TCP_WRAPPERS services such as Debian's ProFTPd, you can run blockhosts.py --iptables --verbose on the command line. Of course, you don't want to do this every few minutes, therefore we create a cron job for this. First we create a little wrapper script for /usr/bin/blockhosts.py: vi /usr/local/sbin/blockhosts
The purpose of this wrapper script is to pass the correct PATH to the /usr/bin/blockhosts.py script; if we use /usr/bin/blockhosts.py directly in the cron job, we will get errors saying that iptables could not be found. Of course, we must make /usr/local/sbin/blockhosts executable: chmod 700 /usr/local/sbin/blockhosts Then, we create a cron job like this: crontab -e
4 TestingNow you can try to log in to your server using SSH and FTP with wrong usernames/passwords. After some time, you shouldn't be able to connect to your server at all which means you got blocked. Change your client's IP address and log in to the server's shell again. Run iptables -L You can see in the output which IP addresses got blocked: server2:~# iptables -L Take a look at /etc/hosts.allow. The same IP addresses should be listed in the #---- BlockHosts Additions section: vi /etc/hosts.allow
Finally, you can also take a look at /var/log/blockhosts.log: tail /var/log/blockhosts.log [...]
5 Links
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com
Red Hat Virtual Experience - a free virtual event. Dec. 9th





print: 
Recent comments
11 hours 43 min ago
17 hours 31 min ago
19 hours 22 min ago
21 hours 7 min ago
1 day 58 min ago
1 day 6 hours ago
1 day 6 hours ago
1 day 11 hours ago
1 day 16 hours ago
1 day 22 hours ago