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 1kssKw-0004OL-8V for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Dec 2020 19:01:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kssKv-0008Ca-7b for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Dec 2020 19:01:13 +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 1kssKv-0008AM-0t for pgsql-hackers@lists.postgresql.org; Fri, 25 Dec 2020 19:01:13 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kssKq-0003GP-6R for pgsql-hackers@lists.postgresql.org; Fri, 25 Dec 2020 19:01:12 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kssKo-0002SX-G5; Fri, 25 Dec 2020 14:01:06 -0500 Date: Fri, 25 Dec 2020 14:01:06 -0500 From: Bruce Momjian To: Erik Rijkers Cc: pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Add key management system Message-ID: <20201225190106.GB19054@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 25, 2020 at 07:30:01PM +0100, Erik Rijkers wrote: > On 2020-12-25 16:19, Bruce Momjian wrote: > > > Add key management system > > doc/src/sgml/database-encryption.sgml | 97 +++++ > > Attached are a few typos. > > I also noticed that this option does not occur in the initdb --help: > > -u --copy-encryption-keys > > Was that deliberate? No. :-( Attached patch applied. Thanks. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --LZvS9be/3tNcYl/X Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="master.diff" diff --git a/doc/src/sgml/database-encryption.sgml b/doc/src/sgml/database-encryption.sgml index f938c9f574..82bc137a61 100644 --- a/doc/src/sgml/database-encryption.sgml +++ b/doc/src/sgml/database-encryption.sgml @@ -13,7 +13,7 @@ log from being able to access the data stored in those files. For example, when using cluster file encryption, users who have read access to the cluster directories for backup purposes will not be able - to decrypt the data stored in the these files. + to decrypt the data stored in these files. @@ -24,7 +24,7 @@ Key one is used to encrypt write-ahead log (WAL) files. Two different keys are used so that primary and standby servers can use different zero (heap/index/temp) keys, but the same one (WAL) key, so that these keys - can eventually be rotated by switching the primary to the standby as + can eventually be rotated by switching the primary to the standby and then changing the WAL key. @@ -68,7 +68,7 @@ initdb -D dbname --cluster-key-command='ckey_passphrase.sh' During the initdb process, if is specified, two data-level encryption keys are created. These two keys are then encrypted with - the key enryption key (KEK) supplied by the cluster key command before + the key encryption key (KEK) supplied by the cluster key command before being stored in the database directory. The key or passphrase that derives the key must be supplied from the terminal or stored in a trusted key store, such as key vault software, hardware security module. @@ -87,7 +87,7 @@ initdb -D dbname --cluster-key-command='ckey_passphrase.sh' - The data encryption keys are randomly generated and are of 128, 192, + The data encryption keys are randomly generated and are 128, 192, or 256-bits in length. They are encrypted by the key encryption key (KEK) using Advanced Encryption Standard (AES256) encryption in Galois/Counter Mode (GCM), which also diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 92594772f6..4d07ce6e3f 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -2326,6 +2326,8 @@ usage(const char *progname) printf(_(" -R, --authprompt prompt for a passphrase or PIN\n")); printf(_(" -s, --show show internal settings\n")); printf(_(" -S, --sync-only only sync data directory\n")); + printf(_(" -u, --copy-encryption-keys=DATADIR\n" + " copy the file encryption key from another cluster\n")); printf(_("\nOther options:\n")); printf(_(" -V, --version output version information, then exit\n")); printf(_(" -?, --help show this help, then exit\n")); --LZvS9be/3tNcYl/X--