[
https://issues.apache.org/jira/browse/HIVE-23433?focusedWorklogId=434371&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434371
]
ASF GitHub Bot logged work on HIVE-23433:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 18/May/20 11:04
Start Date: 18/May/20 11:04
Worklog Time Spent: 10m
Work Description: aasha commented on a change in pull request #1016:
URL: https://github.com/apache/hive/pull/1016#discussion_r426544956
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerRestClientImpl.java
##########
@@ -349,6 +354,90 @@ public boolean checkConnection(String url) {
return (clientResp.getStatus() < HttpServletResponse.SC_UNAUTHORIZED);
}
+ @Override
+ public List<RangerPolicy> addDenyPolicies(List<RangerPolicy> rangerPolicies,
String rangerServiceName,
+ String sourceDb, String targetDb) {
+ List<RangerPolicy> rangerPoliciesToImport = new ArrayList<RangerPolicy>();
+ if (CollectionUtils.isNotEmpty(rangerPolicies)) {
+ for (RangerPolicy rangerPolicy : rangerPolicies) {
+ rangerPoliciesToImport.add(rangerPolicy);
+ }
+ }
+
+ RangerPolicy denyRangerPolicy = null;
+
+ if (sourceDb.endsWith("/")) {
+ sourceDb = StringUtils.removePattern(sourceDb, "/+$");
+ }
+ if (targetDb.endsWith("/")) {
+ targetDb = StringUtils.removePattern(targetDb, "/+$");
+ }
+ if (!StringUtils.isEmpty(rangerServiceName)) {
+ denyRangerPolicy = new RangerPolicy();
+ denyRangerPolicy.setService(rangerServiceName);
+ denyRangerPolicy.setName(sourceDb + "_replication deny policy for " +
targetDb);
+ }
+ if (denyRangerPolicy != null) {
+ Map<String, RangerPolicy.RangerPolicyResource> rangerPolicyResourceMap =
new HashMap<String, RangerPolicy.RangerPolicyResource>();
+ RangerPolicy.RangerPolicyResource rangerPolicyResource = new
RangerPolicy.RangerPolicyResource();
+ List<String> resourceNameList = new ArrayList<String>();
+
+ List<RangerPolicy.RangerPolicyItem> denyPolicyItemsForPublicGroup =
denyRangerPolicy.getDenyPolicyItems();
+ RangerPolicy.RangerPolicyItem denyPolicyItem = new
RangerPolicy.RangerPolicyItem();
+ List<RangerPolicy.RangerPolicyItemAccess> denyPolicyItemAccesses = new
ArrayList<RangerPolicy.RangerPolicyItemAccess>();
+
+ List<RangerPolicy.RangerPolicyItem> denyExceptionsItemsForBeaconUser =
denyRangerPolicy.getDenyExceptions();
+ RangerPolicy.RangerPolicyItem denyExceptionsPolicyItem = new
RangerPolicy.RangerPolicyItem();
+ List<RangerPolicy.RangerPolicyItemAccess>
denyExceptionsPolicyItemAccesses = new
ArrayList<RangerPolicy.RangerPolicyItemAccess>();
+
+ resourceNameList.add(sourceDb);
+ rangerPolicyResource.setValues(resourceNameList);
+ RangerPolicy.RangerPolicyResource rangerPolicyResourceColumn =new
RangerPolicy.RangerPolicyResource();
+ rangerPolicyResourceColumn.setValues(new ArrayList<String>(){{add("*");
}});
+ RangerPolicy.RangerPolicyResource rangerPolicyResourceTable =new
RangerPolicy.RangerPolicyResource();
+ rangerPolicyResourceTable.setValues(new ArrayList<String>(){{add("*");
}});
+ rangerPolicyResourceMap.put("database", rangerPolicyResource);
+ rangerPolicyResourceMap.put("table", rangerPolicyResourceTable);
+ rangerPolicyResourceMap.put("column", rangerPolicyResourceColumn);
+ denyRangerPolicy.setResources(rangerPolicyResourceMap);
+
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("create", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("update", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("drop", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("alter", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("index", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("lock", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("write", true));
+ denyPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("ReplAdmin", true));
+ denyPolicyItem.setAccesses(denyPolicyItemAccesses);
+ denyPolicyItemsForPublicGroup.add(denyPolicyItem);
+ List<String> denyPolicyItemsGroups = new ArrayList<String>();
+ denyPolicyItemsGroups.add("public");
+ denyPolicyItem.setGroups(denyPolicyItemsGroups);
+ denyRangerPolicy.setDenyPolicyItems(denyPolicyItemsForPublicGroup);
+
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("create", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("update", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("drop", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("alter", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("index", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("lock", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("write", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("select", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("read", true));
+ denyExceptionsPolicyItemAccesses.add(new
RangerPolicy.RangerPolicyItemAccess("ReplAdmin", true));
Review comment:
No we are denying repladmin for all users except hive. In the other
patch it will be disabled for hive as well
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 434371)
Time Spent: 20m (was: 10m)
> Add Deny Policy on Target Database After Ranger Replication to avoid writes
> ---------------------------------------------------------------------------
>
> Key: HIVE-23433
> URL: https://issues.apache.org/jira/browse/HIVE-23433
> Project: Hive
> Issue Type: Task
> Reporter: Aasha Medhi
> Assignee: Aasha Medhi
> Priority: Major
> Labels: pull-request-available
> Attachments: HIVE-23433.01.patch, HIVE-23433.02.patch,
> HIVE-23433.03.patch
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)