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

HUE-8336 [spark] Can't disable certificate verification

Ivan Dzikovsky 7 жил өмнө
parent
commit
d52a56509f

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

@@ -21,6 +21,7 @@ import sys
 
 from django.utils.translation import ugettext_lazy as _t, ugettext as _
 
+from desktop.conf import default_ssl_validate
 from desktop.lib.conf import Config, coerce_bool
 from spark.settings import NICE_NAME
 
@@ -69,6 +70,13 @@ SQL_SERVER_PORT = Config(
   default=10000,
   type=int)
 
+SSL_CERT_CA_VERIFY = Config(
+  key="ssl_cert_ca_verify",
+  help=_t("Choose whether Hue should validate certificates received from the server."),
+  dynamic_default=default_ssl_validate,
+  type=coerce_bool
+)
+
 
 def get_livy_server_url():
   url = LIVY_SERVER_URL.get()

+ 3 - 1
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, SECURITY_ENABLED
+from spark.conf import get_livy_server_url, SECURITY_ENABLED, SSL_CERT_CA_VERIFY
 
 
 LOG = logging.getLogger(__name__)
@@ -63,6 +63,8 @@ class JobServerApi(object):
     if self.security_enabled:
       self._client.set_kerberos_auth()
 
+    self._client.set_verify(SSL_CERT_CA_VERIFY.get())
+
   def __str__(self):
     return "JobServerApi at %s" % (self._url,)
 

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

@@ -1151,6 +1151,9 @@
   # Port of the Sql Server
   ## sql_server_port=10000
 
+  # Choose whether Hue should validate certificates received from the server.
+  ## ssl_cert_ca_verify=true
+
 
 ###########################################################################
 # Settings to configure the Oozie app

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

@@ -1153,6 +1153,9 @@
   # Port of the Sql Server
   ## sql_server_port=10000
 
+  # Choose whether Hue should validate certificates received from the server.
+  ## ssl_cert_ca_verify=true
+
 
 ###########################################################################
 # Settings to configure the Oozie app