Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e547A-0005WQ-AF for pgsql-general@arkaria.postgresql.org; Thu, 19 Oct 2017 06:15:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e5479-0000i1-Sx for pgsql-general@arkaria.postgresql.org; Thu, 19 Oct 2017 06:15:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e544j-0004bN-2q for pgsql-general@postgresql.org; Thu, 19 Oct 2017 06:13:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e544g-0008Ic-As for pgsql-general@postgresql.org; Thu, 19 Oct 2017 06:12:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v9J6CtG4011557; Thu, 19 Oct 2017 02:12:55 -0400 From: Tom Lane To: Desidero cc: pgsql-general@postgresql.org, Andrew Dunstan Subject: Re: pgpass file type restrictions In-reply-to: References: Comments: In-reply-to Desidero message dated "Wed, 18 Oct 2017 21:45:50 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <11555.1508393575.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 19 Oct 2017 02:12:55 -0400 Message-ID: <11556.1508393575@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Desidero writes: > I=E2=80=99m running into problems with the restriction on pgpass file typ= es. 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=E2=80=99s set up to avoid using things like anony= mous 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 Date: Fri Jun 10 03:02:30 2005 +0000 =20=20=20=20 Add the "PGPASSFILE" environment variable to specify to the password file. =20=20=20=20=20=20=20=20 Andrew Dunstan =20=20=20=20 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-consultin= g.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. > 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? 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. regards, tom lane --=20 Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general