Skip to content

feat: Support for dns-account-01 Challenge Type#8

Closed
sheurich wants to merge 10 commits intofeat-dns-account-01-corefrom
feat-dns-account-01-val
Closed

feat: Support for dns-account-01 Challenge Type#8
sheurich wants to merge 10 commits intofeat-dns-account-01-corefrom
feat-dns-account-01-val

Conversation

@sheurich
Copy link
Owner

@sheurich sheurich commented Jun 20, 2025

This PR implements the server-side validation logic and necessary protocol/model updates for the dns-account-01 challenge type (draft-ietf-acme-dns-account-label-01), building upon a previous PR (letsencrypt#8140) which introduced the core type definitions.

Support for dns-account-01 Challenge Type:

  • Core Challenge Logic:

    • Added support for the dns-account-01 challenge type in the PAConfig struct and the ChallengeTypesFor method in policy/pa.go. The feature is gated by the DNSAccount01Enabled flag. [1] [2]
    • Updated the MockClient in bdns/mocks.go to simulate various DNS scenarios for the dns-account-01 challenge. [1] [2]
  • Configuration and Feature Toggles:

    • Introduced the DNSAccount01Enabled flag in the features.Config struct to enable or disable the dns-account-01 challenge.
    • Added dnsAccountChallengeURIPrefix to the VA and RVA configurations for handling account-specific DNS challenges. [1] [2] [3]

Testing Enhancements:

  • Unit Tests:
    • Expanded policy/pa_test.go to include test cases for dns-account-01 with the feature both enabled and disabled. [1] [2] [3] [4] [5]
  • Integration Tests:
    • Updated test/v2_integration.py to use a helper method for selecting supported challenges, ensuring compatibility with dns-account-01. [1] [2]

Client and Utility Updates:

  • Challenge Test Server Client:
    • Added methods to handle dns-account-01 challenge responses in test/chall-test-srv-client/client.go. These include adding and removing DNS records for the challenge.
  • Helper Functions:
    • Introduced a utility function in test/chisel2.py to fetch supported challenges, excluding dns-account-01 for now due to library limitations.

Configuration Changes for Testing:

  • Enabled dns-account-01 in test configurations for RA, VA, and RVA services to validate end-to-end functionality. [1] [2] [3] [4] [5] [6] [7]

sheurich and others added 10 commits June 19, 2025 17:13
- Modify PA to offer dns-account-01 when feature flag is enabled
- Add tests for dns-account-01 challenge type in PA
- Update challenge type config handling

Enables dns-account-01 to be offered as a valid challenge type
Extracts the common DNS TXT record lookup, comparison, and
result/error handling logic from `validateDNS01` into a new
unexported helper function `validateDNS`.

This change aims to reduce code duplication in preparation for
simplifying the upcoming `validateDNSAccount01` function, which
shares most of this core validation flow.

`validateDNS01` is updated to calculate its specific inputs
(digest, query domain) and then call the new helper function.
There are no intended functional changes to `validateDNS01` itself.
Adds validation logic for the ACME `dns-account-01` challenge type.

Introduces the `validateDNSAccount01` function in `va/dns.go` which
implements the account-specific DNS label construction (based on the
Account URI) and validation flow, utilizing the shared `validateDNS`
function. Unauthorized errors returned during validation are
enriched with the Account URI for context.

Adds a new test file `va/dns_account_test.go` with unit tests for the
`validateDNSAccount01` function, mirroring existing dns-01 test
scenarios and checking specific dns-account-01 behavior.

Updates `bdns/mocks.go` with necessary entries to support the new
dns-account-01 test cases.

Ref: draft-ietf-acme-dns-account-label-00
Adds a helper in chisel2.py to select the first supported challenge
(currently excluding dns-account-01) and updates v2_integration.py
to use it.

This prevents test failures until the underlying Python ACME library
includes support for the new challenge type.
Passes the account URI to the VA's validateChallenge function
and adds a case to route dns-account-01 challenges (when enabled)
to a new validateDNSAccount01 function.

Updates the caller in DoDCV and adjusts tests.
…se config-driven approach

- Remove AccountURI from gRPC PerformValidationRequest to avoid protocol changes
- Pass DNSAccountChallengeURIPrefix via config to VA instead of per-request
- Update NewValidationAuthorityImpl constructor to accept DNSAccountChallengeURIPrefix
- Refactor all tests to use new constructor signature
- Update va/va.go to construct accountURI from config prefix + accountID
- Ensure all config files have DNSAccountChallengeURIPrefix set correctly
@sheurich sheurich requested a review from Copilot June 20, 2025 00:49
@github-actions
Copy link

@sheurich, this PR appears to contain configuration and/or SQL schema changes. Please ensure that a corresponding deployment ticket has been filed with the new values.

@github-actions
Copy link

@sheurich, this PR adds one or more new feature flags: DNSAccount01Enabled. As such, this PR must be accompanied by a review of the Let's Encrypt CP/CPS to ensure that our behavior both before and after this flag is flipped is compliant with that document.

Please conduct such a review, then add your findings to the PR description in a paragraph beginning with "CPS Compliance Review:".

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces support for the new ACME challenge type dns-account-01. The changes span core validation logic, configuration updates, client helper methods, and additional testing to ensure end‐to‐end functionality for this challenge type.

  • Added support for dns-account-01 in the Validation Authority and auxiliary modules.
  • Updated configuration files, mocks, and tests to include the new challenge type.
  • Refactored challenge selection logic to optionally include dns-account-01 based on the feature flag.

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
va/va_test.go Updated test calls to include the new accountURI parameter
va/va.go Modified validateChallenge and DoDCV to handle dns-account-01 challenges
va/dns_test.go Renamed DNS test functions to reflect dns-01 naming conventions
va/dns_account_test.go New tests covering dns-account-01 challenge validations
va/dns.go Added validateDNSAccount01 with account-specific DNS label construction
va/config/config.go Added new DNSAccountChallengeURIPrefix configuration field
test/v2_integration.py Updated challenge selection helper in integration tests
test/chisel2.py Excluded dns-account-01 from supported challenges in Python ACME library
test/chall-test-srv-client/client.go Added helpers for adding/removing dns-account-01 responses
policy/pa_test.go Extended challenge types tests to include the new dns-account-01 flag
policy/pa.go Updated ChallengeTypesFor to optionally include dns-account-01 challenges
features/features.go Added DNSAccount01Enabled flag
cmd/* files Updated various command-line configuration files to support the new flag
bdns/mocks.go Extended mock DNS lookup to simulate account-specific validation records
Comments suppressed due to low confidence (1)

va/dns_account_test.go:66

  • The variable 'ctx' is used without being defined in this test. Consider using 'context.Background()' explicitly to ensure the context is properly initialized.
	_, err := va.validateDNSAccount01(ctx, identifier.NewDNS("localhost"), expectedKeyAuthorization, testAccountURI)

}

// Calculate the DNS prefix label based on the account URI
sha256sum := sha256.Sum256([]byte(accountURI))
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The account label calculation logic appears in both the DNS validation function and the client helper. Consider extracting this logic into a shared utility function to reduce duplication.

Copilot uses AI. Check for mistakes.
@sheurich sheurich closed this Jun 20, 2025
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