My customer uses a self signed certificate for an application to work. To be able to work, I have to install the root certificate they used to sign the certificate.

Is it possible to configure a root certificate so it only validates towards one domain ?

  • It might just be me, but I'm unclear what you are actually asking. What end state are you trying to accomplish? If you import their root certificate into the domain controllers trust, then just the systems under that domain would be able to validate against it... – Gravy Feb 23 '15 at 14:50
  • It sounds like you are confusing self-signed certificates with using a root CA that is not publicly trusted.An application configured to use a self-signed certificate is very bad, as the application would need to be configured to ignore certificate validation errors. Using a root CA that is not publicly trusted is actually quite common. – Greg Askew Feb 23 '15 at 15:41
  • do you have an internal CA server? – Crypt32 Feb 23 '15 at 15:43
  • 1
    A CA can restrict itself to certain domains with name constraints, but applying constraints retroactively to someone else's CA is a different matter. – Matt Nordhoff Feb 23 '15 at 16:18
  • 2
    there is no difference. You can apply name constraints to a 3rd party CA as well. You just sign 3rd party root CA certificate by using your private CA and publish generated cross-certificate. In this case, foreign chain will end up to your private chain through restricted cross-certificate. – Crypt32 Feb 23 '15 at 16:45
up vote 21 down vote accepted

As a rule of thumb:

No, implied in trusting the customer's CA certificate is the trust in every certificate signed by that CA.

I don't know of any applications/libraries that have an easy option that allows you as the end-user to select that you'll trust your customers or any other CA certificate only for certain (sub-) domains i.e. only for *.example.com and *.example.org and nothing else.

Mozilla has a similar concern about currently trusted government sponsored CA's as an open attention point and for instance Chrome has extra checks built in for accessing Google sites, which was how the rogue *.google.com certificate and the compromise of the Diginotar CA became public.

But even if you don't trust the CA, you can still import/trust a specific server certificate signed by that CA, which will prevent SSL warnings for the hostnames in that certificate. That should make your application work without errors or complaints.

Exceptions:

A very underused option of the X.509v3 PKI standard is the Name Constraints extension, which allows a CA certificate to contain white- and blacklists of domain name patterns it is authorized to issue certificates for.

You might be lucky and your customer has restrained themselves when they set up their PKI infrastructure and included that Name constraint in their CA certificate. Then you can import their CA certificate directly and know that it can only validate a limited range of domain names.

  • you are incorrect. It is doable with internal CA server. – Crypt32 Feb 23 '15 at 15:43
  • 2
    @CryptoGuy: An internal CA can also issue certificates for external domains. Once you trust your internal CA there is no restriction such that only certificates for your own (Active Directory or DNS) domain example.com or *.ad.example.com are valid. Your internal CA can also issue certificates for *.example.bank allowing a nice man-in-the-middle attack and snooping your online banking credentials. – HBruijn Feb 23 '15 at 16:02
  • 1
    Well "everything" isn't perfectly accurate. There are things like certificate revocation lists. But that doesn't change the bottom line. – Ben Voigt Feb 23 '15 at 16:08
  • sorry, you are incorrect again. You can restrict 3rd party CA to trust certificates (from that CA) issued to a name list you wish. Regarding your own internal CA, I assume the trust undoubt. If you don't trust your own CA, then something is wrong with your IT. I want to say that by having a private CA, OP can establish a partial trust to a 3rd party CA (by limiting names they trust). – Crypt32 Feb 23 '15 at 16:10
  • 2
    To your edited post: even if 3rd party CA do not have Name Constraints extension, it is possible to apply them by using your own internal CA server via cross-certification. In this case, cert chain will be as follows: leaf SSL cert -> cross-certificate -> your CA certificate -> your internal root certificate. The trick is that you sign 3rd party CA by using your internal CA. And cross-certificate will have all required constraints. – Crypt32 Feb 23 '15 at 18:43

@CryptoGuy had a pretty good answer here, but I wanted to expand on it.

To paraphrase:

You can restrict 3rd party CA to trust certificates (from that CA) issued to a name list you wish. Even if 3rd party CA do not have Name Constraints extension, it is possible to apply them by using your own internal CA server via cross-certification. The trick is that you sign 3rd party CA by using your internal CA.

leaf SSL cert -> cross-certificate -> your CA certificate -> your internal root certificate.

And here's how you make that work (using OpenSSL command line CA)

Create a simple CA

openssl req -new -x509 -days 3650 -newkey rsa:2048 -sha256 -out root-ca.crt -keyout root-ca.key -subj "/CN=My Root CA"

You may skip creating an intermediate CA

Create an intermediate CA request, with Name Constraints.

openssl req -new -days 3650 -newkey rsa:2048 -out domain-ca.req -sha256 -keyout domain-ca.key -config ossl_domain_com.cfg

With this in the ossl_domain_com.cfg file:

[ req ]
prompt=no
distinguished_name=req_distinguished_name
req_extensions=domain_ca

[ req_distinguished_name ]
CN=somedomain.com trust CA

[ domain_ca ]
basicConstraints=critical,CA:true,pathlen:1
nameConstraints=critical,permitted;DNS:.somedomain.com

Then, sign that Intermediate domain CA with your CA.

openssl x509 -req -in domain-ca.req -CA root-ca.crt -CAkey root-ca.key -sha256 -set_serial 1 -out domain-ca.crt -extensions domain_ca -extfile ossl_domain_com.cfg

If you skipped creating the intermediate, use your root CA to sign

Now re-sign the original domain's CA under your authority, using their certificate. You can add the CA extensions here.

openssl x509 -in third_party_ca.crt -CA domain-ca.crt -CAkey domain-ca.key -set_serial 47 -sha256 -extensions domain_ca -extfile ossl_domain_com.cfg -out domain-cross-ca.crt

You may need to use the -x509-to-req argument to create a request, which you'd sign exactly the same way as the intermediate above.

Now, add your root CA, intermediate CA, and the domain-cross-ca to your browser's trust database.

  • MacOS does not support nameConstraints. Just FIY for anyone working on a name constrained internal CA. security.stackexchange.com/questions/95600/… archive.is/6Clgb – jorfus Oct 19 '16 at 17:58
  • Q: what is the status of this solution? What systems does it work in nowadays (2018)? // I have wanted this every time I am forced to install yet another company self signed cert; and every time I think about the Hong Kong Post Office or Symantec. // I think that I might not care not everone implements the narrowing so described, so long as they do not accidentally implement a widening. – Krazy Glew Feb 23 at 2:08
  • @KrazyGlew I have a batch file I use for this, and I still use it regularly. Occasionally I have to reissue the intermediate certs as they expire or rotate, so it's a little more manual, but it hasn't been a problem. I do occasionally run across authority-managed sites which my browser fails to trust due to use of a different intermediate Authority, or an extra domain name they've added, which mine doesn't trust. – davenpcj Jun 12 at 15:45

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.