Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f9fsL-00014e-Bg for pgsql-general@arkaria.postgresql.org; Fri, 20 Apr 2018 23:55:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f9fsK-0001kP-1y for pgsql-general@arkaria.postgresql.org; Fri, 20 Apr 2018 23:55:32 +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.89) (envelope-from ) id 1f9fsJ-0001kF-NK for pgsql-general@lists.postgresql.org; Fri, 20 Apr 2018 23:55:31 +0000 Received: from mail-pg0-x235.google.com ([2607:f8b0:400e:c05::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f9fsG-0006XW-PH for pgsql-general@postgresql.org; Fri, 20 Apr 2018 23:55:31 +0000 Received: by mail-pg0-x235.google.com with SMTP id e12so4628947pgn.9 for ; Fri, 20 Apr 2018 16:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=Oc8Yw8KkdsV+hL9oYobP1dDMYKEk4RIeE3G0yFJk6DU=; b=oFYiluXJHfHPSWjmnF99pmfLYYAHtqgX8e1pQ1EdaDnYZfEKObwD6ecXt+pvoilRlo LJNR4+dlIuAdunV2ykOzZoIexqxWIY/nMim5fyYPOGqXZPBPGAKf9/JLE9F05VZzXORp NzdKQmvC/H84yhY2G4TXLT/FE76CDm0pHN9U/lLrojerD3Y3+gWr0Lt4IiSa/0eiEwh0 FQwUh0wBuPWBA+XrwqWO25iu1bZLj5y38esgsW1IeMGP4U2jKlYZvYrtlcmJN3wsAkEw WVdv0iuempdnTlvhgUj90q8BQeyOrq9RzFsG6POU5lgJ8c9DHL/XMteOqFZE25ZadB2u tJ+g== 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:cc:subject :in-reply-to:date:message-id:mime-version; bh=Oc8Yw8KkdsV+hL9oYobP1dDMYKEk4RIeE3G0yFJk6DU=; b=IvlxRTXwgemv+KU0GsEkx3g7dr73GmYJNTJ3/rGN0hs2brZkZjSh69LnigoIwLN+Cc gyWig4IthSQETl68Wb64eBaEKyRCc4eY/46cV1AT0XglSnvbJBDakYGUEG089cAyv24e fFM3w+wTOVN9SC1VcTR1uVr5Nwcaa7pXSXnbH83kjnM77ioB4CQSDaJ97kjEBpCNbIeY w3v+B6GxauYmcJYfGcFKhCFonQSblYpw27rK6w2J2cVuPF4gwRGRQlzCsK5j+2JD3fV7 nmXSnwSHM2oqen2U2zGxnCpJeaIA3fa0XYdxtkc7/bsOnEm5aw1ic4AVLpD9BWQKQsJ8 g+hA== X-Gm-Message-State: ALQs6tDTdFg1wgJ55VbxDjoTRnfmsb05OLzrUWocU67ioAzhkRQH745R yX8b040SLNMBycy6KJU3TVC/vnu/ X-Google-Smtp-Source: AIpwx480Iikr6OfICKYJUpjOOBZc/mWovCLMhRLlJnPPgHrTsDB7jJNA1D1JRW5DcqA5cAPwHGHRrg== X-Received: by 10.101.99.90 with SMTP id p26mr9844807pgv.188.1524268526164; Fri, 20 Apr 2018 16:55:26 -0700 (PDT) Received: from tim-desktop (2001-44b8-31f2-bb00-0d3b-21d7-bf29-b479.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:d3b:21d7:bf29:b479]) by smtp.gmail.com with ESMTPSA id s65sm18464973pfj.124.2018.04.20.16.55.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Apr 2018 16:55:25 -0700 (PDT) References: User-agent: mu4e 0.9.18; emacs 25.3.1 From: Tim Cross To: Vikas Sharma Cc: pgsql-general@postgresql.org Subject: Re: Postgresql database encryption In-reply-to: Date: Sat, 21 Apr 2018 09:55:21 +1000 Message-ID: <87po2t5t7a.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 Vikas Sharma writes: > Hello Guys, > > Could someone throw light on the postgresql instance wide or database wide > encryption please? Is this possible in postgresql and been in use in > production?. > > This is a requirement in our production implementation. > This sounds like a lazy management requirement specified for 'security' purposes by people with little understanding of either technology or security. I suspect it comes form a conversation that went along the lines of .... "There has been lots in the news about cyber threats" "Yes, we need our system to be secure" "I know, lets make one of the requirements that everything must be encrypted, that will stop them" "Great idea, I'll add it as requirement 14". This is a very poor requirement because it is not adequately specified, but more critically, because it is specifying a 'solution' rather than articulating the requirement in a way which would allow those with the necessary expertise to derive an appropriate solution - one which may or may not involve encryption or hashing of data and which may or may not be at the database level. What you really need to do is go back to your stakeholders and ask them a lot of questions to extract what the real requirement is. Try to find out what risk they are trying to mitigate with encryption. Once this is understood, then look at what the technology can do and work out the design/implementation from there. It is extremely unlikely you just want all the data in the database encrypted. When you think about it, such an approach really doesn't make sense. In basic terms, if the data is encrypted, the database engine will need to be able to decrypt it in order to operate (consider how a where clause needs to be able to interpret actions etc). If the db can read the data, the keys must be in the database. If the keys are in the database and your database is compromised, then your keys are compromised. So provided you protect your database from compromise, you achieve the same level of security as you do with full data encryption EXCEPT for access to the underlying data files outside of the database system. For this, you will tend to use some sort of file system encryption, which is typically managed at the operating system level. Again, for the operating system to be able to read the file system, the OS must have access to the decryption keys, so if your OS is compromised, then that level of protection is lost as well (well, that is over simplified, but you get the idea). What this level of protection does give you is data at rest protection - if someone is able to access hour disks through some other means, they cannot read the data. This is the same principal most people should be using with their laptops. Protect the OS with a password and have the data on disk encrypted. Provided nobody can login to your laptop, they cannot read your data. Without this encryption, you can just take the disk out of the laptop, mount it on another system and you have full access. With disk encryption, you cannot do that. Same basic principal with the server. At the database level, a more typical approach is to use one way hashing for some sensitive data (i.e. passwords) and possibly column level encryption on a specific column (much rarer) or just well structured security policies and user roles that restrict who has access to various tables/columns. To implement this successfully, you need details regarding the domain, sensitivity of various data elements and the threats you need to protect against. If you cannot get this information because your stakeholders don't really know what their risks are and have not done a proper assessment and what you are really dealing with is bureaucracy which just as a dumb "data must be encrypted" policy, just use full disk encryption and state that all data is encrypted on disk" and your done. Tim -- Tim Cross