Basics: Manual and automatic certificate requests via Lightweight Directory Access Protocol (LDAP) and Remote Procedure Call / Distributed Common Object Model (RPC/DCOM) with the MS-WCCE protocol

The following describes the process that runs in the background when certificates are requested manually or automatically in order to achieve the highest possible level of automation.

Regardless of whether a manual request is made via the certificate management consoles (certmgr.msc for user and certlm.msc for computer certificates), the process is identical.

Do you know TameMyCerts? TameMyCerts is an add-on for the Microsoft certification authority (Active Directory Certificate Services). It extends the function of the certification authority and enables the application of rule sets to realize the secure automation of certificate issuance. TameMyCerts is unique in the Microsoft ecosystem, has already proven itself in countless companies around the world and is available under a free license. It can be downloaded via GitHub and used free of charge. Professional maintenance is also offered.

Step 1: Query the directory service via LDAP

In the first step, the client establishes an LDAP connection to a domain controller and queries the following information:

  • All pKICertificateTemplate objects (certificate templates) in the Active Directory forest.
  • All pKIEnrollmentService objects (enterprise certification authorities) in the Active Directory forest.
  • All msPKI-Enterprise-Oid objects (object identifiers) in the Active Directory forest.

This information is all stored in the Configuration partition of the Active Directory forest.

The pKICertificateTemplate and msPKI-Enterprise-OID objects can be used to determine whether the requester is authorized to request ("enroll") and whether an automatic request is to be made ("auto-enroll"). The default settings for making the certificate request are also determined here.

The connection between already existing certificates and the certificate templates is established via the "Certificate Template Information" extension. This contains the object identifier of the certificate template as well as version information. This prevents certificates from being requested twice during autoenrollment, and certificates can be requested again if a serious change has occurred. Replaced certificates can be identified and archived using this information.

For this reason, the "Certificate Template Information" extension must never be removed from certificates for which autoenrollment is to be used, as otherwise the process will no longer work and side effects could occur.

The pKIEnrollmentService objects can be used to determine the certification authorities that offer the certificate templates to be requested, as well as on which computer in the network the certification authority is running. For this purpose the attributes certificateTemplates and dNSHostName are evaluated.

Step 2: Connection to the target certification authority via RPC/DCOM (MS-WCCE)

In the second step, a key pair and a certificate request are generated based on the queried information and sent to the responsible certification authority. The Windows Client Certificate Enrollment Protocol (MS-WCCE) is used for this.

If several certification authorities offer the same certificate template, the decision is made at random if no site awareness has been configured.

The certification authority can identify the user based on Kerberos authentication and applies the settings specified in the corresponding certificate template with its policy module.

Control of client behavior for autoenrollment

Client behavior is controlled via Group Policy. There are Group Policy settings both for users and for computers.

They can be found under "User Configuration" or "Computer Configuration" - "Windows Settings" - "Public Key Policies" - "Certificate Services Client - Autoenrollment".

  • The "Configuration Model" causes the autoenrollment process to run at all. If this setting is not configured by Group Policy, it is enabled by default on a domain member.
  • The setting "Renew expired certificates, update pending certificates, and remove revoked certificates" causes expired certificates to be renewed automatically if they were issued by an Active Directory-integrated certification authority. In addition, approved certificate requests are fetched from certification authorities if they are available. Revoked certificates are archived. If this setting is not configured by Group Policy, it is disabled by default on a domain member.
  • The "Update certificates that use certificate templates" setting causes certificates to be automatically requested that are enabled for autoenrollment for the enrollee. If this setting is not configured by Group Policy, it is disabled by default on a domain member.

So, by default, all domain members automatically replicate the Public Key Services object of the Active Directory forest through the autoenrollment process when it is triggered.

Determination of the current configuration

The settings can be checked via the registry on Windows computers. They can be found in the "AEPolicy" value under the following paths:

PathDescription
HKCU\Software\Policies\Microsoft\Cryptography\AutoEnrollmentUser settings, configured by Group Policy
HKCU\Software\Microsoft\Cryptography\AutoEnrollmentUser settings, locally configured
HKLM\Software\Policies\Microsoft\Cryptography\AutoEnrollmentComputer settings, configured by Group Policy
HKLM\Software\Microsoft\Cryptography\AutoEnrollmentComputer settings, locally configured

Settings configured via Group Policy take precedence over locally configured settings.

A query can be made via the command line.

Example: Settings set by Group Policy for the currently logged on user account.

reg query ^
HKCU\Software\Policies\Microsoft\Cryptography\AutoEnrollment ^
/v AEPolicy

Example: Computer account settings set by Group Policy.

reg query ^
HKLM\Software\Policies\Microsoft\Cryptography\AutoEnrollment ^
/v AEPolicy

The values mean in detail:

ValueDescriptionResult
0x00000000 or not presentAutoEnrollment process is enabled
"Update certificates that use certificate templates" is disabled
no automatic certificate requests
no automatic renewal of expired certificates
no automatic collection of approved certificate requests
no automatic archiving of revoked certificates
0x00000001AutoEnrollment process is enabled
"Update certificates that use certificate templates" is enabled
"Renew expired certificates, update pending certificates, and remove revoked certificates" is disabled
automatic certificate requests
no automatic renewal of expired certificates
no automatic collection of approved certificate requests
no automatic archiving of revoked certificates
0x00000006AutoEnrollment process is enabled
"Update certificates that use certificate templates" is disabled
"Renew expired certificates, update pending certificates, and remove revoked certificates" is enabled
no automatic certificate requests
automatic renewal of expired certificates
automatic collection of approved certificate requests
automatic archiving of revoked certificates
0x00000007AutoEnrollment process is enabled
"Update certificates that use certificate templates" is enabled
"Renew expired certificates, update pending certificates, and remove revoked certificates" is enabled
automatic certificate requests
automatic renewal of expired certificates
automatic collection of approved certificate requests
automatic archiving of revoked certificates
0x00008000AutoEnrollment is disabledno automatic certificate requests
no automatic renewal of expired certificates
no automatic collection of approved certificate requests
no automatic archiving of revoked certificates

Triggers for starting the autoenrollment process

The triggers for running the autoenrollment process on domain members are:

  • When the user logs on (for computers, when the computer account logs on, i.e. at system startup).
  • By timer every 8 hours.
  • When Group Policy is updated, provided there has been a change.

These settings can be viewed via the Task Scheduler under "Microsoft" - "Windows" - "CertificateServicesClient".

Manually running the autoenrollment process

If you do not want to wait for the autoenrollment to be triggered automatically, you can also start it manually. The different ways to run the autoenrollment process are described in the article "Manually running the autoenrollment process ".

External sources