This is an automated email from the ASF dual-hosted git repository. dmitriusan pushed a commit to branch branch-2.7 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push: new 41a9c6f AMBARI-25295. Ambari Server Error on submitting EU (dlysnichenko) (#3001) 41a9c6f is described below commit 41a9c6fa1771327062aa6425209e6ee863f18730 Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com> AuthorDate: Thu Jun 6 18:14:01 2019 +0300 AMBARI-25295. Ambari Server Error on submitting EU (dlysnichenko) (#3001) --- .../kerberos/IPAKerberosOperationHandler.java | 9 +++++++-- .../kerberos/MITKerberosOperationHandler.java | 12 ++++++++++-- .../KERBEROS/1.10.3-10/configuration/kerberos-env.xml | 15 +++++++++++++++ .../KERBEROS/1.10.3-30/configuration/kerberos-env.xml | 15 +++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java index 07ab77e..d9732e9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java @@ -18,6 +18,7 @@ package org.apache.ambari.server.serveraction.kerberos; +import java.util.Arrays; import java.util.Map; import java.util.Set; @@ -254,13 +255,17 @@ public class IPAKerberosOperationHandler extends KDCKerberosOperationHandler { } @Override - protected String[] getKinitCommand(String executableKinit, PrincipalKeyCredential credentials, String credentialsCache, Map<String, String> kerberosConfiguration) { - return new String[]{ + protected String[] getKinitCommand(String executableKinit, PrincipalKeyCredential credentials, String credentialsCache, Map<String, String> kerberosConfiguration) throws KerberosOperationException { + String [] command = new String[]{ executableKinit, "-c", credentialsCache, credentials.getPrincipal() }; + if (Arrays.asList(command).contains(null)){ + throw new KerberosOperationException("Got a null value, can not create 'kinit' command"); + } + return command; } @Override diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java index 142aace..914914e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java @@ -19,6 +19,7 @@ package org.apache.ambari.server.serveraction.kerberos; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -342,8 +343,11 @@ public class MITKerberosOperationHandler extends KDCKerberosOperationHandler { protected String[] getKinitCommand(String executableKinit, PrincipalKeyCredential credentials, String credentialsCache, Map<String, String> kerberosConfiguration) throws KerberosOperationException { // kinit -c <path> -S kadmin/`hostname -f` <principal> try { - final String kadminPrincipalName = variableReplacementHelper.replaceVariables(kerberosConfiguration.get(KERBEROS_ENV_KADMIN_PRINCIPAL_NAME), buildReplacementsMap(kerberosConfiguration)); - return new String[]{ + String kadminPrincipalName = variableReplacementHelper.replaceVariables(kerberosConfiguration.get(KERBEROS_ENV_KADMIN_PRINCIPAL_NAME), buildReplacementsMap(kerberosConfiguration)); + if (kadminPrincipalName == null) { + kadminPrincipalName = String.format("kadmin/%s", getAdminServerHost(false)); + } + String [] command = new String[]{ executableKinit, "-c", credentialsCache, @@ -351,6 +355,10 @@ public class MITKerberosOperationHandler extends KDCKerberosOperationHandler { kadminPrincipalName, credentials.getPrincipal() }; + if (Arrays.asList(command).contains(null)){ + throw new KerberosOperationException("Got a null value, can not create 'kinit' command"); + } + return command; } catch (AmbariException e) { throw new KerberosOperationException("Error while getting 'kinit' command", e); } diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml index 63afab6..d00e597 100644 --- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml +++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/configuration/kerberos-env.xml @@ -33,6 +33,21 @@ </value-attributes> <on-ambari-upgrade add="true"/> </property> + <property require-input="false"> + <name>kadmin_principal_name</name> + <value>kadmin/${admin_server_host|stripPort()}</value> + <description> + The principal name of kAdmin service principal + </description> + <display-name>kAdmin Service Principal Name</display-name> + <on-ambari-upgrade add="true" delete="false" update="false"/> + <on-stack-upgrade merge="true"/> + <value-attributes> + <visible>true</visible> + <overridable>false</overridable> + <keystore>false</keystore> + </value-attributes> + </property> <property> <name>manage_identities</name> <description> diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-30/configuration/kerberos-env.xml b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-30/configuration/kerberos-env.xml index 63afab6..d00e597 100644 --- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-30/configuration/kerberos-env.xml +++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-30/configuration/kerberos-env.xml @@ -33,6 +33,21 @@ </value-attributes> <on-ambari-upgrade add="true"/> </property> + <property require-input="false"> + <name>kadmin_principal_name</name> + <value>kadmin/${admin_server_host|stripPort()}</value> + <description> + The principal name of kAdmin service principal + </description> + <display-name>kAdmin Service Principal Name</display-name> + <on-ambari-upgrade add="true" delete="false" update="false"/> + <on-stack-upgrade merge="true"/> + <value-attributes> + <visible>true</visible> + <overridable>false</overridable> + <keystore>false</keystore> + </value-attributes> + </property> <property> <name>manage_identities</name> <description>