mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Generate new LOG for "trust" connections under log_connections
Adding an extra LOG for connections that have not set an authn ID, like when the "trust" authentication method is used, is useful for audit purposes. A couple of TAP tests for SSL and authentication need to be tweaked to adapt to this new LOG generated, as some scenarios expected no logs but they now get a hit. Reported-by: Shaun Thomas Author: Jacob Champion Reviewed-by: Robert Haas, Michael Paquier Discussion: https://postgr.es/m/CAFdbL1N7-GF-ZXKaB3XuGA+CkSmnjFvqb8hgjMnDfd+uhL2u-A@mail.gmail.com
This commit is contained in:
@@ -645,6 +645,22 @@ ClientAuthentication(Port *port)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (Log_connections && status == STATUS_OK &&
|
||||
!MyClientConnectionInfo.authn_id)
|
||||
{
|
||||
/*
|
||||
* Normally, if log_connections is set, the call to set_authn_id()
|
||||
* will log the connection. However, if that function is never
|
||||
* called, perhaps because the trust method is in use, then we handle
|
||||
* the logging here instead.
|
||||
*/
|
||||
ereport(LOG,
|
||||
errmsg("connection authenticated: user=\"%s\" method=%s "
|
||||
"(%s:%d)",
|
||||
port->user_name, hba_authname(port->hba->auth_method),
|
||||
port->hba->sourcefile, port->hba->linenumber));
|
||||
}
|
||||
|
||||
if (ClientAuthentication_hook)
|
||||
(*ClientAuthentication_hook) (port, status);
|
||||
|
||||
|
Reference in New Issue
Block a user