How to specify a client certificate to psql?
Solution 1:
The end result looks like
$>psql "port=5431 host=localhost user=postgres sslcert=./test/client.crt sslkey=./test/client.key sslrootcert=./test/server.crt sslmode=verify-ca"
All the variables are here.
Solution 2:
As stated in the documentation linked by @Milen, you can do this by setting the PGSSLCERT
and PGSSLKEY
environment variables, or by adding sslcert=<cert location> sslkey=<key location>
to the connection string.