Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEipA-0002Ir-6l for pgsql-admin@arkaria.postgresql.org; Wed, 24 Feb 2021 01:18:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEip8-0003pb-4Q for pgsql-admin@arkaria.postgresql.org; Wed, 24 Feb 2021 01:18:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEip7-0003pU-RE for pgsql-admin@lists.postgresql.org; Wed, 24 Feb 2021 01:18:41 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lEip1-0001GV-Fs for pgsql-admin@lists.postgresql.org; Wed, 24 Feb 2021 01:18:40 +0000 Received: by mail-pf1-x431.google.com with SMTP id z5so212740pfe.3 for ; Tue, 23 Feb 2021 17:18:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=u4vuqNwDE7bpNIOMcx51toEpn9cSSNy+nbUwT6cx4qM=; b=H1y3QYgXBhj0p70pLkMwdRg8uZrnB/G7QtOH4SAH1Apu1XehBZQn57SIWJAmb6sdwj CasuvH54Kc1P4MVOV9c5nZVLLUnO6OzfbcTUM7yNrbXp27jqvX+LYi3cTrdAlPxhw8X5 KgwoxTzmZgNKNXIS6jOh6fK7hU+L1tj7Uwi/KZbhnXPJtz/INZoI8va8O+30+3zJI34e hvtZG9Tf9df5knPzD0kYhsPY+E82ARYZecvLJyIJIVpUbbFhmFtmc7Y8SUafzr0N8KRI ygQchPmkUqxuNiGGP0Az2LygKC7U0vPUuFXzZoYuTGE8BsceRHinUpQ5FEoC0ZN9G6Pn bE/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=u4vuqNwDE7bpNIOMcx51toEpn9cSSNy+nbUwT6cx4qM=; b=b5BzujO/qpMnmOt1g7RDwA9SMNgpXibdzct1lUfHnNzFFTnl8cCrJpANxgfsT1AmQQ Ug24PD5v0wprUJVYS8+U9ieojHkA6LNRKyM8ora5zqBhz6iCKmBBPRy/ZoO98Nh+i9Fl DlwQ9EyGzAK6U6qmsbE/LwUv41Mrlsf6Pa14qiNDHx0Wb2O//tTNZKmRYKavr7Ot0fk/ fnNqcrXe453XO3xJT9fDqjO7+E0kIq4QrXkTLpUgmbv14ztO788LRNg9gj0TUlCnKGLG Q3+a4kBMPvMQn0nqLU431Cx4semrIT3ES0qoOa3z4cuRZxJVsQzXC8GSDnzB493BfnfU Hdew== X-Gm-Message-State: AOAM532Ih+UQNi4kU0GQwAwi8NVl3oJIKP7cV27YTytYFpHZQyNzBqKY IeWHrTTBbyO/BEHSTB++a7bG0tGiH9o= X-Google-Smtp-Source: ABdhPJydibd1HHjFO/nmPfTall+J9VbS2WKhHrP5unRWtIftBd+yP1+8nQ/K3VINY0iFhnNicZng8g== X-Received: by 2002:a63:4d52:: with SMTP id n18mr25925412pgl.237.1614129513869; Tue, 23 Feb 2021 17:18:33 -0800 (PST) Received: from tim-desktop (106-69-122-55.dyn.iinet.net.au. [106.69.122.55]) by smtp.gmail.com with ESMTPSA id g7sm192863pgb.10.2021.02.23.17.18.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 17:18:33 -0800 (PST) References: User-agent: mu4e 1.5.8; emacs 27.1.91 From: Tim Cross To: pgsql-admin@lists.postgresql.org Subject: Re: How to encrypt password in pgpass file Date: Wed, 24 Feb 2021 11:27:45 +1100 In-reply-to: Message-ID: <87eeh6xnyy.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Vipin Madhusoodanan 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.