2017-10-16 64 views
1

是否有可能检查(如不根源的用户/ SQL问题)来检查,如果我从客户端到服务器的连接使用SSL(我的目标服务器cas使用两者 - 安全和不安全的连接)?Postgresql - 100%肯定会与服务器使用SSL连接?

+0

答案取决于你使用的是PostgreSQL客户端上。 –

+0

对于任何libpq客户端,对于PgJDBC,'sslmode = require'或最好是'sslmode = verify-full'。其他客户可能有所不同 –

回答

3

为9.5:

https://www.postgresql.org/docs/current/static/monitoring-stats.html#PG-STAT-SSL-VIEW

的pg_stat_ssl视图可以包含每后端或WAL发送 处理一行,显示关于该连接上的SSL使用的统计信息。可以将 连接到pid列 上的pg_stat_activity或pg_stat_replication以获取有关该连接的更多详细信息。上述

t=# set role notsu ; 
SET 
Time: 9.289 ms 
t=> select * from pg_stat_ssl where pid = pg_backend_pid(); 
    pid | ssl | version | cipher | bits | compression | clientdn 
-------+-----+---------+--------+------+-------------+---------- 
43767 | f |   |  |  |    | 
(1 row) 

Time: 10.846 ms 
t=> \du+ notsu 
        List of roles 
Role name | Attributes | Member of | Description 
-----------+------------+-----------+------------- 
notsu  |   | {}  | 

显示我的连接不是SSL