r/sysadmin • u/Reconfirm7004 • 4d ago
Question - Solved Root CA cert lands in Intermediate store and Trusted Root after autoenrollment
I've just built my first 2-tier PKI and published the root and intermediate certificates to AD with certutil -dspublish so domain joined devices pick them up automatically.
I noticed the root CA cert was getting placed in the Intermediate CA store as well as Trusted Root store on clients.
I read somewhere that autoenrollment copies the AD AIA container into the Intermediate store, and that publishing the root with certutil -dspublish puts a copy in AIA.
I deleted the root’s entry from CN=AIA,CN=Public Key Services,CN=Services,CN=Configuration in ADSI Edit and ran certutil -pulse on a test machine.
The root cert disappeared from the Intermediate store so I thought it was fixed, but I‘ve noticed the next time a device autoenrols for a template, the root is placed back into the Intermediate store.
I know this is probably harmless for chain validation, but I‘m just curious if this is expected behaviour.
5
u/SandeeBelarus 4d ago
Install the ADCS RSAT tools. Open pkiview.msc
Then check the AD containers for where you published your certs. Each container corresponds to a use case. Two of the containers will place the certs that are in the stores in machine level trust stores by group policy.
I use this article as a reference. I quite like Marks work over the years and this is his company.
You can use this article to know what store places the cert where. Super easy fix as group policy will remove the cert from the corresponding trust store as you move them from the ad container. And vice versa with adding them back.
https://www.pkisolutions.com/understanding-active-directory-certificate-services-containers-in-active-directory/
The author of this article is my spirit animal Vadims Podans
3
u/Low-Branch1423 4d ago
Its a chain of things that cause this, and its just not clearly set or frankly maintained by MS
Dspublish doesn't distinguish between online and off-line CA. Your root ca is an issuing ca, of the intermediate.
When dspublish is used, the fact it is an issuing CA puts the cert in the AIA container
https://learn.microsoft.com/en-us/windows-server/security/authority-information-access-retrieval?tabs=gp
Everything in the AIA container is then pulled by clients into the intermediate store.
https://www.gradenegger.eu/en/root-authority-certificates-are-imported-into-the-certificate-store-for-intermediate-certification-authorities/
Remove it using cerutil or pkiview.
3
u/davy_crockett_slayer 4d ago
Yes, that's expected. Two different things are putting it there.
certutil -dspublish -f root.crt RootCA writes the cert to both CN=Certification Authorities and CN=AIA. Autoenrollment copies Certification Authorities into Trusted Root and AIA into Intermediate. That's why deleting the AIA object and running a pulse removed it.
The reason it comes back is enrollment itself. The CA returns a PKCS#7 containing the whole chain. When CertEnroll installs that response, the issued cert goes to Personal and every CA cert in the chain, root included, goes to the Intermediate store. Every new enrollment drops it back in, and AD has nothing to do with it.
It's harmless. Trust comes from the Root store, and a self-signed cert sitting in Intermediate doesn't make anything trusted that wasn't already.
I wouldn't have deleted the AIA object. If your sub CA cert has an ldap:/// AIA URL pointing at CN=<root>,CN=AIA, that URL is dead now. certutil -verify -urlfetch against an issued cert will show it failing. Republish with the same command to put it back.
2
u/ToilLess_Dev 4d ago
Hello Reconfirm7004,
the containers are covered above, but that doesn't explain why it comes back after you already removed it from AIA. As far as I know, that's the enrollment itself: when a client enrolls, the CA returns the issued cert with its chain, and Windows puts the CA certs from that response into the Intermediate store, including the self-signed root. So every autoenrollment drops it back in, no matter what's in AIA.
It's harmless, though. Trust comes only from the Trusted Root store, so a root in Intermediate doesn't make anything trusted that wasn't already. I'd leave it alone rather than fight it.
2
u/Cormacolinde Consultant 4d ago
This is perfectly normal and expected. It does not cause issues. The reverse, putting a non-root CA in the root CA store can be catastrophic.
2
u/Optanik 2d ago
It's expected and harmless. certutil -dspublish with RootCA writes the root to both the Certification Authorities container and the AIA container by design. Autoenrollment then syncs the AIA container into the Intermediate store, so the duplicate is normal. If it comes back after you deleted the AIA entry, check two things. First, confirm the AD object is really gone. Look in ADSI Edit again on a DC the client actually talks to, since a DC that hasn't replicated can still hand it out. Second, if AD is clean, the copy is probably coming from the enrollment itself. When the client installs the issued certificate, it usually adds the chain from the CA's response to the local stores, and the root can land in Intermediate that way. Running certutil -enterprise -store CA and certutil -store CA side by side shows which path it came from. Chain building doesn't care about an extra copy of the root in Intermediate, so most people leave the default AIA publication in place and move on.