Эх сурвалжийг харах

HUE-5994 [spark] Kerberos support config

Romain Rigaux 8 жил өмнө
parent
commit
25ed265

+ 6 - 0
apps/spark/src/spark/conf.py

@@ -44,6 +44,12 @@ LIVY_SERVER_SESSION_KIND = Config( # Note: this one is ignored by Livy, this sho
    help=_t("Configure livy to start in local 'process' mode, or 'yarn' workers."),
    default="yarn")
 
+SECURITY_ENABLED = Config(
+  key="security_enabled",
+  help=_t("Whether Livy requires client to perform Kerberos authentication."),
+  default=False,
+  type=coerce_bool)
+
 # Spark SQL
 SQL_SERVER_HOST = Config(
   key="sql_server_host",

+ 6 - 2
apps/spark/src/spark/job_server_api.py

@@ -23,7 +23,7 @@ import threading
 from desktop.lib.rest.http_client import HttpClient
 from desktop.lib.rest.resource import Resource
 
-from spark.conf import get_livy_server_url
+from spark.conf import get_livy_server_url, SECURITY_ENABLED
 
 
 LOG = logging.getLogger(__name__)
@@ -52,13 +52,17 @@ def get_api(user):
 
 
 class JobServerApi(object):
+
   def __init__(self, oozie_url):
     self._url = posixpath.join(oozie_url)
     self._client = HttpClient(self._url, logger=LOG)
     self._root = Resource(self._client)
-    self._security_enabled = False
+    self._security_enabled = SECURITY_ENABLED.get()
     self._thread_local = threading.local()
 
+    if self.security_enabled:
+      self._client.set_kerberos_auth()
+
   def __str__(self):
     return "JobServerApi at %s" % (self._url,)
 

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -1060,6 +1060,9 @@
   # Configure Livy to start in local 'process' mode, or 'yarn' workers.
   ## livy_server_session_kind=yarn
 
+  # Whether Livy requires client to perform Kerberos authentication.
+  ## security_enabled=false
+
   # Host of the Sql Server
   ## sql_server_host=localhost
 

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -1062,6 +1062,9 @@
   # Configure Livy to start in local 'process' mode, or 'yarn' workers.
   ## livy_server_session_kind=yarn
 
+  # Whether Livy requires client to perform Kerberos authentication.
+  ## security_enabled=false
+
   # Host of the Sql Server
   ## sql_server_host=localhost