I am limiting the number of SSH connections using iptables but in case of, for example, a broken pipe (computer goes sleep mode, network problem, etc.) I am no longer able to reconnect.
The rule I use to limit the number of connections is the following:
-A INPUT -p tcp -m tcp --dport 22 --tcp-flags FIN,SYN,RST,ACK SYN -m connlimit --connlimit-above 1 --connlimit-mask 32 --connlimit-saddr -j DROP
Any idea of what's missing so that if the active SSH connection unexpectedly drops, the connection number is correctly decreased? Note that it works correctly when the SSH session is properly closed (i.e. I can reconnect, the counter goes back to 0).
0 Answers