I'm trying to create a private CA and want it to only be able to issue certificates for my domain via name constraints.
However, even if I create the CA with restrictions on DNS names as well as directory names like this
New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My\ -Type Custom -KeyUsage CertSign,CRLSign -NotAfter (Get-Date).AddYears(100) -Subject "CN=My Root,DC=mydomain,DC=tld" -TextExtension @("2.5.29.19={critical}{text}ca=true&pathlength=0", "2.5.29.30={critical}{text}subtree=Include&DNS=mydomain.tld&DNS=.mydomain.tld&[email protected]&Email=.mydomain.tld&[email protected]&upn=.mydomain.tld&DirectoryName=DC=mydomain,DC=tld")
I can still generate TLS certificates for other domains that do not fail validation by not specifying a SAN field and appending DC components to the subject's distinguished name like this
New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My\ -Type SSLServerAuthentication -Signer Cert:\CurrentUser\My\<ca_cert_id> -Subject "cn=someotherdomain.com,dc=mydomain,dc=tld"
Is there a way to specify directory name constraints to prevent this from happening?