In a query, I can use inet_server_addr() to return the server's IP address.
What can I use in my query to determine if the connection is ssl-encrypted, e.g.
select inet_server_addr() as 'server_inet_address', ??? as 'connection_ssl_status';
From @DanielVérité's answer in this DBA QA: https://dba.stackexchange.com/a/225915/10044
At runtime, to check which sessions are encrypted, there's the
pg_stat_sslsystem view (since PostgreSQL 9.5). Itspidcolumn is a reference topg_stat_activitythat holds the other bits of information that might be relevant to identifying the connection such asusename,datname,client_addr..., so you might use this query, for instance:SELECT datname, usename, ssl, client_addr FROM pg_stat_ssl INNER JOIN pg_stat_activity ON pg_stat_ssl.pid = pg_stat_activity.pid;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With