You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2019/06/19 11:57:48 UTC

[kylin] branch master updated: KYLIN-4033 Can not access Kerberized Cluster with DebugTomcat

This is an automated email from the ASF dual-hosted git repository.

nic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/master by this push:
     new c3fd390  KYLIN-4033 Can not access Kerberized Cluster with DebugTomcat
c3fd390 is described below

commit c3fd390910305c2d1c3dea2421c6f61cc8fb9861
Author: Temple Zhou <db...@gmail.com>
AuthorDate: Wed Jun 12 11:32:40 2019 +0800

    KYLIN-4033 Can not access Kerberized Cluster with DebugTomcat
---
 .../main/java/org/apache/kylin/rest/DebugTomcat.java    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java b/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
index db28595..f611403 100644
--- a/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
+++ b/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
@@ -19,6 +19,7 @@
 package org.apache.kylin.rest;
 
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 
@@ -29,6 +30,7 @@ import org.apache.catalina.deploy.ErrorPage;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Shell;
 import org.apache.kylin.common.KylinConfig;
 
@@ -41,6 +43,10 @@ public class DebugTomcat {
 
             // test_case_data/sandbox/ contains HDP 2.2 site xmls which is dev sandbox
             KylinConfig.setSandboxEnvIfPossible();
+            // Must set SandboxEnv before checking the Kerberos status
+            if (UserGroupInformation.isSecurityEnabled()) {
+                authKrb5();
+            }
             overrideDevJobJarLocations();
 
             System.setProperty("spring.profiles.active", "testing");
@@ -100,6 +106,17 @@ public class DebugTomcat {
         return null;
     }
 
+    public static void authKrb5() {
+        // The system property "java.security.krb5.conf" should be set
+        try {
+            UserGroupInformation.loginUserFromKeytab(
+                    System.getProperty("java.security.krb5.principal"),
+                    System.getProperty("java.security.krb5.keytab"));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
     public static void main(String[] args) throws Exception {
         setupDebugEnv();