linux poison RSS
linux poison Email

Protect your SSH by using Denyhost

DenyHosts is a Python script that analyzes the sshd server log messages to determine what hosts are attempting to hack into your system. It also determines what user accounts are being targeted. It keeps track of the frequency of attempts from each host.

Additionally, upon discovering a repeated attack host, the /etc/hosts.deny file is updated to prevent future break-in attempts from that host. An email report can be sent to a system admin.

You will need to run DenyHosts as root (in order for DenyHosts to update /etc/hosts.deny and read entries from /var/log), so you first must become root. Once you have either logged in as root (or used su - root, for instance) you can then run the following command:

# crontab -e

The above command will launch the crontab editor. To launch DenyHosts every 20 minutes you would then add the following line to the crontab:

0,20,40 * * * * python PATH_TO_DENYHOSTS/ -c PATH_TO_DENYHOSTS_CONFIG/denyhosts.cfg

You will need to substitute your site-specific paths above. As an example, if you installed DenyHosts in /usr/local/etc and maintain your configuration file there as well, then the following crontab entry would be appropriate:

0,20,40 * * * * python /usr/local/etc/denyhosts/ -c /usr/local/etc/denyhosts/denyhosts.cfg

Once you have edited the crontab you should then save it. Assuming you didn't make any errors, the crontab will automatically install itself.

There are other lot's of option you can use - visit and download DenyHost


Post a Comment

Related Posts with Thumbnails