Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions va/va.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,17 +574,28 @@ func trimWSP(s string) string {
})
}

// splitIssuerDomainName splits an RFC 8659 issue-value into issuer-domain-name
// and raw parameter segments. It returns zero values when issuer-domain-name is
// missing.
// normalizeIssuerDomainName normalizes an issuer-domain-name so that it can be
// compared against the names in the challenge's issuer-domain-names array,
// which draft-ietf-acme-dns-persist requires the CA to publish as lowercase
// A-labels with no trailing dot. It case-folds and strips a trailing dot, which
// are steps 1 and 4 of the normalization algorithm in Section 9.2; steps 2 and
// 3, NFC normalization and Punycode conversion, are no-ops for the ASCII names
// Pebble is configured with.
func normalizeIssuerDomainName(name string) string {
return strings.TrimSuffix(strings.ToLower(name), ".")
}

// splitIssuerDomainName splits an RFC 8659 issue-value into a normalized
// issuer-domain-name and raw parameter segments. It returns zero values when
// issuer-domain-name is missing.
func splitIssuerDomainName(raw string) (string, []string) {
// Split into issuer-domain-name and parameters.
parts := strings.Split(raw, ";")
if len(parts) == 0 {
return "", nil
}
// Parse issuer-domain-name.
issuerDomainName := trimWSP(parts[0])
issuerDomainName := normalizeIssuerDomainName(trimWSP(parts[0]))
if issuerDomainName == "" {
return "", nil
}
Expand Down
10 changes: 10 additions & 0 deletions va/va_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ func TestValidateDNSPersist01(t *testing.T) {
challTXTRecords: []string{"authority.example;accounturi=https://ca.example/acct/123;pOlIcY=wildcard"},
challWildcard: true,
},
{
name: "issuer-domain-name matches case-insensitively",
challIssuerNames: []string{"authority.example"},
challTXTRecords: []string{"AUTHORITY.Example;accounturi=https://ca.example/acct/123"},
},
{
name: "issuer-domain-name matches with a trailing dot",
challIssuerNames: []string{"authority.example"},
challTXTRecords: []string{"authority.example.;accounturi=https://ca.example/acct/123"},
},
// Failure test cases:
{
name: "only matching malformed record returns malformed",
Expand Down