Sim, utilizo openssh. Estou testando o script em um mandrake 9.
[]'s, Renato
Versão Imprimível
Sim, utilizo openssh. Estou testando o script em um mandrake 9.
[]'s, Renato
entao as tentativas devem estar caindo pro /var/log/auth.log ... verifica pra mim se eh isso ve se estao lah os erros de login
se for do jeito que te falei tenta isso aqui! remontei o do beltrano lah e testei aqui pra vc (em modo manual) e fico 100%
olha como sou bonzinho hehe me agradece ali em baixo dpz :P hehehe
Abraços!
Código :
#!/bin/bash MODE="AUTO" #MODE="MANUAL" if [ -f /var/log/auth.log ] ; then ips=$(cat -n /var/log/auth.log | tail -n 90 | grep "authentication failure" | awk -F" " {'print $15'} | cut -d= -f2) attempts=1 for ip in $ips ; do lastip=$ip if [ "$lastip" == "$ip" ] ; then attempts=$(expr $attempts + 1) if [ $attempts -ge 5 ] ; then echo "Brute force SSHD attack detected from $ip" attempts=1 lastip="" blocked=$(iptables -L INPUT | grep -i $ip | grep -i DROP) if [ "$blocked" ] ; then echo "> Ip Already Blocked. Continuing with scan" echo " " else if [ $MODE == "MANUAL" ] ; then echo "> Do You Want to add this IP to INPUT DROP in IPTABLES rules? (y/n)" read resp if [ "$resp" == "y" ] ; then iptables -A INPUT -s $ip -j DROP echo "> IP $ip ADDED TO IPTABLES INPUT DROP ruleset" echo " " fi else iptables -A INPUT -s $ip -j DROP echo "> IP $ip ADDED TO IPTABLES INPUT DROP ruleset" echo " " fi fi fi fi done fi