You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ranger.apache.org by Nigel Jones <ni...@gmail.com> on 2018/01/25 17:22:45 UTC

Hive tag based policies for masking

I’m currently working on a plugin for a new database, but this is purely a usage question for Hive+Ranger hence user list as I’m comparing behaviour between the new code & a good example of an existing  plugin - in this case, Hive.

* I have a resource based policy that allows public access to all tables
* I can create a resource based masking policy for hive against a column in a table, and happily see a salary field redacted
* I can create a tag based access control policy for hive where in Atlas I tag a particular hive column as ‘spi’, and in ranger I create a tag based policy (in a tag service used by the hive service… with tagsync active etc...) that denies access to anything tagged SPI

Both working well :-) [Note I am executing the queries through Hive UI in ambari… and I set the config to execute the query as the end user.. logged in as raj_ops - the user I’m using)

HOWEVER what I can’t seem to get working is a tag based masking policy. I am using the same resource & tag in atlas… so I’m sure that works… 

My policy is found under Access Manager->Service Manager->TagService Policies->Masking
The policy is defined as Masking/32/MaskSPIData/Enabled/spi .
Just single user (raj_ops), AccessType Hive(select), and masking option Redact

However when I do a query no masking occurs.

Audit is enabled, and I don’t see this policy id listed (32). Policies are being synced

Hive - 1.2.1000
Atlas - 0.8.0
Ranger - 0.7.0

Any ideas? Have I missed something? 

Thanks
Nigel.

Re: Hive tag based policies for masking

Posted by Nigel Jones <ni...@gmail.com>.
I’ve done some further investigation.

I do see the spi tag in the audit log when policies work (for example a tag based policy for access control)

It seems though that if I have only a single tag based masking policy active which is configured for spi/raj_ops/redact that policy is never checked - there is certainly no audit log entry, and the data is NOT redacted.
As soon as I add a tag based access control policy (which must be enabled) for say denying access to user keyadmin (so should have no relevance) , this allows access, then the tag policy is checked, appears in audit, and the data IS redacted

Redact/null makes no difference.

Looks like a bug in hive. not checked latest code.

> On 25 Jan 2018, at 17:39, Madhan Neethiraj <ma...@apache.org> wrote:
> 
> Nigel,
> 
> In the audit log, can you check if 'spi' tag appears for the column? If it doesn't, then Ranger doesn't have the column-to-tag association.
> 
> Hope this helps.
> 
> Madhan
> 
> 
> 
> 
> On 1/25/18, 9:22 AM, "Nigel Jones" <ni...@gmail.com> wrote:
> 
>    I’m currently working on a plugin for a new database, but this is purely a usage question for Hive+Ranger hence user list as I’m comparing behaviour between the new code & a good example of an existing  plugin - in this case, Hive.
> 
>    * I have a resource based policy that allows public access to all tables
>    * I can create a resource based masking policy for hive against a column in a table, and happily see a salary field redacted
>    * I can create a tag based access control policy for hive where in Atlas I tag a particular hive column as ‘spi’, and in ranger I create a tag based policy (in a tag service used by the hive service… with tagsync active etc...) that denies access to anything tagged SPI
> 
>    Both working well :-) [Note I am executing the queries through Hive UI in ambari… and I set the config to execute the query as the end user.. logged in as raj_ops - the user I’m using)
> 
>    HOWEVER what I can’t seem to get working is a tag based masking policy. I am using the same resource & tag in atlas… so I’m sure that works… 
> 
>    My policy is found under Access Manager->Service Manager->TagService Policies->Masking
>    The policy is defined as Masking/32/MaskSPIData/Enabled/spi .
>    Just single user (raj_ops), AccessType Hive(select), and masking option Redact
> 
>    However when I do a query no masking occurs.
> 
>    Audit is enabled, and I don’t see this policy id listed (32). Policies are being synced
> 
>    Hive - 1.2.1000
>    Atlas - 0.8.0
>    Ranger - 0.7.0
> 
>    Any ideas? Have I missed something? 
> 
>    Thanks
>    Nigel.
> 
> 
> 
> 


Re: Hive tag based policies for masking

Posted by Madhan Neethiraj <ma...@apache.org>.
Nigel,

In the audit log, can you check if 'spi' tag appears for the column? If it doesn't, then Ranger doesn't have the column-to-tag association.

Hope this helps.

Madhan




On 1/25/18, 9:22 AM, "Nigel Jones" <ni...@gmail.com> wrote:

    I’m currently working on a plugin for a new database, but this is purely a usage question for Hive+Ranger hence user list as I’m comparing behaviour between the new code & a good example of an existing  plugin - in this case, Hive.
    
    * I have a resource based policy that allows public access to all tables
    * I can create a resource based masking policy for hive against a column in a table, and happily see a salary field redacted
    * I can create a tag based access control policy for hive where in Atlas I tag a particular hive column as ‘spi’, and in ranger I create a tag based policy (in a tag service used by the hive service… with tagsync active etc...) that denies access to anything tagged SPI
    
    Both working well :-) [Note I am executing the queries through Hive UI in ambari… and I set the config to execute the query as the end user.. logged in as raj_ops - the user I’m using)
    
    HOWEVER what I can’t seem to get working is a tag based masking policy. I am using the same resource & tag in atlas… so I’m sure that works… 
    
    My policy is found under Access Manager->Service Manager->TagService Policies->Masking
    The policy is defined as Masking/32/MaskSPIData/Enabled/spi .
    Just single user (raj_ops), AccessType Hive(select), and masking option Redact
    
    However when I do a query no masking occurs.
    
    Audit is enabled, and I don’t see this policy id listed (32). Policies are being synced
    
    Hive - 1.2.1000
    Atlas - 0.8.0
    Ranger - 0.7.0
    
    Any ideas? Have I missed something? 
    
    Thanks
    Nigel.