Browse Source

AMBARI-1545. Integrate Frontend Security work to enable security on HDFS and MapReduce installed cluster. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1452431 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 years ago
parent
commit
8d742cf654

+ 3 - 0
CHANGES.txt

@@ -12,6 +12,9 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1545. Integrate Frontend Security work to enable security on HDFS
+ and MapReduce installed cluster. (jaimin)
+
  AMBARI-1528. Upgrade request support at Ambari. (Sumit Mohanty via swagle)
 
  AMBARI-1541. Upgrade task support in agent. (Sumit Mohanty via swagle)

+ 35 - 5
ambari-web/app/controllers/main/admin.js

@@ -22,6 +22,7 @@ App.MainAdminController = Em.Controller.extend({
   name: 'mainAdminController',
   category: 'user',
   securityEnabled: false,
+  serviceUsers: [],
 
   /**
    * return true if security status is loaded and false otherwise
@@ -48,6 +49,7 @@ App.MainAdminController = Em.Controller.extend({
     $.ajax({
       type: 'GET',
       url: url,
+      async: false,    // we are retrieving user information that is used ahead in addSecurity/apply stage
       timeout: 10000,
       dataType: 'text',
       success: function (data) {
@@ -57,12 +59,16 @@ App.MainAdminController = Em.Controller.extend({
         if ('global' in configs) {
           self.getServiceConfigsFromServer(dfd, 'global', configs['global']);
         } else {
-          dfd.reject();
+          if (dfd) {
+            dfd.reject();
+          }
         }
       },
 
       error: function (request, ajaxOptions, error) {
-        dfd.reject();
+        if (dfd) {
+          dfd.reject();
+        }
       },
 
       statusCode: require('data/statusCodes')
@@ -75,7 +81,7 @@ App.MainAdminController = Em.Controller.extend({
     $.ajax({
       type: 'GET',
       url: url,
-      async: true,
+      async: false, // we are retrieving user information that is used ahead in addSecurity/apply stage
       timeout: 10000,
       dataType: 'json',
       success: function (data) {
@@ -85,17 +91,41 @@ App.MainAdminController = Em.Controller.extend({
         if (configs && configs['security_enabled'] === 'true') {
           self.set('securityEnabled', true);
         } else {
+          self.loadUsers(configs);
           self.set('securityEnabled', false);
         }
-        dfd.resolve();
+        if (dfd) {
+          dfd.resolve();
+        }
       },
 
       error: function (request, ajaxOptions, error) {
-        dfd.reject();
+        if (dfd) {
+          dfd.reject();
+        }
       },
 
       statusCode: require('data/statusCodes')
     });
+  },
+
+  loadUsers: function (configs) {
+    var serviceUsers = this.get('serviceUsers');
+    if (configs['hdfs_user']) {
+      serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: configs['hdfs_user']});
+    } else {
+      serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hdfs'});
+    }
+    if (configs['mapred_user']) {
+      serviceUsers.pushObject({id: 'puppet var', name: 'mapred_user', value: configs['mapred_user']});
+    } else {
+      serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'mapred'});
+    }
+    if (configs['hbase_user']) {
+      serviceUsers.pushObject({id: 'puppet var', name: 'hbase_user', value: configs['hbase_user']});
+    } else {
+      serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hbase'});
+    }
   }
 
 });

+ 14 - 14
ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js

@@ -29,11 +29,11 @@ App.AddSecurityController = App.WizardController.extend({
     serviceConfigProperties: null,
     controllerName: 'addSecurityController',
 
-    saveCurrentStage: function(stage) {
+    saveCurrentStage: function (stage) {
       App.db.setSecurityStage(stage);
     },
 
-    loadCurrentStage: function() {
+    loadCurrentStage: function () {
       return App.db.getSecurityStage();
     }
   }),
@@ -63,7 +63,7 @@ App.AddSecurityController = App.WizardController.extend({
    * loads the status of stages of step3 from localDb
    */
 
-  loadStages: function() {
+  loadStages: function () {
 
   },
 
@@ -83,8 +83,6 @@ App.AddSecurityController = App.WizardController.extend({
   },
 
 
-
-
   /**
    * Loads all installed services
    */
@@ -125,15 +123,17 @@ App.AddSecurityController = App.WizardController.extend({
           var value = _configProperties.get('value').trim().split(/\s+/g).join(',');
           _configProperties.set('value', value);
         }
-        var configProperty = {
-          id: _configProperties.get('id'),
-          name: _configProperties.get('name'),
-          value: _configProperties.get('value'),
-          defaultValue: _configProperties.get('defaultValue'),
-          service: _configProperties.get('serviceName'),
-          filename: _configProperties.get('filename')
-        };
-        serviceConfigProperties.push(configProperty);
+        if (_configProperties.get('value')) {
+          var configProperty = {
+            id: _configProperties.get('id'),
+            name: _configProperties.get('name'),
+            value: _configProperties.get('value'),
+            defaultValue: _configProperties.get('defaultValue'),
+            service: _configProperties.get('serviceName'),
+            filename: _configProperties.get('filename')
+          };
+          serviceConfigProperties.push(configProperty);
+        }
       }, this);
 
     }, this);

+ 7 - 6
ambari-web/app/controllers/main/admin/security/add/step2.js

@@ -26,7 +26,7 @@ App.MainAdminSecurityAddStep2Controller = Em.Controller.extend({
   selectedService: null,
 
   isSubmitDisabled: function () {
-    return !this.stepConfigs.everyProperty('errorCount', 0);
+    return !this.stepConfigs.filterProperty('showConfig', true).everyProperty('errorCount', 0);
   }.property('stepConfigs.@each.errorCount'),
 
   clearStep: function () {
@@ -74,26 +74,26 @@ App.MainAdminSecurityAddStep2Controller = Em.Controller.extend({
    * @param serviceConfigs
    */
   renderServiceConfigs: function (serviceConfigs) {
-    serviceConfigs.forEach(function (_serviceConfig) {
+    this.get('serviceConfigs').forEach(function (_serviceConfig) {
 
       var serviceConfig = App.ServiceConfig.create({
         filename: _serviceConfig.filename,
         serviceName: _serviceConfig.serviceName,
         displayName: _serviceConfig.displayName,
         configCategories: _serviceConfig.configCategories,
-        showConfig: true,
+        showConfig: false,
         configs: []
       });
+      if (this.get('content.services').mapProperty('serviceName').contains(_serviceConfig.serviceName)) {
+        serviceConfig.set('showConfig', true);
+      }
 
       this.loadComponentConfigs(_serviceConfig, serviceConfig);
 
       console.log('pushing ' + serviceConfig.serviceName, serviceConfig);
 
       this.get('stepConfigs').pushObject(serviceConfig);
-
-
     }, this);
-
     this.set('selectedService', this.get('stepConfigs').filterProperty('showConfig', true).objectAt(0));
   },
 
@@ -113,6 +113,7 @@ App.MainAdminSecurityAddStep2Controller = Em.Controller.extend({
     }, this);
   },
 
+
   /**
    *  submit and move to step3
    */

+ 60 - 38
ambari-web/app/controllers/main/admin/security/add/step3.js

@@ -27,17 +27,17 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
   secureServices: [],
   serviceConfigTags: [],
   globalProperties: [],
+  serviceUsersBinding: 'App.router.mainAdminController.serviceUsers',
 
   clearStep: function () {
     this.get('stages').clear();
   },
 
-  loadStep: function () {
+  loadStep1: function () {
     this.clearStep();
     this.loadStages();
     this.addInfoToStages();
     this.prepareSecureConfigs();
-    // this.populateSuccededStages();
     this.moveToNextStage();
   },
 
@@ -50,15 +50,6 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
     ]);
   },
 
-  populateSuccededStages: function () {
-    var currentStage = 'stage' + this.get('content').loadCurrentStage();
-    var inc = 1;
-    while (inc < currentStage) {
-      var stage = 'stage' + inc;
-      this.get('stages').findProperty('stage', stage).setProperties({ isStarted: true, isCompleted: true });
-    }
-  },
-
   startStage: function () {
     var startedStages = this.get('stages').filterProperty('isStarted', true);
     if (startedStages.length) {
@@ -78,14 +69,19 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
   }.observes('stages.@each.isStarted'),
 
   onCompleteStage: function () {
-    var index = this.get('stages').filterProperty('isSuccess', true).length;
+    var index = this.get('stages').filterProperty('isCompleted', true).length;
     if (index > 0) {
-      this.moveToNextStage();
+      var self = this;
+      var lastCompletedStageResult = this.get('stages').objectAt(index - 1).get('isSuccess');
+      if (lastCompletedStageResult) {
+        window.setTimeout(function () {
+          self.moveToNextStage();
+        }, 50);
+      }
     }
-  }.observes('stages.@each.isSuccess'),
+  }.observes('stages.@each.isCompleted'),
 
   addInfoToStages: function () {
-    // this.addInfoToStage1();
     this.addInfoToStage2();
     this.addInfoToStage3();
     this.addInfoToStage4();
@@ -94,7 +90,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
   addInfoToStage1: function () {
     var stage1 = this.get('stages').findProperty('stage', 'stage1');
     if (App.testMode) {
-      stage1.set('isSucces', true);
+      stage1.set('isSuccess', true);
       stage1.set('isStarted', true);
       stage1.set('isCompleted', true);
     }
@@ -145,6 +141,25 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
     return uiConfig;
   },
 
+  appendInstanceName: function (name, property) {
+    var newValue;
+    if (this.get('globalProperties').someProperty('name', name)) {
+      var globalProperty = this.get('globalProperties').findProperty('name', name);
+      newValue = globalProperty.value;
+      var isInstanceName = this.get('globalProperties').findProperty('name', 'instance_name');
+      if (isInstanceName) {
+        if (/primary_name?$/.test(globalProperty.name) && property !== 'hadoop.security.auth_to_local') {
+          if (!/_HOST?$/.test(newValue)) {
+            newValue = newValue + '/_HOST';
+          }
+        }
+      }
+    } else {
+      console.log("The template name does not exist in secure_properties file");
+      newValue = null;
+    }
+    return newValue;
+  },
 
   /**
    * Set all site property that are derived from other puppet-variable
@@ -157,13 +172,12 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
       return expression;
     }
     express.forEach(function (_express) {
-      console.log("The value of template is: " + _express);
-      if (_express.match(/\[([\d]*)(?=\])/ === null)) {
-      }
+      //console.log("The value of template is: " + _express);
       var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
       if (this.get('globalProperties').someProperty('name', templateName[index])) {
         //console.log("The name of the variable is: " + this.get('content.serviceConfigProperties').findProperty('name', templateName[index]).name);
-        var globValue = this.get('globalProperties').findProperty('name', templateName[index]).value;
+        var globValue = this.appendInstanceName(templateName[index], name);
+        console.log('The template value of templateName ' + '[' + index + ']' + ': ' + templateName[index] + ' is: ' + globValue);
         if (value !== null) {   // if the property depends on more than one template name like <templateName[0]>/<templateName[1]> then don't proceed to the next if the prior is null or not found in the global configs
           value = value.replace(_express, globValue);
         }
@@ -228,8 +242,8 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
       templateValue.forEach(function (_value) {
         var index = parseInt(_value.match(/\[([\d]*)(?=\])/)[1]);
         if (this.get('globalProperties').someProperty('name', config.templateName[index])) {
-          var globalValue = this.get('globalProperties').findProperty('name', config.templateName[index]).value;
-          config.value = config.value.replace(_value, globalValue);
+          var globValue = this.appendInstanceName(config.templateName[index]);
+          config.value = config.value.replace(_value, globValue);
         } else {
           config.value = null;
         }
@@ -237,10 +251,8 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
     }
   },
 
-
   prepareSecureConfigs: function () {
     this.loadGlobals();
-    this.loadInstanceName();
     var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property');
     var uiConfigs = this.loadUiSideConfigs();
     this.set('configs', storedConfigs.concat(uiConfigs));
@@ -249,25 +261,34 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
   loadGlobals: function () {
     var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
     this.set('globalProperties', globals);
+    this.loadUsersToGlobal();
   },
 
-  loadInstanceName: function () {
-    var isInstanceName = this.get('globalProperties').findProperty('name', 'instance_name');
-    if (isInstanceName) {
-      this.get('globalProperties').forEach(function (_globalProperty) {
-        if (/primary_name?$/.test(_globalProperty.name)) {
-          if (!/_HOST?$/.test(_globalProperty.value)) {
-            _globalProperty.value = _globalProperty.value + "/_HOST";
-          }
-        }
-      }, this);
+  loadUsersToGlobal: function () {
+    if (!this.get('serviceUsers').length) {
+      this.loadUsersFromServer();
+    }
+    App.router.get('mainAdminController.serviceUsers').forEach(function (_user) {
+      this.get('globalProperties').pushObject(_user);
+    }, this);
+  },
+
+  loadUsersFromServer: function () {
+    var self = this;
+    if (App.testMode) {
+      var serviceUsers = this.get('serviceUsers');
+      serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hdfs'});
+      serviceUsers.pushObject({id: 'puppet var', name: 'mapred_user', value: 'mapred'});
+      serviceUsers.pushObject({id: 'puppet var', name: 'hbase_user', value: 'hbase'});
+    } else {
+      App.router.get('mainAdminController').getHDFSDetailsFromServer();
     }
   },
 
   loadConfigsForAllServices: function () {
-    this.set('noOfWaitingAjaxCalls', this.get('content.services').length - 2);
+    this.set('noOfWaitingAjaxCalls', this.get('content.services').length - 1);
     this.get('content.services').forEach(function (_secureService, index) {
-      if (_secureService.serviceName !== 'GENERAL' && _secureService.serviceName !== 'NAGIOS') {
+      if (_secureService.serviceName !== 'GENERAL') {
         this.getConfigDetailsFromServer(_secureService, index);
       }
     }, this);
@@ -383,9 +404,10 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
 
   applyConfigurationToServices: function () {
     this.applyHdfsCoretoMaprCore();
-    this.set('noOfWaitingAjaxCalls', this.get('content.services').length-2);
+    this.set('noOfWaitingAjaxCalls', this.get('content.services').length - 1);
+    this.set('noOfWaitingAjaxCalls', this.get('content.services').length - 1);
     this.get('content.services').forEach(function (_service) {
-      if (_service.serviceName !== 'GENERAL' && _service.serviceName !== 'NAGIOS') {
+      if (_service.serviceName !== 'GENERAL') {
         var data = {config: {}};
         this.get('serviceConfigTags').filterProperty('serviceName', _service.serviceName).forEach(function (_serviceConfig) {
           data.config[_serviceConfig.siteName] = _serviceConfig.newTagName;

+ 33 - 21
ambari-web/app/controllers/main/admin/security/disable.js

@@ -21,6 +21,7 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
 
   name: 'mainAdminSecurityDisableController',
   configMapping: require('data/secure_mapping').slice(0),
+  secureProperties: require('data/secure_properties').configProperties.slice(0),
   stages: [],
   configs: [],
   noOfWaitingAjaxCalls: 0,
@@ -69,11 +70,16 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
   }.observes('stages.@each.isStarted'),
 
   onCompleteStage: function () {
-    var index = this.get('stages').filterProperty('isSuccess', true).length;
+    var index = this.get('stages').filterProperty('isCompleted', true).length;
     if (index > 0) {
-      this.moveToNextStage();
+      var self = this;
+      var lastCompletedStageResult = this.get('stages').objectAt(index - 1).get('isSuccess');
+      if (lastCompletedStageResult) {
+        self.moveToNextStage();
+      }
     }
-  }.observes('stages.@each.isSuccess'),
+  }.observes('stages.@each.isCompleted'),
+
 
   addInfoToStages: function () {
     this.addInfoToStage2();
@@ -110,7 +116,7 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
     stage4.set('data', data);
   },
 
-  loadSecureServices: function() {
+  loadSecureServices: function () {
     var secureServices = require('data/secure_configs');
     var installedServices = App.Service.find().mapProperty('serviceName');
     //General (only non service tab) tab is always displayed
@@ -157,11 +163,9 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
     });
   },
   loadConfigsForAllServices: function () {
-    this.set('noOfWaitingAjaxCalls', this.get('secureServices').length - 1);
+    this.set('noOfWaitingAjaxCalls', this.get('secureServices').length);
     this.get('secureServices').forEach(function (_secureService, index) {
-      if (_secureService.serviceName !== 'GENERAL' && _secureService.serviceName !== 'NAGIOS') {
-        this.getConfigDetailsFromServer(_secureService, index);
-      }
+      this.getConfigDetailsFromServer(_secureService, index);
     }, this);
   },
 
@@ -275,15 +279,14 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
 
   applyConfigurationToServices: function () {
     this.applyHdfsCoretoMaprCore();
-    this.set('noOfWaitingAjaxCalls', this.get('secureServices').length-1);
+    this.set('noOfWaitingAjaxCalls', this.get('secureServices').length);
     this.get('secureServices').forEach(function (_service) {
-      if (_service.serviceName !== 'GENERAL' && _service.serviceName !== 'NAGIOS') {
-        var data = {config: {}};
-        this.get('serviceConfigTags').filterProperty('serviceName', _service.serviceName).forEach(function (_serviceConfig) {
-          data.config[_serviceConfig.siteName] = _serviceConfig.newTagName;
-        }, this);
-        this.applyConfToService(_service.serviceName, data);
-      }
+      var data = {config: {}};
+      this.get('serviceConfigTags').filterProperty('serviceName', _service.serviceName).forEach(function (_serviceConfig) {
+        data.config[_serviceConfig.siteName] = _serviceConfig.newTagName;
+      }, this);
+      this.applyConfToService(_service.serviceName, data);
+
     }, this);
   },
 
@@ -334,16 +337,25 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
     this.get('serviceConfigTags').forEach(function (_serviceConfigTags, index) {
       if (_serviceConfigTags.siteName === 'global') {
         _serviceConfigTags.newTagName = 'version' + (new Date).getTime() + index;
-        if ('security_enabled' in _serviceConfigTags.configs) {
-          _serviceConfigTags.configs.security_enabled = false;
-        }
+        this.get('secureProperties').forEach(function (_config) {
+          if (_config.name in _serviceConfigTags.configs) {
+            delete _serviceConfigTags.configs[_config.name];
+          }
+        }, this);
+        _serviceConfigTags.configs.security_enabled = false;
       } else {
         _serviceConfigTags.newTagName = 'version' + (new Date).getTime();
         this.get('configMapping').filterProperty('filename', _serviceConfigTags.siteName + '.xml').forEach(function (_config) {
           if (_config.name in _serviceConfigTags.configs) {
-            delete _serviceConfigTags.configs[_config.name];
+            if (_config.name === 'dfs.datanode.address') {
+              _serviceConfigTags.configs[_config.name] = '0.0.0.0:50010';
+            } else if (_config.name === 'dfs.datanode.http.address') {
+              _serviceConfigTags.configs[_config.name] = '0.0.0.0:50075';
+            } else {
+              delete _serviceConfigTags.configs[_config.name];
+            }
           }
-          console.log("*******Not Deleted" +  _config.name);
+          console.log("Not Deleted" + _config.name);
         }, this);
       }
     }, this);

+ 1 - 1
ambari-web/app/controllers/wizard/step8_controller.js

@@ -1579,7 +1579,7 @@ App.WizardStep8Controller = Em.Controller.extend({
     this.get('ajaxQueue').pushObject(params);
   }
 
-})
+});
 
 
 

+ 0 - 14
ambari-web/app/data/config_properties.js

@@ -734,20 +734,6 @@ module.exports =
       "serviceName": "MISC",
       "category": "Advanced"
     },
-    {
-      "id": "puppet var",
-      "name": "dfs_datanode_http_address",
-      "displayName": "dfs_datanode_http_address",
-      "description": "",
-      "defaultValue": "50075",
-      "isReconfigurable": true,
-      "displayType": "int",
-      "isVisible": true,
-      "filename": "hdfs-site.xml",
-      "domain": "global",
-      "serviceName": "MISC",
-      "category": "Advanced"
-    },
     {
       "id": "puppet var",
       "name": "dfs_datanode_data_dir_perm",

+ 12 - 20
ambari-web/app/data/secure_configs.js

@@ -29,7 +29,7 @@ module.exports = [
     displayName: 'CLUSTER',
     filename: 'hdfs-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'KERBEROS'})
+      App.ServiceConfigCategory.create({ name: 'KERBEROS', displayName: 'KERBEROS'})
     ],
     configs: configProperties.filterProperty('serviceName', 'GENERAL')
   },
@@ -38,10 +38,10 @@ module.exports = [
     displayName: 'HDFS',
     filename: 'hdfs-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'General'}),
-      App.ServiceConfigCategory.create({ name: 'NameNode'}),
-      App.ServiceConfigCategory.create({ name: 'SNameNode'}),
-      App.ServiceConfigCategory.create({ name: 'DataNode'})
+      App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
+      App.ServiceConfigCategory.create({ name: 'NameNode', displayName: 'NameNode'}),
+     // App.ServiceConfigCategory.create({ name: 'SNameNode'}),
+      App.ServiceConfigCategory.create({ name: 'DataNode', displayName: 'DataNode'})
     ],
     configs: configProperties.filterProperty('serviceName', 'HDFS')
   },
@@ -51,8 +51,8 @@ module.exports = [
     displayName: 'MapReduce',
     filename: 'mapred-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'JobTracker'}),
-      App.ServiceConfigCategory.create({ name: 'TaskTracker'})
+      App.ServiceConfigCategory.create({ name: 'JobTracker', displayName: 'JobTracker'}),
+      App.ServiceConfigCategory.create({ name: 'TaskTracker', displayName: 'TaskTracker'})
     ],
     configs: configProperties.filterProperty('serviceName', 'MAPREDUCE')
   },
@@ -62,7 +62,7 @@ module.exports = [
     displayName: 'Hive/HCat',
     filename: 'hive-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'Hive Metastore'})
+      App.ServiceConfigCategory.create({ name: 'Hive Metastore', displayName: 'Hive Metastore'})
     ],
     configs: configProperties.filterProperty('serviceName', 'HIVE')
   },
@@ -72,7 +72,7 @@ module.exports = [
     displayName: 'WebHCat',
     filename: 'webhcat-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'WebHCat'})
+      App.ServiceConfigCategory.create({ name: 'WebHCat', displayName: 'WebHCat'})
     ],
     configs: configProperties.filterProperty('serviceName', 'WEBHCAT')
   },
@@ -82,11 +82,11 @@ module.exports = [
     displayName: 'HBase',
     filename: 'hbase-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'HBase Master'}),
-      App.ServiceConfigCategory.create({ name: 'RegionServer'})
+      App.ServiceConfigCategory.create({ name: 'HBase Master', displayName: 'HBase Master'}),
+      App.ServiceConfigCategory.create({ name: 'RegionServer', displayName: 'RegionServer'})
     ],
     configs: configProperties.filterProperty('serviceName', 'HBASE')
-  },
+  }
   /*
   {
     serviceName: 'ZOOKEEPER',
@@ -109,12 +109,4 @@ module.exports = [
     configs: configProperties.filterProperty('serviceName', 'OOZIE')
   },
   */
-  {
-    serviceName: 'NAGIOS',
-    displayName: 'Nagios',
-    configCategories: [
-      App.ServiceConfigCategory.create({ name: 'General'})
-    ],
-    configs: configProperties.filterProperty('serviceName', 'NAGIOS')
-  }
 ];

+ 35 - 19
ambari-web/app/data/secure_mapping.js

@@ -31,17 +31,19 @@ module.exports = [
     "value": "true",
     "filename": "core-site.xml"
   },
- // {
-   // "name": "hadoop.security.auth_to_local",
-   // "templateName": [""],
-   //"foreignKey": null,
-   // "value": "RULE:[2:$1@$0]([<templateName[0]>]t@.*<templateName[1]>)s/.*/$MAPRED_USER/ RULE:[2:$1@$0]([<templateName[2]>]n@.*<templateName[1]>)s/.*/$HDFS_USER/ RULE:[2:$1@$0](<templateName[3]>@.*<templateName[1]>)s/.*/$HBASE_USER/ RULE:[2:$1@$0](<templateName[4]>@.*<templateName[1]>)s/.*/$HABSE_USER/ DEFAULT",
-   // "filename": "core-site.xml"
- // },
+
+  {
+    "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", "regionserver_primary_name"],
+    "foreignKey": null,
+    "value": "RULE:[2:$1@$0](<templateName[0]>@.*<templateName[1]>)s/.*/<templateName[2]>/ RULE:[2:$1@$0](<templateName[3]>@.*<templateName[1]>)s/.*/<templateName[2]>/ RULE:[2:$1@$0](<templateName[4]>@.*<templateName[1]>)s/.*/<templateName[5]>/ RULE:[2:$1@$0](<templateName[6]>@.*<templateName[1]>)s/.*/<templateName[5]>/ RULE:[2:$1@$0](<templateName[7]>@.*<templateName[1]>)s/.*/<templateName[8]>/ RULE:[2:$1@$0](<templateName[9]>@.*<templateName[1]>)s/.*/<templateName[8]>/ DEFAULT",
+    "filename": "core-site.xml"
+  },
+
 
   {
     "name": "dfs.namenode.kerberos.principal",
-    "templateName": ["namenode_primary_name","realm_name"],
+    "templateName": ["namenode_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hdfs-site.xml"
@@ -55,21 +57,21 @@ module.exports = [
   },
   {
     "name": "dfs.secondary.namenode.kerberos.principal",
-    "templateName": ["snamenode_primary_name","realm_name"],
+    "templateName": ["namenode_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hdfs-site.xml"
   },
   {
     "name": "dfs.secondary.namenode.keytab.file",
-    "templateName": ["snamenode_keytab"],
+    "templateName": ["namenode_keytab"],
     "foreignKey": null,
     "value": "<templateName[0]>",
     "filename": "hdfs-site.xml"
   },
   {
     "name": "dfs.web.authentication.kerberos.principal",
-    "templateName": ["hadoop_http_primary_name","realm_name"],
+    "templateName": ["hadoop_http_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hdfs-site.xml"
@@ -83,7 +85,7 @@ module.exports = [
   },
   {
     "name": "dfs.datanode.kerberos.principal",
-    "templateName": ["datanode_primary_name","realm_name"],
+    "templateName": ["datanode_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hdfs-site.xml"
@@ -109,9 +111,23 @@ module.exports = [
     "value": "${dfs.web.authentication.kerberos.principal}",
     "filename": "hdfs-site.xml"
   },
+  {
+    "name": "dfs.datanode.address",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "0.0.0.0:1019",
+    "filename": "hdfs-site.xml"
+  },
+  {
+    "name": "dfs.datanode.http.address",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "0.0.0.0:1022",
+    "filename": "hdfs-site.xml"
+  },
   {
     "name": "mapreduce.jobtracker.kerberos.principal",
-    "templateName": ["jobtracker_primary_name","realm_name"],
+    "templateName": ["jobtracker_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "mapred-site.xml"
@@ -125,7 +141,7 @@ module.exports = [
   },
   {
     "name": "mapreduce.tasktracker.kerberos.principal",
-    "templateName": ["tasktracker_primary_name","realm_name"],
+    "templateName": ["tasktracker_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "mapred-site.xml"
@@ -139,7 +155,7 @@ module.exports = [
   },
   {
     "name": "hbase.master.kerberos.principal",
-    "templateName": ["hbase_master_primary_name","realm_name"],
+    "templateName": ["hbase_master_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hbase-site.xml"
@@ -153,7 +169,7 @@ module.exports = [
   },
   {
     "name": "hbase.regionserver.kerberos.principal",
-    "templateName": ["regionserver_primary_name","realm_name"],
+    "templateName": ["regionserver_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hbase-site.xml"
@@ -181,7 +197,7 @@ module.exports = [
   },
   {
     "name": "hive.metastore.kerberos.principal",
-    "templateName": ["hive_metastore_primary_name","realm_name"],
+    "templateName": ["hive_metastore_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hive-site.xml"
@@ -195,7 +211,7 @@ module.exports = [
   },
   {
     "name": "hive.server2.authentication.kerberos.principal",
-    "templateName": ["hive_metastore_primary_name","realm_name"],
+    "templateName": ["hive_metastore_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hive-site.xml"
@@ -209,7 +225,7 @@ module.exports = [
   },
   {
     "name": "templeton.kerberos.principal",
-    "templateName": ["webhcat_http_primary_name","realm_name"],
+    "templateName": ["webhcat_http_primary_name", "kerberos_domain"],
     "foreignKey": null,
     "value": "<templateName[0]>@<templateName[1]>",
     "filename": "hive-site.xml"

+ 80 - 34
ambari-web/app/data/secure_properties.js

@@ -18,7 +18,6 @@
 module.exports =
 {
   "configProperties": [
-    //GENERAL
     {
       "id": "puppet var",
       "name": "security_enabled",
@@ -26,6 +25,40 @@ module.exports =
       "value": "",
       "defaultValue": "true",
       "description": "Enable kerberos security for the cluster",
+      "isVisible": false,
+      "serviceName": "GENERAL",
+      "category": "KERBEROS"
+    },
+    {
+      "id": "puppet var",
+      "name": "kinit_path_local",
+      "displayName": "Path to kinit",
+      "value": "",
+      "defaultValue": "/usr/bin/kinit",
+      "description": "Path to installed kinit command",
+      "displayType": "principal",
+      "isVisible": false,
+      "serviceName": "GENERAL",
+      "category": "KERBEROS"
+    },
+    {
+      "id": "puppet var",
+      "name": "kerberos_install_type",
+      "displayName": "Type of security",
+      "value": "",
+      "defaultValue": "MANUALLY_SET_KERBEROS",
+      "description": "Type of kerberos security for the cluster",
+      "isVisible": false,
+      "serviceName": "GENERAL",
+      "category": "KERBEROS"
+    },
+    {
+      "id": "puppet var",
+      "name": "keytab_path",
+      "displayName": "Path to keytab file",
+      "value": "",
+      "defaultValue": "/etc/security/keytabs",
+      "description": "Type of kerberos security for the cluster",
       "displayType": "principal",
       "isVisible": false,
       "serviceName": "GENERAL",
@@ -33,10 +66,10 @@ module.exports =
     },
     {
       "id": "puppet var",
-      "name": "realm_name",
+      "name": "kerberos_domain",
       "displayName": "Realm name",
       "value": "",
-      "defaultValue": "EXAMPLE",
+      "defaultValue": "EXAMPLE.COM",
       "description": "Realm name to be used for all principal names",
       "displayType": "principal",
       "isVisible": true,
@@ -46,15 +79,16 @@ module.exports =
     {
       "id": "puppet var",
       "name": "instance_name",
-      "displayName": "Instance name",
+      "displayName": "Use Instance name",
       "value": "",
-      "defaultValue": "EXAMPLE",
+      "defaultValue": true,
       "description": "Whether to use instance name for creating principals across cluster",
       "displayType": "checkbox",
       "isVisible": true,
       "serviceName": "GENERAL",
       "category": "KERBEROS"
     },
+
     //HDFS
     {
       "id": "puppet var",
@@ -71,9 +105,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "namenode_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to Keytab File",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs/nn.service.keytab",
       "description": "Keytab for NameNode",
       "displayType": "directory",
       "isVisible": true,
@@ -96,9 +130,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "hadoop_http_keytab",
-      "displayName": "HTTP Keytab Path",
+      "displayName": "Path to HTTP keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs/spnego.service.keytab",
       "description": "Keytab for http NameNode and SNameNode",
       "displayType": "directory",
       "isVisible": true,
@@ -120,10 +154,10 @@ module.exports =
     {
       "id": "puppet var",
       "name": "snamenode_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to keytab file",
       "value": "",
-      "defaultValue": "",
-      "description": "Keytab for SecondaryNameNode",
+      "defaultValue": "/etc/security/keytabs/nn.service.keytab",
+      "description": "path to SecondaryNameNode keytab file",
       "displayType": "directory",
       "isVisible": true,
       "serviceName": "HDFS",
@@ -144,10 +178,10 @@ module.exports =
     {
       "id": "puppet var",
       "name": "datanode_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to Keytab file",
       "value": "",
-      "defaultValue": "",
-      "description": "Keytab for DataNode",
+      "defaultValue": "/etc/security/keytabs/dn.service.keytab",
+      "description": "Path to DataNode keytab file",
       "displayType": "directory",
       "isVisible": true,
       "serviceName": "HDFS",
@@ -169,10 +203,10 @@ module.exports =
     {
       "id": "puppet var",
       "name": "jobtracker_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to keytab file",
       "value": "",
-      "defaultValue": "",
-      "description": "keytab for JobTracker",
+      "defaultValue": "/etc/security/keytabs/jt.service.keytab",
+      "description": "Path to JobTracker keytab file",
       "displayType": "directory",
       "isVisible": true,
       "serviceName": "MAPREDUCE",
@@ -193,9 +227,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "tasktracker_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs/tt.service.keytab",
       "description": "keytab for TaskTracker",
       "displayType": "directory",
       "isVisible": true,
@@ -219,9 +253,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "hbase_master_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to Keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "keytab for HBase master",
       "displayType": "directory",
       "isVisible": true,
@@ -243,9 +277,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "regionserver_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to Keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "keytab for RegionServer",
       "displayType": "directory",
       "isVisible": true,
@@ -269,9 +303,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "hive_metastore__keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to Keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "keytab for Hive Metastore",
       "displayType": "directory",
       "isVisible": true,
@@ -296,9 +330,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "oozie_keytab",
-      "displayName": "Keytab Path",
+      "displayName": "Path to keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "Keytab for Oozie server",
       "displayType": "directory",
       "isVisible": true,
@@ -321,9 +355,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "oozie_http_keytab",
-      "displayName": "HTTP Keytab Path",
+      "displayName": "Path to HTTP Keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "Keytab for http Oozie server",
       "displayType": "directory",
       "isVisible": true,
@@ -349,9 +383,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "webhcat_http_keytab",
-      "displayName": "HTTP Keytab Path",
+      "displayName": "Path to HTTP Keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "Keytab for http webHCat",
       "displayType": "directory",
       "isVisible": true,
@@ -361,6 +395,18 @@ module.exports =
     //HUE
 
     //NAGIOS
+    {
+      "id": "puppet var",
+      "name": "nagios_server_name",
+      "displayName": "Nagios server host",
+      "value": "",
+      "defaultValue": "",
+      "description": "Nagios server host",
+      "displayType": "masterHosts",
+      "isVisible": true,
+      "serviceName": "NAGIOS",
+      "category": "General"
+    },
     {
       "id": "puppet var",
       "name": "nagios_primary_name",
@@ -376,9 +422,9 @@ module.exports =
     {
       "id": "puppet var",
       "name": "nagios_keytab",
-      "displayName": "Keytab Path",
+      "displayName": " Path to keytab file",
       "value": "",
-      "defaultValue": "",
+      "defaultValue": "/etc/security/keytabs",
       "description": "Keytab for nagios",
       "displayType": "directory",
       "isVisible": true,

+ 2 - 2
ambari-web/app/data/service_configs.js

@@ -121,10 +121,10 @@ module.exports = [
     serviceName: 'MISC',
     displayName: 'Misc',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'General'}),
+      App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
       App.ServiceConfigCategory.create({ name: 'Users and Groups', displayName : 'Users and Groups'})
     ],
     configs: configProperties.filterProperty('serviceName', 'MISC')
   }
 
-]
+];

+ 39 - 35
ambari-web/app/routes/add_security.js

@@ -20,44 +20,47 @@ module.exports = Em.Route.extend({
   route: '/addSecurity',
   App: require('app'),
   enter: function (router) {
-    console.log('in /hosts/add:enter');
-    router.get('mainAdminSecurityController').setAddSecurityWizardStatus('RUNNING');
+    console.log('in /security/add:enter');
 
     Ember.run.next(function () {
-      var mainAdminSecurityController = router.get('mainAdminSecurityController');
-      var addSecurityController = router.get('addSecurityController');
-      var currentStep = router.get('addSecurityController').get('currentStep');
-      App.router.get('updateController').set('isWorking', false);
-      App.ModalPopup.show({
-        classNames: ['full-width-modal'],
-        header: Em.I18n.t('admin.addSecurity.header'),
-        bodyClass: App.MainAdminSecurityAddMenuView.extend({
-          controllerBinding: 'App.router.addSecurityController'
-        }),
-        primary: Em.I18n.t('form.cancel'),
-        secondary: null,
-        showFooter: false,
+      if (!router.get('mainAdminController.securityEnabled')) {
+        router.get('mainAdminSecurityController').setAddSecurityWizardStatus('RUNNING');
+        var mainAdminSecurityController = router.get('mainAdminSecurityController');
+        var addSecurityController = router.get('addSecurityController');
+        var currentStep = router.get('addSecurityController').get('currentStep');
+        App.router.get('updateController').set('isWorking', false);
+        App.ModalPopup.show({
+          classNames: ['full-width-modal'],
+          header: Em.I18n.t('admin.addSecurity.header'),
+          bodyClass: App.MainAdminSecurityAddMenuView.extend({
+            controllerBinding: 'App.router.addSecurityController'
+          }),
+          primary: Em.I18n.t('form.cancel'),
+          secondary: null,
+          showFooter: false,
 
-        onPrimary: function () {
-          this.hide();
-          App.router.get('updateController').set('isWorking', true);
-          router.transitionTo('adminSecurity.index');
-        },
-        onClose: function () {
-          this.hide();
-          App.router.get('updateController').set('isWorking', true);
-          mainAdminSecurityController.setAddSecurityWizardStatus(null);
-          router.get('addSecurityController').setCurrentStep(1);
-          router.get('addSecurityController.content').saveCurrentStage(2);
-          router.transitionTo('adminSecurity.index');
-        },
-        didInsertElement: function () {
-          this.fitHeight();
-        }
-      });
-      App.router.transitionTo('step' + currentStep);
+          onPrimary: function () {
+            this.hide();
+            App.router.get('updateController').set('isWorking', true);
+            router.transitionTo('adminSecurity.index');
+          },
+          onClose: function () {
+            this.hide();
+            App.router.get('updateController').set('isWorking', true);
+            mainAdminSecurityController.setAddSecurityWizardStatus(null);
+            router.get('addSecurityController').setCurrentStep(1);
+            router.get('addSecurityController.content').saveCurrentStage(2);
+            router.transitionTo('adminSecurity.index');
+          },
+          didInsertElement: function () {
+            this.fitHeight();
+          }
+        });
+        App.router.transitionTo('step' + currentStep);
+      } else {
+        router.transitionTo('adminSecurity.index');
+      }
     });
-
   },
 
   step1: Em.Route.extend({
@@ -115,7 +118,8 @@ module.exports = Em.Route.extend({
     done: function (router, context) {
       //Logic on completion of the wizard
       //set stage to stage2 of step3
-      router.setAddSecurityWizardStatus(null);
+      router.get('mainAdminSecurityController').setAddSecurityWizardStatus(null);
+      router.transitionTo('adminSecurity.index');
     }
   }),
 

+ 2 - 2
ambari-web/app/views/main/admin/security/add/step3.js

@@ -34,11 +34,11 @@ App.StageStatusView = Em.View.extend({
 });
 
 App.StageSuccessView = Em.View.extend({
-  layout: Ember.Handlebars.compile('<i class="icon-ok icon-large"></i> Done')
+  template: Ember.Handlebars.compile('<i class="icon-ok icon-large"></i> Done')
 });
 
 App.StageFailureView = Em.View.extend({
-  layout: Ember.Handlebars.compile('<i class="icon-remove icon-large"></i> Failed')
+  template: Ember.Handlebars.compile('<i class="icon-remove icon-large"></i> Failed')
 });
 
 App.StageInProgressView = Em.View.extend({

+ 0 - 3
ambari-web/app/views/main/service/reconfigure.js

@@ -20,9 +20,6 @@ var App = require('app');
 App.MainServiceReconfigureView = Em.View.extend({
 
   templateName: require('templates/main/service/reconfigure'),
-  didInsertElement: function () {
-    this.get('controller').loadStep();
-  }
 
 });