Intrusion Prevention System for Secure Shell (SSH) sourced from [email protected]
Similar to DenyHosts, but enables better logging using NMAP and Dig.
Continuously tails system security logs, searching for matches on "sshd", "Failed password", and "Invalid user". With a match, adds the source IP to a list. After a number of sequentially matched failed attempts from the same source IP, under the threshold time, puts the source IP in iptables block and runs NMAP/Dig.
From Source
git clone https://github.com/marshyski/sshwatch.git
sshwatch
to /etc/init.d
sshwatchd
to /usr/sbin
From Packages
rpm -ivh sshwatch-2.0-1.noarch.rpm
(Redhat only)dpkg -i sshwatch_2.0_all.deb
(Debian only)chmod 0700 /etc/init.d/sshwatch /usr/sbin/sshwatchd
chown root:root /etc/init.d/sshwatch /usr/sbin/sshwatchd
chkconfig sshwatch on
(Redhat only)/etc/init.d/sshwatch start
Variables in sshwatchd
thresh
: number of seconds between consecutive attempts, default is 60attempts
: number of consecutive attempts, default is 4clear
: number of seconds elapsed to clear active source blocks, default is 3600nmaplog
: NMAP probes are logged here, default is /var/log/nmap.log
nmap
: NMAP probe malicious source and stored in nmaplog
, default is 0 (off)./sshwatchd /var/log/auth.log > /var/log/sshwatch.log 2>&1 &
(Debian)./sshwatchd /var/log/secure > /var/log/sshwatch.log 2>&1 &
(Redhat)/var/log/nmap.log
> Visit sshwatch Website <