Re: using SSL in psql

From: paul rivers <rivers(dot)paul(at)gmail(dot)com>
To: Willy-Bas Loos <willybas(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: using SSL in psql
Date: 2008-02-11 11:31:17
Message-ID: 47B03205.7040901@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Willy-Bas Loos wrote:
> Hi,
>
> How, using psql, can i connect to a PostgreSQL server that has
> "sslhost" in the pg_hba.conf file?
> I can't find the SSL option in the manpage.
>
> thx,
>
> WBL
Make sure both your server and client have ssl support compiled in. I'm
not sure if that's there by default with the provided binaries, but if
you compiled your own, you specified --with-openssl. Checking pg_config
will be helpful here.

Make sure your server is really configured to provide SSL support.
ssl=on in the postgresql.conf, and be sure to have at least server.key
and server.crt (and optionally your root.crt and root.crl).

Make sure to ask for an ssl connection, especially if you have both ssl
and non-ssl options in the pg_hba.conf. Use the environment variable
PGSSLMODE=require to force the issue and test with psql.

If successful, you will see a line similar to this above the ready prompt:

[Usual welcome banner snipped]
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)

yourdb=>

Alternatively, the only programmatic way to tell that I know if is the
pgsslinfo contrib module, where you can install the function
ssl_is_used() in your db.

Manual re: server setup for SSL:
http://www.postgresql.org/docs/8.3/interactive/ssl-tcp.html

Useful environment variables for the client:
http://www.postgresql.org/docs/current/static/libpq-envars.html

Regards,
Paul

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dawid Kuroczko 2008-02-11 12:04:31 pg_stat_activity xact_start and autovacuum
Previous Message Masse Jacques 2008-02-11 10:02:54 Re: "advanced" database design (long)