The iptables methods all have the flaw that multiple sequential short-lived successful connections will trigger a ban too.
Limiting Internet-facing SSH connections to key-only is definitely a good idea, though.
Limiting Internet-facing SSH connections to key-only is definitely a good idea, though.
ServerAliveInterval 60
ControlMaster auto
ControlPath ~/.ssh/conn/%r@%h:%p
ControlPersist 1h
I use it to speed up new SSH connections after the first one is made, but it should also prevent the issue you've described.