PostgreSQL Client Authentication (slides)
PostgreSQL Client Authentication (slides)
Christoph Mönch-Tegeder
2ndQuadrant
http://www.2ndquadrant.com/
2017-02-05
Part I
Authentication
Why Authentication?
I Too complicated
I Nobody knows my database
I Nobody will attack us
Rich Data
https://www.theregister.co.uk/2016/04/25/mexico_voter_data_breach/
Racketeering
https://krebsonsecurity.com/2017/01/extortionists- wipe- thousands- of- databases- victims- who- pay- up- get- stiffed/
Racketeering (2)
https://www.theregister.co.uk/2017/01/09/mongodb/
It’s not only that database
I https://www.shodan.io
I https://www.zoomeye.org
So. . . Secure Your Database!
I Passive Attacks
I sniffing authentication info off the net
I and all other traffic
I Active Attacks
I Man in the Middle (MitM)
I may modify traffic
I There is no safe authentication unless you authenticate whom
you’re authenticating against first. (Martin Seeger)
PostgreSQL Authentication
I type of connection
I local on unix-like platforms only
I database (all, @file, replication, sameuser, samerole)
I user (all, +group, @file)
I non-local: source network
I authentication method and options
Identification mapping
Authentication Mechanisms
Trust - there is none
I password authentication
I hashes stored in PostgreSQL – pg_authid
I sends password in clear
I do not use
I use md5 instead
MD5 - hashed password
krb_server_keyfile = ’krb5.keytab’
I pg_hba.conf
I DSN: krbsrvname=postgres
Cert - TLS Client Certificate
ssl = on
ssl_cert_file = ’server_cert.pem’
ssl_key_file = ’server_cert.key’
ssl_ca_file = ’user_ca.pem’
Considerations
Some Notes on TLS