Skip to content

Commit 4cba1f6

Browse files
committed
Show SSL encryption information when logging connections
Expand the messages when log_connections is enabled to include the fact that SSL is used and the SSL cipher information. Dr. Andreas Kunert, review by Marko Kreen
1 parent 9c14dd2 commit 4cba1f6

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

src/backend/utils/init/postinit.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,31 @@ PerformAuthentication(Port *port)
230230
if (Log_connections)
231231
{
232232
if (am_walsender)
233-
ereport(LOG,
234-
(errmsg("replication connection authorized: user=%s",
235-
port->user_name)));
233+
{
234+
#ifdef USE_SSL
235+
if (port->ssl)
236+
ereport(LOG,
237+
(errmsg("replication connection authorized: user=%s SSL(protocol: %s, cipher: %s) enabled",
238+
port->user_name, SSL_get_version(port->ssl), SSL_get_cipher(port->ssl))));
239+
else
240+
#endif
241+
ereport(LOG,
242+
(errmsg("replication connection authorized: user=%s",
243+
port->user_name)));
244+
}
236245
else
237-
ereport(LOG,
238-
(errmsg("connection authorized: user=%s database=%s",
239-
port->user_name, port->database_name)));
246+
{
247+
#ifdef USE_SSL
248+
if (port->ssl)
249+
ereport(LOG,
250+
(errmsg("connection authorized: user=%s database=%s SSL(protocol: %s, cipher: %s) enabled",
251+
port->user_name, port->database_name, SSL_get_version(port->ssl), SSL_get_cipher(port->ssl))));
252+
else
253+
#endif
254+
ereport(LOG,
255+
(errmsg("connection authorized: user=%s database=%s",
256+
port->user_name, port->database_name)));
257+
}
240258
}
241259

242260
set_ps_display("startup", false);

0 commit comments

Comments
 (0)