pki: honour enforce_hostnames=false for DNS SAN underscore characters#31928
pki: honour enforce_hostnames=false for DNS SAN underscore characters#31928SAY-5 wants to merge 3 commits into
Conversation
The PKI API docs document enforce_hostnames=false as disabling DNS- name validation on DNS SANs. In practice, GenerateCreationBundle ran every alt-name through idna (StrictDomainName=true) and then through wildHostnameRegex unconditionally, so a SAN containing an underscore was either silently dropped (v1.20.3) or rejected with "subject alternate name <name> is not a valid DNS name" (main). When the role has enforce_hostnames=false, accept the SAN verbatim (or the idna-converted form that doesn't match the hostname regex) instead of failing. This matches the API contract the docs already state, and leaves enforce_hostnames=true (the default) exactly as strict as before. Fixes hashicorp#31925. Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
|
@SAY-5 is attempting to deploy a commit to the HashiCorp Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
1 similar comment
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
|
Please sign the CLA. |
Description
The PKI API docs state that
enforce_hostnames=false"allows non-hostnames in DNS SANs". In practice,GenerateCreationBundleran every alt-name throughidna(StrictDomainName=true) and then throughwildHostnameRegexunconditionally, so a SAN containing an underscore was either:subject alternate name <name> is not a valid DNS name and cannot be included as a SAN.Neither matches the documented behaviour.
Fix
When the role has
enforce_hostnames=false, accept the SAN verbatim (or theidna-converted form that doesn't match the hostname regex) instead of failing.enforce_hostnames=true, the default, is unchanged.Fixes
Fixes #31925
Checklist
go build ./builtin/logical/pki/...green.gofmtclean.Signed-off-by: SAY-5 SAY-5@users.noreply.github.com