Browse Source

[search] Security support

No impersonation supported yet. 'hue' username from the ticket will be used.
Romain Rigaux 12 years ago
parent
commit
29393e0

+ 3 - 1
apps/search/src/search/api.py

@@ -26,7 +26,7 @@ import logging
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.rest.http_client import HttpClient, RestException
 from desktop.lib.rest.resource import Resource
-from search.conf import EMPTY_QUERY
+from search.conf import EMPTY_QUERY, SECURITY_ENABLED
 
 
 LOG = logging.getLogger(__name__)
@@ -39,6 +39,8 @@ class SolrApi(object):
   def __init__(self, solr_url):
     self._url = solr_url
     self._client = HttpClient(self._url, logger=LOG)
+    if SECURITY_ENABLED.get():
+      self._client.set_kerberos_auth()
     self._root = Resource(self._client)
 
   def query(self, solr_query, hue_core):

+ 5 - 14
apps/search/src/search/conf.py

@@ -30,17 +30,8 @@ EMPTY_QUERY = Config(
   help=_("Query sent when no term is entered."),
   default="*:*")
 
-
-#SOLR_URLS = UnspecifiedConfigSection(
-#  "solr_urls",
-#  help="One entry for each Solr server",
-#  each=ConfigSection(
-#    help="Information about a single HDFS cluster",
-#    members=dict(
-#      # Deprecated
-#      NN_HOST=Config("namenode_host", help="Host/IP for name node"),
-#    )
-#  )
-#)
-
-# ZOOKEEPER URL
+SECURITY_ENABLED = Config(
+  key="security_enabled",
+  help=_t("Whether Solr requires client to perform Kerberos authentication."),
+  default=False,
+  type=coerce_bool)

+ 8 - 4
desktop/conf.dist/hue.ini

@@ -348,6 +348,7 @@
   # users to submit jobs.
   ## oozie_url=http://localhost:11000/oozie
 
+  # Requires FQDN in oozie_url if enabled
   ## security_enabled=false
 
   # Location on HDFS where the workflows/coordinator are deployed when submitted.
@@ -511,11 +512,14 @@
 
 [search]
 
-   # URL of the Solr Server
-   ## solr_url=http://localhost:8983/solr/
+  # URL of the Solr Server
+  ## solr_url=http://localhost:8983/solr/
 
-   ## Query sent when no term is entered
-   ## empty_query=*:*
+  # Requires FQDN in solr_url if enabled
+  ## security_enabled=false
+
+  ## Query sent when no term is entered
+  ## empty_query=*:*
 
 
 ###########################################################################

+ 9 - 4
desktop/conf/pseudo-distributed.ini.tmpl

@@ -352,6 +352,7 @@
   # users to submit jobs.
   ## oozie_url=http://localhost:11000/oozie
 
+  # Requires FQDN in oozie_url if enabled
   ## security_enabled=false
 
   # Location on HDFS where the workflows/coordinator are deployed when submitted.
@@ -508,17 +509,21 @@
   # Hard limit of rows or columns per row fetched before truncating.
   ## truncate_limit = 500
 
+
 ###########################################################################
 # Settings to configure Solr Search
 ###########################################################################
 
 [search]
 
-   # URL of the Solr Server
-   ## solr_url=http://localhost:8983/solr/
+  # URL of the Solr Server
+  ## solr_url=http://localhost:8983/solr/
+
+  # Requires FQDN in solr_url if enabled
+  ## security_enabled=false
 
-   ## Query sent when no term is entered
-   ## empty_query=*:*
+  ## Query sent when no term is entered
+  ## empty_query=*:*
 
 
 ###########################################################################