Exemplo n.º 1
0
    def __init__(self, server_url):
        self._url = server_url
        self._client = HttpClient(self._url, logger=LOG)
        self._root = Resource(self._client)
        self._security_enabled = is_kerberos_enabled()
        self._webserver_spnego_enabled = is_webserver_spnego_enabled()
        self._thread_local = threading.local()

        # You can set username/password for Impala Web UI which overrides kerberos
        daemon_api_pwd = \
            (DAEMON_API_PASSWORD.get() if DAEMON_API_PASSWORD.get()
             is not None else (DAEMON_API_PASSWORD_SCRIPT.get() if DAEMON_API_PASSWORD_SCRIPT.get()
             is not None else None))
        if DAEMON_API_USERNAME.get(
        ) is not None and daemon_api_pwd is not None:
            if DAEMON_API_AUTH_SCHEME.get().lower() == 'basic':
                self._client.set_basic_auth(DAEMON_API_USERNAME.get(),
                                            daemon_api_pwd)
                LOG.info(
                    "Using username and password for basic authentication")
            else:
                self._client.set_digest_auth(DAEMON_API_USERNAME.get(),
                                             daemon_api_pwd)
                LOG.info(
                    'Using username and password for digest authentication')
        elif self._webserver_spnego_enabled or self._security_enabled:
            self._client.set_kerberos_auth()
            LOG.info('Using kerberos principal for authentication')
Exemplo n.º 2
0
    def __init__(self, server_url):
        self._url = server_url
        self._client = HttpClient(self._url, logger=LOG)
        self._root = Resource(self._client)
        self._security_enabled = is_kerberos_enabled()
        self._webserver_spnego_enabled = is_webserver_spnego_enabled()
        self._thread_local = threading.local()

        # You can set username/password for Impala Web UI which overrides kerberos
        if DAEMON_API_USERNAME.get() is not None and DAEMON_API_PASSWORD.get(
        ) is not None:
            self._client.set_digest_auth(DAEMON_API_USERNAME.get(),
                                         DAEMON_API_PASSWORD.get())
            LOG.info('Using username and password for authentication')

        elif self._webserver_spnego_enabled or self._security_enabled:
            self._client.set_kerberos_auth()
            LOG.info('Using kerberos principal for authentication')
Exemplo n.º 3
0
def get_use_sasl_default():
  """kerberos enabled or password is specified"""
  return is_kerberos_enabled() or AUTH_PASSWORD.get() is not None # Maps closely to legacy behavior