浏览代码

AMBARI-9099. Collect LDAP URL and Principal container DN information for Active Directory Integration. (jaimin)

Jaimin Jetly 10 年之前
父节点
当前提交
698d030bd0

+ 39 - 0
ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+
+<configuration supports_final="false">
+  <property require-input="true">
+    <name>ldap_url</name>
+    <description>
+      The URL to the Active Directory LDAP Interface
+    </description>
+    <value></value>
+  </property>
+
+  <property require-input="true">
+    <name>container_dn</name>
+    <description>
+      The distinguished name (DN) of the container used store service principals
+    </description>
+    <value></value>
+  </property>
+</configuration>

+ 1 - 2
ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml

@@ -120,8 +120,7 @@
 
       <configuration-dependencies>
         <config-type>krb5-conf</config-type>
-        <config-type>kdc-conf</config-type>
-        <config-type>kadm5-acl</config-type>
+        <config-type>kerberos-env</config-type>
       </configuration-dependencies>
       <restartRequiredAfterChange>true</restartRequiredAfterChange>
     </service>

+ 21 - 7
ambari-web/app/controllers/main/admin/kerberos/step2_controller.js

@@ -70,9 +70,23 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
     App.config.setPreDefinedServiceConfigs(this.get('addMiscTabToPage'));
     //STEP 4: Add advanced configs
     App.config.addAdvancedConfigs(configs, advancedConfigs);
+    this.showAdConfigs(configs);
     this.applyServicesConfigs(configs, storedConfigs);
   },
 
+  /**
+   * Make Active Directory specific configs visible if user has selected AD option
+   * @param configs
+   */
+  showAdConfigs: function (configs) {
+    var kdcType = this.get('content.kerberosOption');
+    var configNames = ['ldap_url', 'container_dn'];
+    configNames.forEach(function (_configName) {
+      var config = configs.findProperty('name', _configName);
+      config.isVisible = kdcType === Em.I18n.t('admin.kerberos.wizard.step1.option.ad');
+    }, this);
+  },
+
   submit: function () {
     this.set('isSubmitDisabled', true);
     var self = this;
@@ -87,7 +101,7 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
       self.createKerberosComponent().done(function () {
         self.createKerberosHostComponents().done(function () {
           self.createConfigurations().done(function () {
-            self.createKerberosAdminSession().done(function() {
+            self.createKerberosAdminSession().done(function () {
               App.router.send('next');
             });
           });
@@ -132,7 +146,7 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
     });
   },
 
-  createKerberosHostComponents: function() {
+  createKerberosHostComponents: function () {
     var hostNames = this.get('content.hosts');
     var queryStr = '';
     hostNames.forEach(function (hostName) {
@@ -215,7 +229,7 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
     return {"type": site, "tag": tag, "properties": properties};
   },
 
-  tweakKdcTypeValue: function(properties) {
+  tweakKdcTypeValue: function (properties) {
     if (properties['kdc_type'] === Em.I18n.t('admin.kerberos.wizard.step1.option.kdc')) {
       properties['kdc_type'] = "mit-kdc";
     } else if (properties['kdc_type'] === Em.I18n.t('admin.kerberos.wizard.step1.option.ad')) {
@@ -229,16 +243,16 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
    */
   createKerberosAdminSession: function () {
     var configs = this.get('stepConfigs')[0].get('configs');
-    var adminPrincipalValue = configs.findProperty('name','admin_principal').value;
-    var adminPasswordValue = configs.findProperty('name','admin_password').value;
+    var adminPrincipalValue = configs.findProperty('name', 'admin_principal').value;
+    var adminPasswordValue = configs.findProperty('name', 'admin_password').value;
     return App.ajax.send({
       name: 'common.cluster.update',
       sender: this,
       data: {
         clusterName: App.get('clusterName') || App.clusterStatus.get('clusterName'),
         data: [{
-          session_attributes : {
-            kerberos_admin : {principal : adminPrincipalValue, password : adminPasswordValue}
+          session_attributes: {
+            kerberos_admin: {principal: adminPrincipalValue, password: adminPasswordValue}
           }
         }]
       }

+ 25 - 4
ambari-web/app/data/HDP2/site_properties.js

@@ -1977,7 +1977,7 @@ module.exports =
       "index": 0
     },
 
-  /********************************************* kerberos***********************************/
+  /*******************************************kerberos***********************************/
     {
       "id": "puppet var",
       "name": "kdc_type",
@@ -2027,6 +2027,27 @@ module.exports =
       "category": "KDC",
       "index": 3
     },
+    {
+      "id": "puppet var",
+      "name": "ldap_url",
+      "displayName": "LDAP url",
+      "isOverridable": false,
+      "isVisible": false,
+      "serviceName": "KERBEROS",
+      "filename": "kerberos-env.xml",
+      "category": "KDC",
+      "index": 4
+    },
+    {
+      "id": "puppet var",
+      "name": "container_dn",
+      "displayName": "Container DN",
+      "isVisible": false,
+      "serviceName": "KERBEROS",
+      "filename": "kerberos-env.xml",
+      "category": "KDC",
+      "index": 5
+    },
     {
       "id": "puppet var",
       "name": "domains",
@@ -2038,7 +2059,7 @@ module.exports =
       "serviceName": "KERBEROS",
       "filename": "krb5-conf.xml",
       "category": "KDC",
-      "index": 4
+      "index": 6
     },
     {
       "id": "puppet var",
@@ -2050,7 +2071,7 @@ module.exports =
       "serviceName": "KERBEROS",
       "filename": "krb5-conf.xml",
       "category": "KDC",
-      "index": 5
+      "index": 7
     },
     {
       "id": "puppet var",
@@ -2063,7 +2084,7 @@ module.exports =
       "serviceName": "KERBEROS",
       "filename": "krb5-conf.xml",
       "category": "KDC",
-      "index": 6
+      "index": 8
     },
     {
       "id": "puppet var",