Skip to content

Commit ad18ea4

Browse files
committed
fix(dns-account-01): update validation domain to remove scope per draft-ietf-acme-dns-account-label-00
1 parent 307a947 commit ad18ea4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

va/va.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,14 @@ func (va VAImpl) validateDNS01(task *vaTask) *core.ValidationRecord {
365365
}
366366

367367
func (va VAImpl) validateDNSAccount01(task *vaTask) *core.ValidationRecord {
368+
// Compute the account-specific DNS label per draft-ietf-acme-dns-account-label-00 section 3.2
369+
// "_" || base32(SHA-256(<ACCOUNT_URL>)[0:10]) || "._acme-challenge"
368370
acctHash := sha256.Sum256([]byte(task.AccountURL))
369-
acctLabel := strings.ToLower(base32.StdEncoding.EncodeToString(acctHash[0:10]))
370-
scope := "host"
371-
if task.Wildcard {
372-
scope = "wildcard"
373-
}
374-
challengeSubdomain := fmt.Sprintf("_%s._acme-%s-challenge.%s", acctLabel, scope, task.Identifier.Value)
371+
// Take first 10 bytes of hash as specified in section 3.2
372+
// Use base32 encoding without padding per RFC4648
373+
acctLabel := strings.ToLower(base32.StdEncoding.WithPadding(base32.NoPadding).EncodeToString(acctHash[0:10]))
374+
// Construct validation domain name according to spec
375+
challengeSubdomain := fmt.Sprintf("_%s._acme-challenge.%s", acctLabel, task.Identifier.Value)
375376

376377
result := &core.ValidationRecord{
377378
URL: challengeSubdomain,

0 commit comments

Comments
 (0)