Re: Have an encrypted pgpass file

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Marco van Eck <marco(dot)vaneck(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Have an encrypted pgpass file
Date: 2018-07-18 21:33:10
Message-ID: CAEepm=30M_ndJp2QMoR1Pt3Lg3qq3oC1fCZYTcsV=p1SR0U=VQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 19, 2018 at 5:46 AM, Marco van Eck <marco(dot)vaneck(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christophe Pettus 2018-07-18 21:37:22 Re: Have an encrypted pgpass file
Previous Message Tomas Vondra 2018-07-18 21:26:33 Re: GSOC 2018 Project - A New Sorting Routine