SQL Server - How to prevent public connections? Today we found that two of our SQL Servers (both 2017 CU21) are accepting connections from any random domain account, even those that most definitely do not have a direct login or access via AD group membership.
On each server there is a user database that allows these random domain accounts to connect.
Based on the configuration we see, we would expect any random domain account (i.e. any that does not have a login on the instance) to get a login failure, and aside from that to also be blocked from connecting to the user database.
For these databases, the guest account is disabled, but for good measure we have executed:
REVOKE CONNECT FROM guest

This made no difference.
So two questions:

How can we turn off / prevent these public connections from succeeding?
What TSQL statement could show us the problematic configuration?

Things we have looked at so far:

The 'public' server role seems to have the default configuration, same as all our other servers where this is not an issue
The guest user definitely shows as disabled on all databases &amp; servers
The 'public' database role has just the default permissions we would expect to see
It is only 1 user database (plus master &amp; msdb &amp; tempdb) on each server that is accessible to these random accounts -- all the other databases behave as normal, i.e. the account cannot connect to them.
The database Containment Type setting is 'None' is all cases.
There is no login present on either server that covers all domain users

Some context: the two servers are related -- they are the DEV &amp; PROD servers for the same application. It is very likely this configuration was done deliberately for some historical reason -- but no-one working here now knows why, so we would like to disable this public access.
As per your description, it seems to me that CONNECT SQL (or perhaps CONNECT) permissions has been assigned to the public server role.