April 26, 2024, 5:48 p.m. | Dmitry Romanoff

DEV Community dev.to

This SQL query targets a PostgreSQL database and performs a join between two system views, pg_stat_ssl, and pg_stat_activity, using the process identifier (pid) as the join condition. The purpose of the query is to extract detailed information about database connections that are not using SSL (Secure Sockets Layer) encryption.



SELECT usename, datname, ssl, client_addr, query 
FROM pg_stat_ssl
JOIN pg_stat_activity ON pg_stat_ssl.pid = pg_stat_activity.pid
WHERE ssl!='t'


Let’s break down the components of this query:


SELECT Clause: The query selects the following …

check connections database devops encryption extract information postgresql process purpose query security sockets sql sql query ssl ssl encryption system

Information Security Engineers

@ D. E. Shaw Research | New York City

Technology Security Analyst

@ Halton Region | Oakville, Ontario, Canada

Senior Cyber Security Analyst

@ Valley Water | San Jose, CA

COMM Penetration Tester (PenTest-2), Chantilly, VA OS&CI Job #368

@ Allen Integrated Solutions | Chantilly, Virginia, United States

Consultant Sécurité SI H/F Gouvernance - Risques - Conformité

@ Hifield | Sèvres, France

Infrastructure Consultant

@ Telefonica Tech | Belfast, United Kingdom