Install fail2ban:
aptitude install fail2banCreate local configuration:
cd /etc/fail2ban && cp jail.conf jail.localEdit
/etc/fail2ban/jail.localand enablessh-ddosby changing the according enable line totrueRestart fail2ban daemon:
service fail2ban restartSince Ubuntu version 10.04 rsyslogd is used; one of its default setting is to reduce the log output by compressing recurrent messages, which breaks the fail2ban-mechanism. Therefore, changing the following line in
/etc/rsyslog.confis vital:sed -i ‘s/RepeatedMsgReduction\ on/RepeatedMsgReduction\ off/’ /etc/rsyslog.confRestart fail2ban and rsyslog daemon:
service fail2ban restart && service rsyslog restart