From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Desidero <desidero@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: pgpass file type restrictions
Date: Thu, 19 Oct 2017 08:22:18 -0400
Message-ID: <b6ea3b87-6c30-a324-aa9b-287345dd74f1@2ndQuadrant.com> (raw)
In-Reply-To: <11556.1508393575@sss.pgh.pa.us>
References: <CABvH9hXLDEhy8eGxLyXzaXMdPuQYd5_=f-u4VUZ4SQs_VMSe2Q@mail.gmail.com>
<11556.1508393575@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
On 10/19/2017 02:12 AM, Tom Lane wrote:
> Desidero <desidero@gmail.com> writes:
>> I’m running into problems with the restriction on pgpass file types. When
>> attempting to use something like an anonymous pipe for a passfile, psql
>> throws an error stating that it only accepts plain files.
>> ...
>> Does anyone know why it’s set up to avoid using things like anonymous pipes
>> (or anything but "plain files")?
> A bit of digging in the git history says that the check was added here:
>
> commit 453d74b99c9ba6e5e75d214b0d7bec13553ded89
> Author: Bruce Momjian <bruce@momjian.us>
> Date: Fri Jun 10 03:02:30 2005 +0000
>
> Add the "PGPASSFILE" environment variable to specify to the password
> file.
>
> Andrew Dunstan
>
> and poking around in the mailing list archives from that time finds
> what seems to be the originating thread:
>
> https://www.postgresql.org/message-id/flat/4123BF8C.5000909%40pse-consulting.de
>
> There's no real discussion there of the check for plain-file-ness.
> My first guess would have been that the idea was to guard against
> symlink attacks; but then surely the stat call needed to have been
> changed to lstat? So I'm not quite sure of the reasoning. Perhaps
> Andrew remembers.
That was written 13 years ago. I'm afraid my memory isn't that good.
>
>> If it matters,
>> I'm trying to use that so I can pass a decrypted pgpassfile into postgres
>> since my company is not allowed to have unencrypted credentials on disk
>> (yes, I know that it's kind of silly to add one layer of abstraction, but
>> it's an industry rule we can't avoid).
> I cannot get excited about that proposed use-case, though. How is a pipe
> any more secure than a plain file with the same permissions?
If it's not allowed to reside on disk, put it on a RAM disk?
>
> My thought is that you shouldn't be depending on passwords at all, but
> on SSL credentials or Kerberos auth, both of which libpq supports fine.
>
Yeah, we need to be convincing people with high security needs to get
out of the password game. It's a losing battle.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
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-general@postgresql.org
Cc: andrew.dunstan@2ndquadrant.com, tgl@sss.pgh.pa.us, desidero@gmail.com
Subject: Re: pgpass file type restrictions
In-Reply-To: <b6ea3b87-6c30-a324-aa9b-287345dd74f1@2ndQuadrant.com>
References: <CABvH9hXLDEhy8eGxLyXzaXMdPuQYd5_=f-u4VUZ4SQs_VMSe2Q@mail.gmail.com> <11556.1508393575@sss.pgh.pa.us> <b6ea3b87-6c30-a324-aa9b-287345dd74f1@2ndQuadrant.com>
* 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