From: Bruce Momjian <bruce@momjian.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add pg_alterckey utility to change the cluster key
Date: Sat, 26 Dec 2020 23:17:25 -0500
Message-ID: <20201227041725.GA17037@momjian.us> (raw)
In-Reply-To: <X+ffNR3fahsEogYb@paquier.xyz>
References: <E1ksyKP-000471-AI@gemulon.postgresql.org>
<1252111.1608953815@sss.pgh.pa.us>
<X+ay5orW8bgwWqI1@paquier.xyz>
<alpine.DEB.2.22.394.2012260543130.2006135@pseudo>
<X+ffNR3fahsEogYb@paquier.xyz>
On Sun, Dec 27, 2020 at 10:11:17AM +0900, Michael Paquier wrote:
> Hmm. That sounds like a fair concern to me. Based on the information
> given by the docs, three keys are actually created/used at initdb
> time:
> - One for the relation files, that does not have to be shared across
> the nodes in the cluster.
> - One for the WAL files, that has to be shared across the nodes of the
> cluster or no physical replication could happen.
> - One to encrypt the first two ones.
>
> The first two keys are stored in pg_cryptokeys/ in the data directory,
> while the third one is retrieved using a GUC for validation at server
> startup for the other two. Do we necessarily have to store the first
> level keys within the data directory? I guess that this choice has
> been made for performance, but is that really something that a user
> would want all the time? AES256 is the only option available for the
> data keys. What if somebody wants to roll in their own encryption?
To clarify, we encrypt the data keys using AES256, but the data keys
themselves can be 128, 192, or 256 bits.
> Companies can have many requirements in terms of accepting the use of
> one option or another.
I think ultimately we will need three commands to control the keys.
First, there is the cluster_key_command, which we have now. Second, I
think we will need an optional command which returns random bytes ---
this would allow users to get random bytes from a different source than
that used by the server code.
Third, we will probably need a command that returns the data encryption
keys directly, either heap/index or WAL keys, probably based on key
number --- you pass the key number you want, and the command returns the
data key. There would not be a cluster key in this case, but the
command could still prompt the user for perhaps a password to the KMS
server. It could not be used if any of the previous two commands are
used. I assume an HMAC would still be stored in the pg_cryptokeys
directory to check that the right key has been returned.
I thought we should implement the first command, because it will
probably be the most common and easiest to use, and then see what people
want added.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: bruce@momjian.us, michael@paquier.xyz, coelho@cri.ensmp.fr, tgl@sss.pgh.pa.us
Subject: Re: pgsql: Add pg_alterckey utility to change the cluster key
In-Reply-To: <20201227041725.GA17037@momjian.us>
References: <E1ksyKP-000471-AI@gemulon.postgresql.org> <1252111.1608953815@sss.pgh.pa.us> <X+ay5orW8bgwWqI1@paquier.xyz> <alpine.DEB.2.22.394.2012260543130.2006135@pseudo> <X+ffNR3fahsEogYb@paquier.xyz> <20201227041725.GA17037@momjian.us>
* 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