Hello Alexey Serbin, Jason Fehr, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    https://gerrit.cloudera.org/25247

to look at the new patch set (#4).

Change subject: IMPALA-14331: Support proxy for JWKS URL download
......................................................................

IMPALA-14331: Support proxy for JWKS URL download

Add an optional jwksProxy field to --oauth_servers entries so the JWKS
can be downloaded from jwksUrl through a proxy, e.g.
"https://proxy.example.com:3128"; or "socks5h://proxy.example.com:1080".
The value is passed to libcurl's CURLOPT_PROXY, so any proxy format
libcurl supports can be used. The proxy is used both for the initial
download at startup and for the periodic JWKS refresh.

Previously, the JWKS download could not use a proxy at all: EasyCurl
sets CURLOPT_NOPROXY to "*" by default, so even the http_proxy and
https_proxy environment variables were ignored. EasyCurl now has
set_proxy(), set_proxy_ca_certificates() and
set_proxy_pinned_public_key() setters, and the noproxy setting is still
applied whenever it is not empty. When jwksProxy is set, the JWKS
download clears the noproxy setting, so hosts listed in the no_proxy
environment variable bypass the proxy. Without jwksProxy, the behavior
is unchanged.

jwksProxy is parsed with libcurl's URL API, using the same flags libcurl
uses for CURLOPT_PROXY, and must not contain a user name or password,
since the --oauth_servers flag is logged at startup and shown on the
debug web UI. Proxy authentication is tracked separately by
IMPALA-15692. Since the proxy URL cannot contain credentials, it is
safe to include in the startup log line and in download errors, which
eases troubleshooting.

The TLS certificate of an https proxy is verified according to
verifyServerCert against the new optional jwksProxyCaCertFilePath
field, which defaults to caCertFilePath. An empty
jwksProxyCaCertFilePath uses the default CA bundle. The new optional
jwksProxyPinnedPublicKey field sets CURLOPT_PROXY_PINNEDPUBLICKEY, so
the public key of the proxy can be pinned with either a PEM/DER public
key file or a "sha256//<base64 hash>" value. It requires an https
jwksProxy.

The startup log line now always reports the JWKS URL being downloaded,
including the proxy when one is used.

Testing:
- Added OAuthServerConfigTest cases for parsing jwksProxy,
  jwksProxyCaCertFilePath and jwksProxyPinnedPublicKey, and for
  rejecting invalid proxy URLs, proxy URLs with credentials (without
  echoing them) and pinned public keys without an https proxy.
- Added JwtUtilTest cases that download the JWKS from an unresolvable
  host through a fake HTTP proxy, check that no_proxy is honored, that
  an unreachable proxy fails with a clear error, and that proxy
  environment variables are still ignored without jwksProxy.
- Added custom cluster tests to TestImpalaShellOAuthServersAuth that run
  impalad with JWT auth and download the JWKS from an unresolvable host
  through an http proxy (absolute-form and CONNECT tunnel to an https
  JWKS URL), an https proxy (with the certificate verified through
  caCertFilePath, jwksProxyCaCertFilePath or a pinned public key, and
  with a CONNECT tunnel to an https JWKS URL) and a socks5h proxy, and
  that impalad fails to start with an unreachable proxy, an untrusted
  https proxy certificate, an empty jwksProxyCaCertFilePath or a wrong
  pinned public key. The test servers use unused ports and are always
  shut down.
- Linux: be/build/debug/util/oauth-server-config-test (25 passed),
  be/build/debug/util/jwt-util-test (31 passed) and
  be/build/debug/util/oauth-servers-manager-test (10 passed).
- Linux: impala-py.test
  tests/custom_cluster/test_shell_oauth_servers_auth.py (14 passed).
- Linux: impala-py.test tests/custom_cluster/test_shell_jwt_auth.py
  tests/custom_cluster/test_shell_oauth_auth.py (8 passed).

Change-Id: I6741b8e107f707d3fcc0a9e15ac01b5769191924
Assisted-by: Claude Opus 5.5 (Cursor)
---
M be/src/kudu/util/curl_util.cc
M be/src/kudu/util/curl_util.h
M be/src/util/jwt-util-internal.h
M be/src/util/jwt-util-test.cc
M be/src/util/jwt-util.cc
M be/src/util/jwt-util.h
M be/src/util/oauth-server-config-test.cc
M be/src/util/oauth-server-config.cc
M be/src/util/oauth-server-config.h
M be/src/util/oauth-servers-manager.cc
M tests/custom_cluster/test_shell_oauth_servers_auth.py
A tests/util/proxy_servers.py
12 files changed, 1,033 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/47/25247/4
--
To view, visit https://gerrit.cloudera.org/25247
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6741b8e107f707d3fcc0a9e15ac01b5769191924
Gerrit-Change-Number: 25247
Gerrit-PatchSet: 4
Gerrit-Owner: Anubhav Jindal <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Anubhav Jindal <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jason Fehr <[email protected]>

Reply via email to