Bash script to block ssh attacks

Comments, suggestions, compliments, etc
Post Reply
zuzu88
Posts: 4
Joined: 2015/04/28 18:03:14

Bash script to block ssh attacks

Post by zuzu88 » 2015/04/28 18:38:22

How to create an automated firewall blocking (bash) script which will
1.Scan /var/log/secure?
2.Check for the IP addresses that "Failed" log in 3 times?
3.Check IP tables if it exists?
4. if not ,how to create a iptable rules to block those IP addresses?
Thanks in advance !

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Bash script to block ssh attacks

Post by gerald_clark » 2015/04/28 21:45:55

Check out fail2ban ( available at epel for some versions of CentOS ).

marios-zindilis
Posts: 6
Joined: 2015/04/28 15:02:38
Location: Cyprus
Contact:

Re: Bash script to block ssh attacks

Post by marios-zindilis » 2015/04/30 04:06:31

There's also denyhosts, which runs as a service, monitors /var/log/secure and manipulates /etc/hosts.deny. It is also available from EPEL.
Marios Zindilis
Linux Systems Administrator
zindilis.com

zuzu88
Posts: 4
Joined: 2015/04/28 18:03:14

Re: Bash script to block ssh attacks

Post by zuzu88 » 2015/05/22 18:18:07

THANKS

Post Reply