Re: SSL Certificates in Windows 7 & Postgres 9.3

From: harpagornis <shenlong(at)runbox(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SSL Certificates in Windows 7 & Postgres 9.3
Date: 2014-12-16 20:20:45
Message-ID: 1418761245783-5830985.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Trying to connect via psql, I looked at the documentation and around the web,
but could not find the right syntax for including all the SSL connection
variables on the psql command line. I tried using the URL-type psql
command, variations of this:
--------------------------------------------------------------
psql postgresql://localhost:5432/mydb?sslmode=require?sslcert=postgresql.crt
--------------------------------------------------------------
I wasn't sure if the question mark is supposed to precede each variable
(sslmode, sslcert, etc.)?
Since I could not get that syntax right, then I tried connecting with psql
the other way:
---------------------------------------------------------------
psql dbname=dbname user=my_role sslmode=verify-full sslcert=postgresql.crt
sslkey=postgresql.key sslrootcert=root.crt
----------------------------------------------------------------
The console output was:
"Warning command-line argument sslmode=verify-full ignored"
"Warning command-line argument sslcert=postgresql.crt ignored"
"Warning command-line argument sslkey=postgresql.key ignored"
"Warning command-line argument sslrootcert=root.crt ignored"
----------------------------------------------------------------
After lots of typing, and getting nowhere with either of those two methods,
I edited pg_env.bat to this:
------------------------------------------------------------
@SET PATH="C:\Program Files\PostgreSQL\9.3\bin";%PATH%
@SET PGDATA=D:\PostgresDat
@SET PGDATABASE=postgres
@SET PGUSER=postgres
@SET PGPORT=5432
@SET PGSSLCERT=D:\POSTGRESDAT\POSTGRESQL.CRT
@SET PGSSLKEY=D:\POSTGRESDAT\POSTGRESQL.KEY
@SET PGSSLROOTCERT=D:\POSTGRESDAT\ROOT.CRT
@SET PGSSLMODE=VERIFY-CA
@SET PGLOCALEDIR=C:\Program Files\PostgreSQL\9.3\share\locale
----------------------------------------------------------------
Then, I tried psql again, with fewer variables, like this: 'psql -d dbname
-U my_role'. The console output was this:
----------------------------------------------------------------
Sever closed the connection unexpectedly. This probably means the server
terminated abnormally before or while processing the request.
----------------------------------------------------------------
The pg_log had this:
the database system is starting up
autovacuum launcher started
connection requires a valid client certificate
no pg_hba.conf entry for host "127.0.0.1", user "SYSTEM", database
"postgres", SSL off
connection requires a valid client certificate
connection requires a valid client certificate
----------------------------------------------------------------
Any suggestions as to the correct psql syntax for connecting with SSL?
Thank you.

--
View this message in context: http://postgresql.nabble.com/SSL-Certificates-in-Windows-7-Postgres-9-3-tp5830749p5830985.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-12-16 20:41:02 Re: SSL Certificates in Windows 7 & Postgres 9.3
Previous Message harpagornis 2014-12-16 17:16:34 Re: SSL Certificates in Windows 7 & Postgres 9.3