pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: How to encrypt password in pgpass file
Date: Wed, 24 Feb 2021 11:27:45 +1100
Message-ID: <87eeh6xnyy.fsf@gmail.com> (raw)
In-Reply-To: <DCB731A2-6896-4669-A6C1-69D5A730829B@gmail.com>
References: <DCB731A2-6896-4669-A6C1-69D5A730829B@gmail.com>


Vipin Madhusoodanan <vipin.madhusoodanan@gmail.com> writes:

> Hi Team,
>
> We have a security requirement to encrypt passwords in .pgpass file. Could you please advise on the options and steps to be followed to achieve this.
>

Basically, don't use .pgpass. I think .pgpass should be viewed as old
legacy solution which is not terribly compatible with today's security
requirements. I don't think there is support for encrypting the .pgpass
file. Even if you could encrypt the .pgpass file, you would then need to
decrypt it with a passpharase anyway (you could have a key which has no
passpharase, but if that is on the same system, what have you achieved
apart from a false sense of security).

How to best solve your requirement depends on the specifics of your
requirement. However, often you can implement something more secure by
using environment variables which are set for the process the psql (or
whatever) command executes in. The value for the variable can be
obtained from a secure source, such as a keyring, ldap server, gpg
encrypted file etc.





view thread (7+ messages)  latest in thread

Message-ID: <87eeh6xnyy.fsf@gmail.com>
Permalink:  ../87eeh6xnyy.fsf@gmail.com/
Also on:    postgresql.org/message-id/87eeh6xnyy.fsf@gmail.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: theophilusx@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: How to encrypt password in pgpass file
  In-Reply-To: <87eeh6xnyy.fsf@gmail.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