Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKpDj-0004Re-Br for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 17:03:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dKpDi-0000BV-TC for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 17:03:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dKpCC-0005xb-FM for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 17:01:36 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKpC9-0007cP-HQ for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 17:01:35 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id DA52D5F795; Tue, 13 Jun 2017 13:01:32 -0400 (EDT) Date: Tue, 13 Jun 2017 13:01:32 -0400 From: Stephen Frost To: Bruce Momjian Cc: Peter Eisentraut , Ants Aasma , Robert Haas , PostgreSQL-development Subject: Re: WIP: Data at rest encryption Message-ID: <20170613170132.GH3151@tamriel.snowman.net> References: <06b6db11-3a3f-4d24-6f57-450f96ecda84@2ndquadrant.com> <20170613132416.GD3151@tamriel.snowman.net> <20170613150421.GE3151@tamriel.snowman.net> <20170613160434.GC13873@momjian.us> <20170613162301.GF3151@tamriel.snowman.net> <20170613164442.GD13873@momjian.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zR5xYEds6ClNjy5n" Content-Disposition: inline In-Reply-To: <20170613164442.GD13873@momjian.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-117-generic (x86_64) X-Uptime: 12:46:39 up 35 days, 17:19, 15 users, load average: 0.19, 0.21, 0.17 User-Agent: Mutt/1.5.21 (2010-09-15) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --zR5xYEds6ClNjy5n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Bruce, * Bruce Momjian (bruce@momjian.us) wrote: > On Tue, Jun 13, 2017 at 12:23:01PM -0400, Stephen Frost wrote: > > > Of course, if the > > > key stored in the database is visible to someone using the operating > > > system, we really haven't added much/any security --- I guess my point > > > is that the OS easily can hide the key from the database, but the > > > database can't easily hide the key from the operating system. > >=20 > > This is correct- the key must be available to the PostgreSQL process > > and therefore someone with privileged access to the OS would be able to > > retrieve the key, but that's also true of filesystem encryption. > >=20 > > Basically, if the server is doing the encryption and you have the > > ability to read all memory on the server then you can get the key. Of > > course, if you can read all memory then you can just look at shared > > buffers and you don't really need to bother yourself with the key or > > the encryption, and it doesn't make any difference if you're encrypting > > in the database or in the filesystem. That attack vector is not one > > which this is intending to address. >=20 > My point is that if you have the key accessible to the database server, > both the database server and OS have access to it. If you store it in > the OS, only the OS has access to it. I understand that, but that's not a particularly interesting distinction as the database server must, necessairly, have access to the data in the database. > > > I have to admit we tend to avoid heavy-API solutions that are designed > > > just to work around deployment challenges. Commercial databases are > > > fine in doing that, but it leads to very complex products. > >=20 > > I'm not following what you mean here. >=20 > By adding all-cluster encryption, we are re-implementing something the > OS does just fine, in most cases. We are going to have API overhead to > do it in the database, and historically we have avoided that. We do try to avoid the overhead of additional function calls, in places where it matters. As this is all about reading and writing data, the overhead for the additional check to see if we're doing encryption or not is unlikely to be interesting. > > > One cool idea I have is using public encryption to store the encrypti= on > > > key by users who don't know the decryption key, e.g. RSA. It would b= e a > > > write-only encryption option. Not sure how useful that is, but it > > > easily possible, and doesn't require us to keep the _encryption_ key > > > secret, just the decryption one. > >=20 > > The downside here is that asymmetric encryption is much more expensive > > than symmetric encryption and that probably makes it a non-starter. I > > do think we'll want to support multiple encryption methods and perhaps > > we can have an option where asymmetric encryption is used, but that's > > not what I expect will be typically used. >=20 > Well, usually the symetric key is stored using RSA and a symetric > cipher is used to encrypt/decrypt the data. I was thinking of a case > where you encrypt a row using a symetric key, then store RSA-encrypted > versions of the symetric key encrypted that only specific users could > decrypt and get the key to decrypt the data. This goes back to key management and I agree that it often makes sense to use RSA or similar to encrypt the symmetric key, and this approach would allow the user to do so. That doesn't actually give you a "write-only" encryption option though, since any user who can decrypt the symmetric key is able to use the symmetric key for both encryption and decryption, and someone who only has access to the RSA encryption key can't actually encrypt the data since they can't access the symmetric key. Thanks! Stephen --zR5xYEds6ClNjy5n Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJZQBpsAAoJEO1sijiDR2RVpuIP/30p1f7VKDjxG9dCpLAaAShy 7XPMpmZjBNntBrRNP/4Mqa2ilIvP7E40K7vfRpbWIYxrSwATjZUPNbhMjfS+Whmj 8uld/VMM6Wvs1+h/eqkdOdt6nQQxx5/4Tou0NzxtpRRgXpyA5BuW/hSH3ePJ7S4U fYZVfngU+8WeGxLwuxn17Ce1SRtEV4Cvl9MWthlMFYvLwkt5kW3/yEaAxD0ravLW SzlytHnRmGDKZBPDshkCoEqd0hBl5LgfRv4ts2gJPbUxH0dq4qTbEGBGlJWQgROW 2GrR1aqLQcVgY5bXYLNo/GS7YeIePywpmIpeBOAEJNIBRR6u9+otqz0SG2iqrCM/ WxVyOYqMNywBxxoB4kdMraHM2B8c+qnCZLCAbbs2NQrt9nZUQEfMU+PxwT+9ISQG MFn6ROaEh2Q8PGaSgCra46NdKfGYE0pBAfcaNpK2Dpxtj8DY4e95VURHgBawrsoK 3A4G1bW0I7BTc5vjooGd7ZAvfquIoNA9kzKlyu5mZ7hOMxgpJdwOCBe7ge3CZeUX NWnye4ne8HAkcVerKenFeqAyAoX9avGp/txZ2Tc8l6HDZB2QMWlmJrBwfcaXOy79 Nev7IzdL2kWYpCU97AtQWDdUnmIYjn2odee6psqWXbuPJEiwSE04VXyRjUaOFoNq kY/peODZPOgBBE1kqZrj =rIZq -----END PGP SIGNATURE----- --zR5xYEds6ClNjy5n--