ranger git commit: RANGER-1860
Repository: ranger Updated Branches: refs/heads/master 58fc47e62 -> e65235d1c RANGER-1860 Signed-off-by: peng.jianhua Project: http://git-wip-us.apache.org/repos/asf/ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/e65235d1 Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/e65235d1 Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/e65235d1 Branch: refs/heads/master Commit: e65235d1cb52267be16d6b033532d88692fde12f Parents: 58fc47e Author: zhangqiang2 Authored: Wed Nov 15 10:23:40 2017 +0800 Committer: peng.jianhua Committed: Wed Nov 15 13:51:57 2017 +0800 -- .../src/main/resources/service-defs/ranger-servicedef-nifi.json| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ranger/blob/e65235d1/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json -- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json index 1d11232..697a6b1 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json @@ -49,7 +49,7 @@ "defaultValue":"http://localhost:8080/nifi-api/resources";, "validationRegEx":"", "validationMessage":"", - "uiHint":"The URL of the NiFi REST API that provides the available resources.", + "uiHint":"{\"TextFieldWithIcon\":true, \"info\": \"The URL of the NiFi REST API that provides the available resources.\"}", "label":"NiFi URL" }, {
ranger git commit: RANGER-1884: Default Policy is not created for Ranger KMS and Tag service
Repository: ranger Updated Branches: refs/heads/master 576b62ad0 -> 58fc47e62 RANGER-1884: Default Policy is not created for Ranger KMS and Tag service Signed-off-by: Mehul Parikh Project: http://git-wip-us.apache.org/repos/asf/ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/58fc47e6 Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/58fc47e6 Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/58fc47e6 Branch: refs/heads/master Commit: 58fc47e6247500f8c67c55d933ce99c3c47a97ef Parents: 576b62a Author: Bhavik Patel Authored: Mon Nov 13 12:44:07 2017 +0530 Committer: Mehul Parikh Committed: Wed Nov 15 10:16:47 2017 +0530 -- .../org/apache/ranger/plugin/service/RangerBaseService.java| 5 - .../java/org/apache/ranger/services/kms/RangerServiceKMS.java | 6 -- 2 files changed, 8 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ranger/blob/58fc47e6/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java -- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java index 25f9985..d99f478 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBaseService.java @@ -252,7 +252,10 @@ public abstract class RangerBaseService { List ret = new ArrayList<>(); Map serviceConfig = service.getConfigs(); if (serviceConfig != null ) { - ret.add(serviceConfig.get("username")); +String serviceConfigUser = serviceConfig.get("username"); +if (StringUtils.isNotBlank(serviceConfigUser)){ +ret.add(serviceConfig.get("username")); +} String defaultUsers = serviceConfig.get("default.policy.users"); if (!StringUtils.isEmpty(defaultUsers)) { List defaultUserList = new ArrayList<>(Arrays.asList(StringUtils.split(defaultUsers,","))); http://git-wip-us.apache.org/repos/asf/ranger/blob/58fc47e6/plugin-kms/src/main/java/org/apache/ranger/services/kms/RangerServiceKMS.java -- diff --git a/plugin-kms/src/main/java/org/apache/ranger/services/kms/RangerServiceKMS.java b/plugin-kms/src/main/java/org/apache/ranger/services/kms/RangerServiceKMS.java index cd368e4..579f639 100644 --- a/plugin-kms/src/main/java/org/apache/ranger/services/kms/RangerServiceKMS.java +++ b/plugin-kms/src/main/java/org/apache/ranger/services/kms/RangerServiceKMS.java @@ -29,6 +29,7 @@ import org.apache.ranger.plugin.model.RangerServiceDef; import org.apache.ranger.plugin.service.RangerBaseService; import org.apache.ranger.plugin.service.ResourceLookupContext; import org.apache.ranger.services.kms.client.KMSResourceMgr; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -128,7 +129,9 @@ public class RangerServiceKMS extends RangerBaseService { List policyItems = defaultPolicy.getPolicyItems(); for (RangerPolicy.RangerPolicyItem item : policyItems) { List users = item.getUsers(); - users.add(adminUser); +if(StringUtils.isNotBlank(adminUser)){ +users.add(adminUser); +} item.setUsers(users); } @@ -156,7 +159,6 @@ public class RangerServiceKMS extends RangerBaseService { if (LOG.isDebugEnabled()) { LOG.debug("<== RangerServiceKMS.getDefaultRangerPolicies() : " + ret); } - return ret; }
ranger git commit: Reduce code duplication in kms, where the console handling code is repeated 4 times.
Repository: ranger Updated Branches: refs/heads/master 98cb80e33 -> 576b62ad0 Reduce code duplication in kms, where the console handling code is repeated 4 times. Change-Id: I604d7df25182c413236126812fd2a8a700962e1c Signed-off-by: Colm O hEigeartaigh Project: http://git-wip-us.apache.org/repos/asf/ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/576b62ad Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/576b62ad Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/576b62ad Branch: refs/heads/master Commit: 576b62ad0e9ec4ae6de270a4531eb7eb162d6d8e Parents: 98cb80e Author: Zsombor Gegesy Authored: Thu Nov 9 13:06:26 2017 +0100 Committer: Colm O hEigeartaigh Committed: Tue Nov 14 10:26:55 2017 + -- .../apache/hadoop/crypto/key/ConsoleUtil.java | 74 .../apache/hadoop/crypto/key/DB2HSMMKUtil.java | 37 +- .../apache/hadoop/crypto/key/HSM2DBMKUtil.java | 37 +- .../hadoop/crypto/key/JKS2RangerUtil.java | 38 +- .../hadoop/crypto/key/Ranger2JKSUtil.java | 37 +- 5 files changed, 81 insertions(+), 142 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ranger/blob/576b62ad/kms/src/main/java/org/apache/hadoop/crypto/key/ConsoleUtil.java -- diff --git a/kms/src/main/java/org/apache/hadoop/crypto/key/ConsoleUtil.java b/kms/src/main/java/org/apache/hadoop/crypto/key/ConsoleUtil.java new file mode 100644 index 000..9f43740 --- /dev/null +++ b/kms/src/main/java/org/apache/hadoop/crypto/key/ConsoleUtil.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.crypto.key; + +import java.io.Console; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; + +/** + * Utility class for reading passwords from the console. + * + */ +class ConsoleUtil { + +/** + * Ask a password from console, and return as a char array. + * @param prompt the question which is prompted + * @return the password. + */ +static char[] getPasswordFromConsole(String prompt) throws IOException { +return getStringPasswordFromConsole(prompt).toCharArray(); +} + +/** + * Ask a password from console, and return as a String. + * @param prompt the question which is prompted + * @return the password. + */ +static String getStringPasswordFromConsole(String prompt) throws IOException { +String ret = null; +Console c = System.console(); +if (c == null) { +System.out.print(prompt + " "); +InputStream in = System.in; +int max = 50; +byte[] b = new byte[max]; +int l = in.read(b); +l--; // last character is \n +if (l > 0) { +byte[] e = new byte[l]; +System.arraycopy(b, 0, e, 0, l); +ret = new String(e, Charset.defaultCharset()); +} +} else { +char[] pwd = c.readPassword(prompt + " "); +if (pwd == null) { +ret = null; +} else { +ret = new String(pwd); +} +} +if (ret == null) { +ret = ""; +} +return ret; +} + +} http://git-wip-us.apache.org/repos/asf/ranger/blob/576b62ad/kms/src/main/java/org/apache/hadoop/crypto/key/DB2HSMMKUtil.java -- diff --git a/kms/src/main/java/org/apache/hadoop/crypto/key/DB2HSMMKUtil.java b/kms/src/main/java/org/apache/hadoop/crypto/key/DB2HSMMKUtil.java index edbb299..ad85245 100644 --- a/kms/src/main/java/org/apache/hadoop/crypto/key/DB2HSMMKUtil.java +++ b/kms/src/main/java/org/apache/hadoop/crypto/key/DB2HSMMKUtil.java @@ -16,11 +16,6 @@ */ package org.apache.hadoop.crypto.key; -import java.io.Console; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; - import org.apache.hadoop.conf.Configuration; impor