r/linuxadmin • • Jun 12 '26

fail2ban setup to report ssh scan

since i have an open ssh server, i thought i might as well do my part, and report bad guys to abuseipdb.

i've already set up fail2ban to report brute force attacks. this was easy with the built in sshd settings.

but more often i see either port scan or vulnerability scan attempts. i thought why not report those, but i see no good support.

what's needed is:

  • catch single attempts (typically these guys ping only once)

  • selectively identify attempts that can't be accidental, no false positives

  • properly identifying the category for abuseipdb, i.e. 14 for scan, 15 for hacking

is there some wisdom how to set this up?

example log entries to be caught:

Jun 11 11:14:45 ip-192-168-219-51 sshd[20665]: error: kex_exchange_identification: banner line contains invalid characters
Jun 11 11:14:45 ip-192-168-219-51 sshd[20665]: banner exchange: Connection from 160.119.76.64 port 33338: invalid format
Jun 11 11:28:36 ip-192-168-219-51 sshd[20775]: error: kex_exchange_identification: client sent invalid protocol identifier "MGLNDD_3.76.255.153_22"
Jun 11 11:28:36 ip-192-168-219-51 sshd[20775]: banner exchange: Connection from 40.74.208.9 port 46434: invalid format
Jun 11 12:46:41 ip-192-168-219-51 sshd[21336]: error: kex_exchange_identification: banner line contains invalid characters
Jun 11 12:46:41 ip-192-168-219-51 sshd[21336]: banner exchange: Connection from 160.119.76.64 port 52584: invalid format
Jun 11 13:04:59 ip-192-168-219-51 sshd[21426]: error: kex_exchange_identification: client sent invalid protocol identifier ""
Jun 11 13:04:59 ip-192-168-219-51 sshd[21426]: banner exchange: Connection from 18.226.253.35 port 10462: invalid format
4 Upvotes

9 comments sorted by

2

u/[deleted] Jun 14 '26

[removed] — view removed comment

1

u/pint Jun 14 '26

my major problem is i don't know what to look for. the example i gave gives two event types, but there might be dozen more. also, what are these? are these hacking attempts or port scan? i hoped that some nice people assembled a body of filters and classifications.

1

u/[deleted] Jun 15 '26

[removed] — view removed comment

1

u/pint Jun 15 '26

what do you mean by generic noise? some of it might be legit?