pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Tim Cross <theophilusx@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Encryption of Data Specific to a Tenant in PostgreSQL database | General Idea
Date: Wed, 10 Feb 2021 19:44:35 -0700
Message-ID: <9204FB15-3295-490E-90D4-01717B53D49B@gmail.com> (raw)
In-Reply-To: <87r1lne4qk.fsf@gmail.com>
References: <CA+cYFttZSge7QztGcwgKYF-8ZOWZ-07h1A1qZZkjTUA5=OodxA@mail.gmail.com>
	<87r1lne4qk.fsf@gmail.com>



> On Feb 10, 2021, at 6:45 PM, Tim Cross <theophilusx@gmail.com> wrote:
> 
> 
> Jagmohan Kaintura <jagmohan@tecorelabs.com <mailto:jagmohan@tecorelabs.com>> writes:
> 
>> HI All,
>> 
>> For POstgreSQL database to store data for multiple tenants, the approach
>> decided was to have
>> Shared Database (Holding data for all tenants)
>>      => Data would be segregated on basis of some additional column
>> (tennatid,different tenants having different tenantId)
>>           => Data would be accessed through Views on the basis of tenantId
>> value.
>> 
>> This is the basic process of most of the customers who are trying to
>> implement multiple tenants in PostgreSQL, rather than choosing
>> separate databases for each tenant.
>> 
>> Now we need to encrypt the data related to a tenantId, so that now one
>> knows this data belongs to which tenant even from Operations group.
>> Is there a method in POstgreSQL for encrypting data with different keys
>> with respect to different values in a single column.  Moreover pg_crypto
>> will impose a single key on the column.
>> 
>> Please share your thoughts in which direction i can start analysing this
>> area for encryption of data specific to a tenant.
>> 
> 
> The decision to have all tenants in a single database seems rather
> unusual to me. Isolating one tenant from adversely impacting another
> would seem complicated and I'm not sure how you would implement a clear
> security model. Your model has effectively bypassed all the provided PG
> facilities for isolation of data. Disaster recovery and business
> continuity planning under this model must be a nightmare!
> 
> I doubt you can adopt a solution which is solely within the database.
> How would the database know which key to use for which rows of data? How
> would you select the data for your tenant views if all that data is
> encrypted with different keys? How would you manage these keys in a
> secure manner?
> 
> With the model you have adopted, I would be looking at performing
> encryption/decryption at the client level. However, depending on your
> data types, this could be challenging. this is really a requirement
> which should have been factored into the initial architecture design.
> Anything you try to bolt on now is likely to be complex and have
> significant performance impact and that is assuming you can re-interpret
> the requirement to make the objective feasible.
> 
Yeah, I lost that same arguement in ~2007, where the forces against my push for separation was shouted down with rants on scheme maintenance (divergence) and multiple rollouts per update.  I hadn’t had any coffee before the 9:00am meeting so the hotshot from Amazon got his way.  Then we tried “veils” (a concoction of view and rule re-writing) and we all know how that went.  The company folded before our “next gen” software saw the light of day.

I get the feeling multi-tenancy is, if not the rule these days, at least quite common (on the last of “big iron”?) but it still doesn’t sit well with me.
 

view thread (10+ messages)  latest in thread

Message-ID: <9204FB15-3295-490E-90D4-01717B53D49B@gmail.com>
Permalink:  ../9204FB15-3295-490E-90D4-01717B53D49B@gmail.com/
Also on:    postgresql.org/message-id/9204FB15-3295-490E-90D4-01717B53D49B@gmail.com

 · 

reply

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-general@postgresql.org
  Cc: robjsargent@gmail.com, theophilusx@gmail.com
  Subject: Re: Encryption of Data Specific to a Tenant in PostgreSQL database | General Idea
  In-Reply-To: <9204FB15-3295-490E-90D4-01717B53D49B@gmail.com>
  References: <CA+cYFttZSge7QztGcwgKYF-8ZOWZ-07h1A1qZZkjTUA5=OodxA@mail.gmail.com> <87r1lne4qk.fsf@gmail.com> <9204FB15-3295-490E-90D4-01717B53D49B@gmail.com>

* 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