I'd like to automatically block the IPs of requests that are providing a fake ssh certificate or key
ssh_dispatch_run_fatal: Connection from XX.XXX.XXX.XX port XXXXX: Connection corrupted [preauth]
Is there a way to ban it or filter it automatically? Actually I'm processing it manually.
ssh_dispatch_run_fatal
, do you run a command or cat some file? Because I think about monitoring the incoming requests and if the messagessh_dispatch_run_fatal
is present than parse it to get the IP and block it.ssh
so I'm not sure how can I getssh_dispatch_run_fatal
. But I can watchssh
logs by usingtail -f /var/log/auth.log
orsudo journalctl --system --follow -u ssh.service
. So I guess you can pipe the journal output and search forssh_dispatch_run_fatal
like this:sudo journalctl --system --follow -u ssh.service | while read -r line; do [[ echo "$line" | grep ssh_dispatch_run_fatal ]] && ..... ; done
[[ echo "$line" | grep ssh_dispatch_run_fatal ]]
is true then you should parse the line to get only this sectionXX.XXX.XXX.XX
and proceed to block it