<p dir="ltr"><br>
Den 18 mar 2014 22:18 skrev "Petter Reinholdtsen" <<a href="mailto:pere@hungry.com">pere@hungry.com</a>>:<br>
><br>
> [Anders Jackson]<br>
> > This can be done directly by iptables, (but not yet with iptables6 for<br>
> > ip6tables ).<br>
> ><br>
> > So I would suggest using a firewall utility instead, like ufw or<br>
> > shorewall.<br>
><br>
> This sound interesting.  How can iptables know that the login attempt<br>
> failed?  My idea is to block too many failed connections, not "too<br>
> many" connections, as a script with ssh-agent backing might well<br>
> connect many times in a short while if the task is right.</p>
<p dir="ltr">Ok, I didn't thought about that use case. <br>
I never used that other than over LAN, not over internet connections.  I just thought about sftp and ssh terminal connection, which usually is longer. <br>
To know the difference between missed logins and short valid ssh connections you'll need something else than iptables. Something that analyse log files or actually knows when login fails. </p>
<p dir="ltr">> > Yes, I think that is a bit too aggressive to block for more than a<br>
> > couple of hours. Half an hour to couple of hours after three failed<br>
> > access would be better, as you suggests. This can be set up in<br>
> > iptables. See ufw directive "limit".<br>
><br>
> Did not seem to care if the login failed or not, but I might have been<br>
> reading the wrong pages.</p>
<p dir="ltr">My bad, sorry. <br>
Iptables doesn't care about failed or successful logins, just assumes that many connections during a short time period is many failed login attempts. Which is why this use case are right for me :-). <br>
I also assumes that connections from the same LAN isn't hostile connections trying to break passwords. </p>
<p dir="ltr">> --<br>
> Happy hacking<br>
> Petter Reinholdtsen</p>
<p dir="ltr">/Anders</p>