Explorar o código

AMBARI-2663. Security wizard: oozie principal should be mapped to oozie user name via hadoop.security.auth_to_local property. (jaimin via yusaku)

Yusaku Sako %!s(int64=12) %!d(string=hai) anos
pai
achega
34f907c1a1

+ 9 - 6
ambari-web/app/controllers/main/admin/security/add/step4.js

@@ -237,8 +237,8 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
     var configs = this.get('secureMapping').filterProperty('foreignKey', null);
     configs.forEach(function (_config) {
       var value = _config.value;
-      if (_config.hasOwnProperty('dependedServiceName') && _config.hasOwnProperty('replace')) {
-        value = this.checkServiceForConfigValue(value, _config.dependedServiceName, _config.replace);
+      if (_config.hasOwnProperty('dependedServiceName')) {
+        value = this.checkServiceForConfigValue(value, _config.dependedServiceName);
       }
       value = this.getGlobConfigValue(_config.templateName, value, _config.name);
       uiConfig.pushObject({
@@ -264,10 +264,13 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
   },
 
 
-  checkServiceForConfigValue: function (value, serviceName, replace) {
-    if (!App.Service.find().mapProperty('serviceName').contains(serviceName)) {
-      value = value.replace(replace, '');
-    }
+  checkServiceForConfigValue: function (value, serviceNames) {
+    serviceNames.forEach(function(_serviceName){
+      if (!App.Service.find().mapProperty('serviceName').contains(_serviceName.name)) {
+        value = value.replace(_serviceName.replace, '');
+      }
+    },this);
+
     return value;
   },
 

+ 4 - 6
ambari-web/app/data/secure_mapping.js

@@ -36,13 +36,12 @@ module.exports = [
 
   {
     "name": "hadoop.security.auth_to_local",
-    "templateName": ["jobtracker_primary_name", "kerberos_domain", "mapred_user", "tasktracker_primary_name", "namenode_primary_name", "hdfs_user", "datanode_primary_name", "hbase_master_primary_name", "hbase_user","hbase_regionserver_primary_name"],
+    "templateName": ["jobtracker_primary_name", "kerberos_domain", "mapred_user", "tasktracker_primary_name", "namenode_primary_name", "hdfs_user", "datanode_primary_name", "hbase_master_primary_name", "hbase_user","hbase_regionserver_primary_name","oozie_primary_name","oozie_user"],
     "foreignKey": null,
-    "value": "RULE:[2:$1@$0](<templateName[0]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[3]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[4]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[6]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nDEFAULT",
+    "value": "RULE:[2:$1@$0](<templateName[0]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[3]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[4]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[6]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[10]>@.*<templateName[1]>)s/.*/<templateName[11]>/\nDEFAULT",
     "filename": "core-site.xml",
     "serviceName": "HDFS",
-    "dependedServiceName": "HBASE",
-    "replace": "\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/"
+    "dependedServiceName": [{name: "HBASE", replace: "\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/"},{name: "OOZIE",replace: "\nRULE:[2:$1@$0](<templateName[10]>@.*<templateName[1]>)s/.*/<templateName[11]>/"}]
   },
   {
     "name": "dfs.namenode.kerberos.principal",
@@ -346,8 +345,7 @@ module.exports = [
     "value": "RULE:[2:$1@$0](<templateName[0]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[3]>@.*<templateName[1]>)s/.*/<templateName[2]>/\nRULE:[2:$1@$0](<templateName[4]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[6]>@.*<templateName[1]>)s/.*/<templateName[5]>/\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nDEFAULT",
     "filename": "oozie-site.xml",
     "serviceName": "OOZIE",
-    "dependedServiceName": "HBASE",
-    "replace": "\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/"
+    "dependedServiceName": [{name: "HBASE", replace: "\nRULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/\nRULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/"}]
   },
   {
     "name": "templeton.kerberos.principal",