namecoin / proposals

Standards and Best Practices
Creative Commons Zero v1.0 Universal
12 stars 5 forks source link

Dehydrated certs don't work as trust roots in mozilla::pkix #25

Open JeremyRand opened 6 years ago

JeremyRand commented 6 years ago

I recently noticed that dehydrated certs don't work as trust roots in mozilla:pkix (which is used to validate certificates in Firefox and most software based on Firefox), because mozilla::pkix does not respect end-entity certificates that are marked as trusted in NSS. AIUI, David Keeler from Mozilla says that this is because NSS doesn't support attached name constraints on trust anchors, which introduces a risk that you'll trust a cert for one domain and inadvertently trust it for other domains. David recommends that if you require an end-entity trust anchor, you should use cert_override.txt. Unfortunately, cert_override.txt can't be edited while Firefox is running, so it's not really a replacement for NSS's cert store for us.

AIUI, name-constrained CA's are honored by mozilla:pkix when they're trusted by NSS. (Indeed, that's what tlsrestrict_nss_tool does.) That means we can do this:

Why are we using an intermediate CA here? Because the RFC says that name constraints don't apply when they're present in root CA's. (I suspect that they'll be applied anyway, but I'd rather not cause security issues when someone actually is following the letter of the RFC.)

Why are we storing a signature and validity period for the end-entity cert, instead of just a public key (which is all the name-constrained CA needs)? Because macOS doesn't support name constraints, but it does (I think?) support treating non-root-CA certs as trust anchors -- but we need a full end-entity cert for that, not just a public key. So I believe that this construction should work fine on any TLS implementation that supports either name constraints or end-entity trust anchors (doesn't need to be both).

Thoughts on this?

JeremyRand commented 6 years ago

CC: @hlandau @ryancdotorg