LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Received disconnect: Bye Bye [preauth] (https://www.linuxquestions.org/questions/linux-security-4/received-disconnect-bye-bye-%5Bpreauth%5D-4175720207/)

RickPoleshuck 12-26-2022 07:55 AM

Received disconnect: Bye Bye [preauth]
 
My logwatch report shows this in the SSHD section:

Received disconnect:
Bye Bye [preauth] : 6004 Times

Can someone tell me what this means?

Thanks

Turbocapitalist 12-27-2022 12:58 AM

It can mean a lot of things but probably some scanner connected and then disconnected after receiving the banner. You can try with netcat and see:

Code:

nc yoursite.example.com 22
You might consider using SSHGuard, or Fail2Ban, plus NFTables. Fail2Ban has the name recognition but SSHGuard seems more capable. If you have IPv6, your choice will have to be SSHGuard plus NFTables. Despite the name it can handle other services as well such as HTTP not just SSH.

RickPoleshuck 12-27-2022 06:29 AM

Quote:

Originally Posted by Turbocapitalist (Post 6400530)
It can mean a lot of things but probably some scanner connected and then disconnected after receiving the banner. You can try with netcat and see:

Code:

nc yoursite.example.com 22
You might consider using SSHGuard, or Fail2Ban, plus NFTables. Fail2Ban has the name recognition but SSHGuard seems more capable. If you have IPv6, your choice will have to be SSHGuard plus NFTables. Despite the name it can handle other services as well such as HTTP not just SSH.

Thanks
I do use fail2ban, do not support ipv6, and do not use the default ssh port.

Reviewing my auth.log for today, I see "Received disconnect from Bye Bye [preauth]" from 429 unique IPs. It looks like I should add another fail2ban filter and rule. I am a little disappointed that fail2ban didn't come with this rule by default. Is that what you mean by "SSHGuard seems more capable"? Writing another fail2ban rule seems a lot easier than switching to SSHGuard. This will not be my first fail2ban custom filter and rule.

What I am seeing is that they are scanning all my ports, but logwatch only reports on my ssh port.

Thanks again

Turbocapitalist 12-27-2022 06:45 AM

Yes, all ports on all outward facing systems get scanned more or less continuously so that won't hide your SSH service even a little bit. These days it doesn't even quiet the logs as much as it used to. Using keys and turning off password authentication seems to do the most in that regard as many bots seem to figure that out and not waste further effort against such systems.

Check Shodan for your IPv4 address. You'll find your router listed there along with whatever port you happen to have SSH on.

Adding a filter rule would only be relevant if the same addresses keep returning.

RickPoleshuck 12-27-2022 07:10 AM

Quote:

Originally Posted by Turbocapitalist (Post 6400575)
Yes, all ports on all outward facing systems get scanned more or less continuously so that won't hide your SSH service even a little bit. These days it doesn't even quiet the logs as much as it used to. Using keys and turning off password authentication seems to do the most in that regard as many bots seem to figure that out and not waste further effort against such systems.

Check Shodan for your IPv4 address. You'll find your router listed there along with whatever port you happen to have SSH on.

Adding a filter rule would only be relevant if the same addresses keep returning.

Again, just looking at this morning's log, 362 ip addresses have 30 attacks each. So yes, I think a new fail2ban rule is recommended. I do have a honeypot on an otherwise unused port that I thought would stop a lot of scanning, but now I think a fail2ban filter on 'Disconnected.*preauth' is a better solution.

Looking up my server in Shodan was VERY interesting. Much thanks.

Of course I only use public key authentication, but it is good to recommend to other readers of this thread.


All times are GMT -5. The time now is 05:19 AM.