Skip to content

HDDS-16347. Stop expanding _HOST to the bind host in HTTP SPNEGO principals - #11464

Open
rjgoyln wants to merge 2 commits into
apache:masterfrom
rjgoyln:HDDS-16347
Open

rjgoyln wants to merge 2 commits into
apache:masterfrom
rjgoyln:HDDS-16347

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

BaseHttpServer never sets a host on HttpServer2.Builder, so _HOST in the SPNEGO principal is expanded from the first endpoint, which is the bind address. The S3 Gateway secret endpoint reads ozone.s3g.webadmin.http-bind-host directly for the same purpose.

A bind host is not the name a keytab was issued for. The IPv6 wildcard that HDDS-16307 made usable gives HTTP/[0:0:0:0:0:0:0:0]@REALM, and an interface-specific bind host gives whatever it reverse-resolves to. Only the IPv4 wildcard works today, because SecurityUtil.getServerPrincipal special-cases the literal 0.0.0.0; the JIRA description is inaccurate on that point.

  • BaseHttpServer passes the builder the host of the advertised HTTP, then HTTPS, address when it is not a wildcard, otherwise the canonical local hostname.
  • S3GatewayWebAdminServer expands the secret endpoint principal from the same host.

The fallback is what Hadoop already substitutes for 0.0.0.0, so deployments that leave the *-address properties at their 0.0.0.0:<port> defaults keep their current principal; failing startup on a wildcard bind host instead would have broken exactly that default. OM, SCM and Recon expand _HOST for their RPC login from the advertised RPC address, so the secret endpoint was the only other principal built from a listener address.

What is the link to the Apache JIRA?

https://issues.apache.org/jira/browse/HDDS-16347

How was this patch tested?

Unit tests in TestBaseHttpServer cover the host resolution for unset, wildcard, hostname and IPv6-literal advertised addresses, and the SPNEGO filter's resulting kerberos.principal for bind hosts 0.0.0.0, :: and 127.0.0.1; TestS3GatewayHttpServers covers the secret endpoint with an IPv6 wildcard bind host. Without the production change the principal assertions fail with HTTP/<local hostname>@, HTTP/[0:0:0:0:0:0:0:0]@, HTTP/localhost@ and HTTP/::@ respectively.

Generated-by: Claude Code (Fable 5.1)

…cipals

BaseHttpServer never told HttpServer2 which host to use, so _HOST was
expanded from the first endpoint, which is the bind address. A wildcard
or interface-specific bind host does not name the node and matches no
keytab entry; the S3 Gateway secret endpoint read the bind host key
directly for the same purpose.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tests must preserve and restore existing JVM-wide Kerberos properties.

1 open finding

🧠 Review effort: Lite

@github-actions github-actions Bot added the s3 S3 Gateway label Oct 10, 2026
@jojochuang

Copy link
Copy Markdown
Contributor

Documentation follow-up for this change is in progress: #11479 is unrelated; the SPNEGO _HOST doc update is on branch HDDS-16347-spnego-doc (PR link will be posted when open).

Please add a short pointer in the HDDS-16347 Jira (or the doc PR) so operators know to set *-http-address / *-https-address to the keytab hostname, not the bind host—especially for IPv6 :: bind.

@jojochuang

Copy link
Copy Markdown
Contributor

Correction: doc follow-up for HDDS-16347 is #11495 (updates SecuringOzoneHTTP.md: _HOST comes from advertised *-address, not *-bind-host). Please link that doc PR from HDDS-16347 when convenient.

@jojochuang

Copy link
Copy Markdown
Contributor

Doc Jira: https://issues.apache.org/jira/browse/HDDS-16945 (related to HDDS-16347). Doc PR: #11495

Store previous Kerberos realm and KDC properties to restore them after tests.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jojochuang

Copy link
Copy Markdown
Contributor

Operator doc PR (HDDS-16945): apache/ozone-site#569 — updates the Kerberos SPNEGO page. Closed incorrect #11495.

@jojochuang
jojochuang marked this pull request as ready for review October 12, 2026 17:23

@jojochuang jojochuang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 pending CI

@jojochuang

Copy link
Copy Markdown
Contributor

TestLogLevelEndpointSecure appears to be problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ipv6 s3 S3 Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants