pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Hiroshi Inoue <inoue@tpf.co.jp>
Cc: Duffey, Blake A. <Blake.Duffey@noblis.org>
Cc: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: using pgsql-odbc using client certificate auth
Date: Fri, 4 May 2012 12:53:53 -0400
Message-ID: <20120504165353.GG1267@tamriel.snowman.net> (raw)
In-Reply-To: <20120316014651.GZ3938@tamriel.snowman.net>
References: <0984F8A75BAED547B7374948DD065384501D761D@mbx2.mitretek.org>
	<20120314172704.GX3938@tamriel.snowman.net>
	<4F6188F0.8050400@tpf.co.jp>
	<20120316014651.GZ3938@tamriel.snowman.net>

Hiroshi, all,

* Stephen Frost (sfrost@snowman.net) wrote:
> It would be nice if it could use the certificate store, and it looks
> like there is actually code in the ODBC driver to do that, but this is
> good enough for what I need it for.

Ok, I've been able to make it use the Windows certificate store for the
SSL Key (at least..).  Unfortunately, it won't use the certificate store
for the actual certificate or the root chain (yet...).  When it comes to
the ODBC distribution, here's what I'd really like to see:

Please add the 'capi.dll' file to the ODBC distribution, it's part of
OpenSSL and should be installed next to libeay32.dll.  Unfortunately,
that's not all that's needed to make it work- you also need an
openssl.cfg file to be installed, ideally with the ODBC driver too,
with these contents:

---------------------------------------------------
openssl_conf = openssl_init

[openssl_init]
oid_section = new_oids
engines = engine_section

[engine_section]
capi = capi_config

[capi_config]
engine_id = capi
dynamic_path = "c:\\program\ files\ \(x86\)\\psqlodbc\\0901\\bin\\capi.dll"
init=1
---------------------------------------------------

We also need to tell OpenSSL where to find that config file by setting
an environment variable called "OPENSSL_CONF" and putting the path to
the .cfg file there, like so:

OPENSSL_CONF="C:\Program Files (x86)\psqlODBC\0901\bin\openssl.cfg"

Once all of *that* is done, you configure the PG environment variables
like so:

PGSSLCERT="C:\path\to\my.crt"
PGSSLROOTCERT="C:\path\to\myrootchain.crt"
PGSSLKEY="capi:My Name"

(eg: "capi:Stephen P Frost")

Not sure how much of the environment variable stuff we want to include
in the distribution of the ODBC driver vs. just having it in the
documentation.  The more we put into the distro, the less documentation
and the fewer steps that I'll have to deal with, so I'd be inclined to
include more rather than less.

I'm going to look into what it'd take to have CAPI be used for the
actual certificate and root chain..  That really should be very simple
as OpenSSL has support for all of this stuff, we just need to use it.
That'll likely be a libpq change though.

	Thanks!

		Stephen

Attachments:

  signature.asc (application/pgp-signature, 197B) download

view thread (5+ messages)

Message-ID: <20120504165353.GG1267@tamriel.snowman.net>
Permalink:  ../20120504165353.GG1267@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20120504165353.GG1267@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: sfrost@snowman.net, inoue@tpf.co.jp, Blake.Duffey@noblis.org
  Subject: Re: using pgsql-odbc using client certificate auth
  In-Reply-To: <20120504165353.GG1267@tamriel.snowman.net>
  References: <0984F8A75BAED547B7374948DD065384501D761D@mbx2.mitretek.org> <20120314172704.GX3938@tamriel.snowman.net> <4F6188F0.8050400@tpf.co.jp> <20120316014651.GZ3938@tamriel.snowman.net> <20120504165353.GG1267@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox