From: Andreas Karlsson <andreas@proxel.se>
To: Tony Finch <dot@dotat.at>
To: pgsql-bugs@postgresql.org
Subject: Re: psql cannot read client SSL private key from a pipe
Date: Sat, 30 Dec 2017 19:30:54 +0100
Message-ID: <aa2da38e-3869-cb9b-f917-a6000853306e@proxel.se> (raw)
In-Reply-To: <alpine.DEB.2.11.1712211724420.19157@grey.csi.cam.ac.uk>
References: <alpine.DEB.2.11.1712211724420.19157@grey.csi.cam.ac.uk>
On 12/21/2017 06:40 PM, Tony Finch wrote:
> PostgreSQL version: 10.1
> OS: Debian Stretch 9.3
>
> I would like to be able to pass my SSL private key to psql via a pipe.
> This is so that I can use the gpg agent to decrypt my key without retyping
> my passphrase each time. (There isn't an agent for OpenSSL's own key
> decryption routines.) For example,
>
> $ psql 'host=db1 port=5432 sslmode=verify-full user=postgres \
> sslcert=postgres.crt sslkey='<(gpg -d postgres.pem.asc)
Hm, this does sound like a useful feature. Not sure if it counts as a
bug though, so the hackers list is probably more suited for this patch.
> I think it would be better to remove the check - with the patch below I
> can log in using the command quoted above.
>
> Alternatively you could only exclude S_ISDIR() and S_ISBLK() - the other
> cases allow getting keys from interesting placesq.
I do not know why this check was added in the first place so I am not
entirely sure what the right behavior should be. Maybe it would be
enough with an S_ISDIR() check.
Andreas
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-bugs@postgresql.org
Cc: andreas@proxel.se, dot@dotat.at
Subject: Re: psql cannot read client SSL private key from a pipe
In-Reply-To: <aa2da38e-3869-cb9b-f917-a6000853306e@proxel.se>
References: <alpine.DEB.2.11.1712211724420.19157@grey.csi.cam.ac.uk> <aa2da38e-3869-cb9b-f917-a6000853306e@proxel.se>
* 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