Skip to content

httpchallenge: optionally verify client IP against hostname DNS - #7240

Merged
amartinezfayo merged 3 commits into
spiffe:mainfrom
samuraixwandering:httpchallenge-verify-client-ip
Sep 7, 2026
Merged

amartinezfayo merged 3 commits into
spiffe:mainfrom
samuraixwandering:httpchallenge-verify-client-ip

Conversation

@samuraixwandering

@samuraixwandering samuraixwandering commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality

Server-side http_challenge node attestor. Optional config only; default behavior is unchanged.

Description of change

Adds verify_client_ip to the http_challenge server plugin (default false), following the x509pop option introduced in #6911 and the sshpop work in #7191.

When enabled, the connecting peer IP (from X-Forwarded-Client-IP on the node attestor facade) is checked against the DNS addresses for the attested hostname. Lookup failure or no matching address fails attestation. The check runs after hostname validation and before the HTTP challenge.

This is the second of the two remaining plugins from #6769 (sshpop merged as #7191). Split per maintainer guidance.

The IP comes from ClientIPFromContext, the helper added in #7191, so sshpop and this plugin read the metadata the same way. The DNS lookup gets a 10s timeout on the stream context. That's the same budget as the challenge fetch, but derived from the stream so an agent hanging up cancels the lookup.

Test plan

  • go test ./pkg/server/plugin/nodeattestor/httpchallenge/
  • Unit coverage for flag off (lookup not called), missing/mismatched/unresolvable client IP, IPv4/IPv6 match, and match among several DNS answers. Fail-closed cases use a transport that fatals if the HTTP challenge runs.

Part of #6769

@amartinezfayo amartinezfayo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @samuraixwandering!

When verify_client_ip is set, the peer IP from X-Forwarded-Client-IP
must match a DNS address for the attested hostname. Default is off.

Signed-off-by: samuraiXwandering <[email protected]>
The new config row was one space short of the header pipes, which
failed MD060 in lint-md.

Signed-off-by: samuraiXwandering <[email protected]>
New() installs the default resolver, so the extra constructor and
defaultLookupIPs are gone. BuiltInTesting takes the lookup hook.
Test hooks use t.Error instead of t.Fatal.

Signed-off-by: samuraiXwandering <[email protected]>
@samuraixwandering
samuraixwandering force-pushed the httpchallenge-verify-client-ip branch from 88674cd to c79873b Compare September 2, 2026 03:57

@amartinezfayo amartinezfayo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @samuraixwandering!

@amartinezfayo amartinezfayo added this to the 1.16.0 milestone Sep 7, 2026
@amartinezfayo
amartinezfayo added this pull request to the merge queue Sep 7, 2026
Merged via the queue into spiffe:main with commit 2662e50 Sep 7, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants