blob: a2ec460e6c171ea8710b16937f8339d981bc415c [file] [log] [blame]
{
"serviceName":"hivedev",
"serviceDef":{
"name":"hive",
"id":3,
"resources":[
{"name":"database","level":1,"mandatory":true,"lookupSupported":true,"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher","matcherOptions":{"wildCard":true, "ignoreCase":true},"label":"Hive Database","description":"Hive Database"},
{"name":"table","level":2,"parent":"database","mandatory":true,"lookupSupported":true,"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher","matcherOptions":{"wildCard":true, "ignoreCase":true},"label":"Hive Table","description":"Hive Table"},
{"name":"udf","level":2,"parent":"database","mandatory":true,"lookupSupported":true,"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher","matcherOptions":{"wildCard":true, "ignoreCase":true},"label":"Hive UDF","description":"Hive UDF"},
{"name":"column","level":3,"parent":"table","mandatory":true,"lookupSupported":true,"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher","matcherOptions":{"wildCard":true, "ignoreCase":true},"label":"Hive Column","description":"Hive Column"}
],
"accessTypes":[
{"name":"select","label":"Select"},
{"name":"update","label":"Update"},
{"name":"create","label":"Create"},
{"name":"grant","label":"Grant"},
{"name":"drop","label":"Drop"},
{"name":"alter","label":"Alter"},
{"name":"index","label":"Index"},
{"name":"lock","label":"Lock"},
{"name":"all","label":"All",
"impliedGrants": [
"select",
"update",
"create",
"grant",
"drop",
"alter",
"index",
"lock"
]
}
]
},
"policies":[
],
"tagPolicyInfo": {
"serviceName":"tagdev",
"serviceDef": {
"name": "tag",
"id": 100,
"resources": [
{
"itemId": 1,
"name": "tag",
"type": "string",
"level": 1,
"parent": "",
"mandatory": true,
"lookupSupported": true,
"recursiveSupported": false,
"excludesSupported": false,
"matcher": "org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
"matcherOptions": {
"wildCard": true,
"ignoreCase": false
},
"validationRegEx": "",
"validationMessage": "",
"uiHint": "",
"label": "TAG",
"description": "TAG"
}
],
"accessTypes": [
{
"itemId": 1,
"name": "hive:select",
"label": "hive:select"
},
{
"itemId": 2,
"name": "hive:update",
"label": "hive:update"
},
{
"itemId": 3,
"name": "hive:create",
"label": "hive:create"
}
,
{
"itemId": 4,
"name": "hive:grant",
"label": "hive:grant"
}
,
{
"itemId": 5,
"name": "hive:drop",
"label": "hive:drop"
}
,
{
"itemId": 6,
"name": "hive:alter",
"label": "hive:alter"
},
{
"itemId": 7,
"name": "hive:index",
"label": "hive:index"
},
{
"itemId": 8,
"name": "hive:lock",
"label": "hive:lock"
},
{
"itemId": 9,
"name": "hive:all",
"label": "hive:all",
"impliedGrants":
[
"hive:select",
"hive:update",
"hive:create",
"hive:grant",
"hive:drop",
"hive:alter",
"hive:index",
"hive:lock"
]
}
],
"contextEnrichers": [
{
"itemId": 1,
"name" : "TagEnricher",
"enricher" : "org.apache.ranger.plugin.contextenricher.RangerTagEnricher",
"enricherOptions" : {"tagRetrieverClassName":"org.apache.ranger.plugin.contextenricher.RangerFileBasedTagRetriever", "tagRefresherPollingInterval":60000, "serviceTagsFileName":"/policyengine/descendant_tags.json"}
}
],
"policyConditions": [
]
},
"tagPolicies":[
{"id":1,"name":"RESTRICTED_TAG_POLICY","isEnabled":true,"isAuditEnabled":true,
"resources":{"tag":{"values":["RESTRICTED"],"isRecursive":false}},
"policyItems":[
{
"accesses":[{"type":"hive:all","isAllowed":true}],"users":["user1"],"groups":[],"delegateAdmin":false,
"conditions":[]
}
],
"denyPolicyItems":[
{"accesses":[{"type":"hive:all","isAllowed":true}],"users":["user1"],"groups":[],"delegateAdmin":false}
],
"denyExceptions":[
{"accesses":[{"type":"hive:select","isAllowed":true}],"users":["user3"],"groups":[],"delegateAdmin":false}
]
},
{"id":2,"name":"PII_TAG_POLICY","isEnabled":true,"isAuditEnabled":true,
"resources":{"tag":{"values":["PII"],"isRecursive":false}},
"policyItems":[
{"accesses":[{"type":"hive:select","isAllowed":true}],"users":["hive", "user1"],"groups":[],"delegateAdmin":false}
,
{"accesses":[{"type":"hive:all","isAllowed":true}],"users":["user2"],"groups":[],"delegateAdmin":false}
],
"denyPolicyItems":[
{"accesses":[{"type":"hive:select","isAllowed":true}],"users":["hive"],"groups":[],"delegateAdmin":false}
,
{"accesses":[{"type":"hive:all","isAllowed":true}],"users":["user2"],"groups":[],"delegateAdmin":false}
]
}
,
{"id":3,"name":"EXPIRES_ON_TAG_POLICY","isEnabled":true,"isAuditEnabled":true,
"resources":{"tag":{"values":["EXPIRES_ON"],"isRecursive":false}},
"policyItems":[
{"accesses":[{"type":"hive:select","isAllowed":true}],"users":["user", "user1"],"groups":[],"delegateAdmin":false}
],
"denyPolicyItems":[
{"accesses":[{"type":"hive:select","isAllowed":true}],"users":["user"],"groups":[],"delegateAdmin":false}
,
{"accesses":[{"type":"hive:all","isAllowed":true}],"users":["hive"],"groups":[],"delegateAdmin":false}
]
}
]
},
"tests":[
{
"name": "DENY 'use employee;' for user1 using RESTRICTED tag",
"request": {
"resource": {"elements": {"database": "employee"}},
"accessType": "", "user": "user1", "userGroups": [], "requestData": "'use employee;' for user1"
},
"result": {"isAudited": true, "isAllowed": false, "policyId":-1}
}
,
{"name":"ALLOW 'use finance.tax_2016.ssn;' for user1 using PII tag",
"request":{
"resource":{"elements":{"database":"finance", "table":"tax_2016", "column":"ssn"}},
"accessType":"","user":"user1","userGroups":[],"requestData":"'use finance.tax_2016.ssn;' for user1"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":2}
}
,
{"name":"DENY 'use finance.tax_2016.name;' for user1 using RESTRICTED tag",
"request":{
"resource":{"elements":{"database":"finance", "table":"tax_2016", "column":"name"}},
"accessType":"","user":"user1","userGroups":[],"requestData":"'use finance.tax_2016.name;' for user1"
},
"result":{"isAudited":true,"isAllowed":false,"policyId":1}
}
,
{"name":"DENY 'select finance.tax_2016.ssn;' for hive using PII tag",
"request":{
"resource":{"elements":{"database":"finance", "table":"tax_2016", "column":"ssn"}},
"accessType":"select","user":"hive","userGroups":[],"requestData":"'select finance.tax_2016.ssn;' for hive"
},
"result":{"isAudited":true,"isAllowed":false,"policyId":2}
}
,
{"name":"ALLOW 'use finance;' for hive using PII and RESTRICTED tags",
"request":{
"resource":{"elements":{"database":"finance"}},
"accessType":"","user":"hive","userGroups":[],"requestData":"'use finance;' for hive"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":2}
}
,
{"name":"DENY 'use default;' for user2 using PII tag",
"request":{
"resource":{"elements":{"database":"default"}},
"accessType":"","user":"user2","userGroups":[],"requestData":"'use default;' for user2"
},
"result":{"isAudited":true,"isAllowed":false,"policyId":-1}
}
,
{"name":"DENY 'use default.table1.name;' for user2 using PII tag",
"request":{
"resource":{"elements":{"database":"default", "table": "table1", "column":"name"}},
"accessType":"","user":"user2","userGroups":[],"requestData":"'use default.table1.name;' for user2"
},
"result":{"isAudited":true,"isAllowed":false,"policyId":2}
}
,
{"name":"ALLOW 'use default;' for user using EXPIRES_ON tag",
"request":{
"resource":{"elements":{"database":"default"}},
"accessType":"","user":"user","userGroups":[],"requestData":"'use default;' for user"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":3}
}
,
{
"name":"ALLOW 'use default;' for hive",
"request":{
"resource":{"elements":{"database":"default"}},
"accessType":"","user":"hive","userGroups":[],"requestData":"'use default;' for hive"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":2}
}
,
{
"name":"DENY 'use default.table2;' for hive",
"request":{
"resource":{"elements":{"database":"default", "table":"table2"}},
"accessType":"","user":"hive","userGroups":[],"requestData":"'use default.table2;' for hive"
},
"result":{"isAudited":true,"isAllowed":false,"policyId":3}
}
,
{
"name":"ALLOW 'select default.table2;' for user1",
"request":{
"resource":{"elements":{"database":"default", "table":"table2"}},
"accessType":"select","user":"user1","userGroups":[],"requestData":"'select default.table2;' for user1"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":3}
}
,
{
"name":"ALLOW 'show databases;' for user",
"request":{
"resource":{"elements":{}},
"accessType":"","user":"user","userGroups":[],"requestData":"'show databases;' for user"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":3}
}
,
{
"name":"ALLOW 'show databases;' for hive",
"request":{
"resource":{"elements":{}},
"accessType":"","user":"hive","userGroups":[],"requestData":"'show databases;' for hive"
},
"result":{"isAudited":true,"isAllowed":true,"policyId":2}
}
]
}