Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYV5f-0008Dp-Og for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2019 12:32:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hYV5d-0005c9-Tq for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2019 12:32:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYV5d-0005c2-B8 for pgsql-hackers@lists.postgresql.org; Wed, 05 Jun 2019 12:32:25 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYV5X-00055C-Qw for pgsql-hackers@postgresql.org; Wed, 05 Jun 2019 12:32:23 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 6943FA13BB; Wed, 5 Jun 2019 14:32:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id ER4qnXbWtP_I; Wed, 5 Jun 2019 14:32:04 +0200 (CEST) From: Antonin Houska To: Robert Haas cc: Toshi Harada , "pgsql-hackers@postgresql.org" Subject: Re: "WIP: Data at rest encryption" patch and, PostgreSQL 11-beta3 In-reply-to: References: <5907.1534140361@localhost> <201808150211.w7F2ApMj023097@ccmail04.silk.ntt-tx.co.jp> <19039.1536933944@localhost> <14646.1552570130@localhost> <11812.1554386232@localhost> <7567.1556117300@localhost> <32714.1559057215@localhost> <18987.1559285981@localhost> Comments: In-reply-to Robert Haas message dated "Mon, 03 Jun 2019 12:04:54 -0400." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31112.1559737923.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Wed, 05 Jun 2019 14:32:03 +0200 Message-ID: <31113.1559737923@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas wrote: > On Fri, May 31, 2019 at 2:59 AM Antonin Houska wrote: > > > Sounds good. I'm not quite sure how this is going to work. Ideally > > > you'd like the encryption key command to fetch the key from somethin= g > > > like ssh-agent, or maybe pop up a window on the user's terminal with= a > > > key prompt. Just reading from stdin and writing to stdout is not > > > going to be very convenient... > > > > When I mentioned writing to stdout in my previous email, I viewed it f= rom the > > perspective of postmaster: whichever way the command gets the password= from > > the DBA, it'll always write it to stdout and postmaster will read it f= rom > > there. This was to address your objection that the executables do not = actually > > "return" strings. > = > So the part about returning strings is really just a wording issue: > the documentation needs to talk about data sent to stdout or wherever, > because that's what really happens, and somebody writing such a > command from scratch needs to know what it must do. > = > What I'm talking about here is that it also has to be reasonably > possible to write an encryption key command that does something > useful. I don't have a really clear vision for how that's going to > work. Nobody wants the server, which is probably being launched by > pg_ctl or systemd or both, to prompt using its own stdin/stderr, but > the we need to think about how the prompting is actually going to > work. Since you mentioned ssh-agent above, I think that postmaster can, instead = of running a command, create an unix socket and read the key from there. (I r= efer only to the socket as a communication channel, not to the protocol - ssh-a= gent does not seem to actually send key over the socket.) Unlike the socket for backend connections, this one would only be readable by the user that runs postmaster, and would only exist during the encryption initialization. The simplest approach from the perspective of the DBA is that pg_ctl can w= rite the key to the socket. Besides that we can also implement a separate utili= ty to send the key, to be used in other special cases such as starting postgr= es via systemd. (If the unix socket is a problem on windows, we might need to use named pi= pe instead.) > > The header comment in pg_upgrade.c indicates that this is because of T= OAST. So > > I think that dbnode and relfilenode are not preserved just because the= re was > > no strong reason to do so by now. > = > Maybe you want to propose an independent patch making that change? I think of a separate diff in the encryption patch series. As the encrypti= on is the only reason for this enhancement, I'm not sure if it deserves a separate CF entry. (Although it might be considered refactoring because eventually pg_upgrade won't need to handle the different relnodes, and thu= s it might become a little bit simpler.) -- = Antonin Houska Web: https://www.cybertec-postgresql.com