Hello,

we were really missing the information in our log files if (and which of) our users are using SSL during their connections.


The attached patch is a very simple solution to this problem - it just tests if the ssl pointer in Port is null. If no, it adds "SSL" to the logfile, otherwise it adds "NOSSL".

Or have I been missing an existing way to reach the same?

Regards,
Andreas

--
-------------------------------------------------------------
                                        ____  ______  ____
Dr. Andreas Kunert                     / __/ /     / / __/
HU-Berlin, ZE Rechenzentrum (CMS)     / /_  / / / / __\\
www.hu-berlin.de/~kunert             /___/ /_/_/_/ /___/

-------------------------------------------------------------
--- postgresql-9.1.10/src/backend/utils/init/postinit.c	2013-10-08 05:13:47.000000000 +0200
+++ /usr/postgres/sources/postgresql-9.1.10/src/backend/utils/init/postinit.c	2013-12-05 14:21:53.180148568 +0100
@@ -225,9 +225,22 @@
 					(errmsg("replication connection authorized: user=%s",
 							port->user_name)));
 		else
+#ifdef USE_SSL
+			if (port->ssl > 0) {
+				ereport(LOG,
+						(errmsg("connection authorized: user=%s database=%s SSL",
+								port->user_name, port->database_name)));
+			}
+			else {
+				ereport(LOG,
+						(errmsg("connection authorized: user=%s database=%s NOSSL",
+								port->user_name, port->database_name)));
+			}
+#else
 			ereport(LOG,
 					(errmsg("connection authorized: user=%s database=%s",
 							port->user_name, port->database_name)));
+#endif
 	}
 
 	set_ps_display("startup", false);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to