I have a CentOS 7 server with 2 NICs, one inside the LAN with a private IP 192.168.1.1 (lan0) and one with a public internet IP (ppp0)
For connections originating from inside the LAN I want password or public key authentication to be available.
For connections originating from the internet, I want public key only. I've done this like so in /etc/ssh/sshd_config
PasswordAuthentication No And then the last lines are:
Match address 192.168.1.0/24 PasswordAuthentication yes So to test, I log on to another machine I have which, is VPS on the internet and try to ssh in. As expected I get this:
Permission denied (publickey). But what I'm not understanding is why my /var/log/secure is filled with brute force attempts like this: (IP's changed)
Apr 22 09:57:36 linuxhost1 sshd[15149]: input_userauth_request: invalid user webmaster [preauth] Apr 22 09:57:36 linuxhost1 sshd[15149]: Received disconnect from a.b.c.d: 11: Bye Bye [preauth] Apr 22 09:57:36 linuxhost1 sshd[15151]: Invalid user webmaster from a.b.c.d Apr 22 09:57:36 linuxhost1 sshd[15151]: input_userauth_request: invalid user webmaster [preauth] Apr 22 09:57:36 linuxhost1 sshd[15151]: Received disconnect from a.b.c.d: 11: Bye Bye [preauth] Apr 22 09:57:36 linuxhost1 sshd[15153]: Invalid user webpop from a.b.c.d Apr 22 09:57:36 linuxhost1 sshd[15153]: input_userauth_request: invalid user webpop [preauth] Apr 22 09:57:36 linuxhost1 sshd[15153]: Received disconnect from a.b.c.d: 11: Bye Bye [preauth] Apr 22 09:57:36 linuxhost1 sshd[15155]: Invalid user web from a.b.c.d Apr 22 09:57:36 linuxhost1 sshd[15155]: input_userauth_request: invalid user web [preauth] Apr 22 09:57:36 linuxhost1 sshd[15155]: Received disconnect from a.b.c.d: 11: Bye Bye [preauth] Apr 22 09:57:37 linuxhost1 sshd[15157]: Invalid user william from a.b.c.d Apr 22 09:57:37 linuxhost1 sshd[15157]: input_userauth_request: invalid user william [preauth] Apr 22 09:57:37 linuxhost1 sshd[15157]: Received disconnect from a.b.c.d: 11: Bye Bye [preauth] Apr 22 09:57:37 linuxhost1 sshd[15159]: Invalid user windowserver from a.b.c.d Apr 22 09:57:37 linuxhost1 sshd[15159]: input_userauth_request: invalid user windowserver [preauth] Apr 22 09:57:37 linuxhost1 sshd[15159]: Received disconnect from a.b.c.d: 11: Bye Bye [preauth] How were these brute force attackers allowed to even input a username?