Re: Have an encrypted pgpass file - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Have an encrypted pgpass file
Date
Msg-id CAEepm=30M_ndJp2QMoR1Pt3Lg3qq3oC1fCZYTcsV=p1SR0U=VQ@mail.gmail.com
Whole thread Raw
In response to Have an encrypted pgpass file  (Marco van Eck <marco.vaneck@gmail.com>)
Responses Re: Have an encrypted pgpass file  (Christophe Pettus <xof@thebuild.com>)
Re: Have an encrypted pgpass file  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Jul 19, 2018 at 5:46 AM, Marco van Eck <marco.vaneck@gmail.com> wrote:
> Since .pgpass files contain plain-text passwords, I searched for an
> alternative.
> In the attached patch I've added the possibility to run a command to produce
> the content of the pgpass file, in exactly the same format. In this way I
> could use gpg or any other command to decrypt a pgpass file. It will prefer
> the .pgpass file and will not call the command.
>
> This would be my environment variable, to have no plain-text password:
>     PGPASSCOMMAND="gpg -q -d pgpass.gpg"
>
> Other usages of the variable:
>     PGPASSCOMMAND="cat pgpass"
>     PGPASSCOMMAND="curl http://passwords/really-unsecure-pgpass"
>     PGPASSCOMMAND="my-own-secure-pgpass-script"

Hi Marco

I've heard requests for encrypted .pgpass files before, and I've
always been a bit confused about how an unattended system is supposed
to decrypt them.  If the key is in the configuration file or local
filesystem, it feels like you haven't really added much security over
a plaintext password, since an attacker who can steal the .pgpass file
can steal those things too.

There are other database systems out there where passwords are held in
an encrypted form but with only a small amount of digging on the
internet you can find out how to decrypt them.  Seems a bit bogus, at
first glance anyway.

Here you side step those questions completely and make that the end
user's problem.   I like it.

-- 
Thomas Munro
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: GSOC 2018 Project - A New Sorting Routine
Next
From: Christophe Pettus
Date:
Subject: Re: Have an encrypted pgpass file