Microsoft services (Windows)¶
Agent 1.5.0 and later include bundled templates that install a renewed certificate in the Windows machine store and bind it to a Microsoft server role: Exchange, Remote Desktop, Routing and Remote Access, DirectAccess, SQL Server, Reporting Services, AD FS, Web Application Proxy, NPS and WinRM. In the desktop app they are listed under Microsoft services in Workflows → + New certificate workflow; they can also be assigned from the dashboard. Agent 1.15.0 and later add a template for LDAPS on a domain controller, and Agent 1.18.0 and later one that uses one certificate for several services.
Not verified on a live server
These templates have not been run against a live server. The role commands were tested only against a mocked PowerShell boundary, and the bundled scripts were only checked by the PowerShell parser. Try each template on a test server, or in a maintenance window with a way back, before you rely on it. Of all the templates, the NPS policy edit is the riskiest.
How the templates work¶
Every template has the same shape:
- Obtain certificate - the certificate the Agent issued or renewed.
- Install in LocalMachine\My - the certificate and its key go into the machine Personal store, not exportable. Where a service runs as its own account, the step also grants that account read access to the private key (see Service accounts).
- Bind to <service> - the new
windows_service.bindstep runs a fixed PowerShell script that is bundled with the Agent for that service. - Inspect the TLS endpoint and Confirm new certificate - only for the templates with a verification port, and only when Verification hostname (optional) is set: the Agent connects to the endpoint and checks that it serves the new certificate. A mismatch rolls the binding back.
The bind step runs elevated as the Agent service. The scripts are part of the signed Agent; there is no way to change them or add your own. The settings of a workflow are passed to the script as data on standard input, never pasted into the script or the command line, so a value cannot change what the script runs. The script reports the previous certificate it replaced; when a later step fails, rollback binds that previous certificate again. The script may run for 120 seconds (600 seconds for Exchange), and the bind step allows 60 seconds more.
A template description in the desktop app and in the dashboard says what it changes, what it restarts and how rollback works, and ends with Not verified on a live server: the role commands were tested only against a mocked PowerShell boundary.
Templates¶
| Template | Changes | Restarts | Rollback | Script timeout |
|---|---|---|---|---|
Exchange Server (exchange) |
Enables the certificate for the selected Exchange services with Enable-ExchangeCertificate (Exchange Management Shell). |
IIS (iisreset /noforce) only when IIS is selected and changed. |
Previous certificate enabled again. | 600 s |
Exchange Server hybrid connectors (exchange-hybrid) |
As Exchange, then sets the certificate as the TLS certificate name of the named hybrid send and, optionally, receive connector (Set-SendConnector, Set-ReceiveConnector -TlsCertificateName). Nothing changes on the Exchange Online side. |
None, unless IIS is selected. | Previous TLS certificate name; a connector failure restores the connectors already changed. | 600 s |
Remote Desktop Gateway (rd-gateway) |
RD Gateway SSL certificate (RDS:\GatewayServer\SSLCertificate). |
TSGateway, which drops gateway connections briefly. | Previous thumbprint. | 120 s |
Remote Desktop listener (RDP) (rdp-listener) |
Win32_TSGeneralSetting.SSLCertificateSHA1Hash of the listener; grants the Remote Desktop service account read access to the key. |
None; new connections use the certificate. | Previous hash. | 120 s |
Remote Desktop Services deployment (rds-deployment) |
Set-RDCertificate on the RD Connection Broker for the selected roles: RD Gateway, RD Web Access, RD Connection Broker redirector and publishing. |
The RemoteDesktop module applies the certificate to each role itself. | Previous certificate per role (see Known limits). | 120 s |
Routing and Remote Access SSTP VPN (rras-sstp) |
Remote Access SSL certificate for SSTP (Set-RemoteAccess -SslCertificate), also for an Always On VPN device tunnel over SSTP. |
RemoteAccess, which drops VPN connections (optional). | Previous certificate. | 120 s |
Routing and Remote Access IKEv2 VPN (rras-ikev2) |
Nothing is bound: RRAS selects the machine certificate itself by its Server Authentication EKU and name. The step checks that RRAS VPN is configured (Get-VpnServerConfiguration) and that the certificate can be selected. Also for Always On VPN user and device tunnels. |
RemoteAccess only when selected (off by default). | Not applicable (store install only). | 120 s |
DirectAccess IP-HTTPS (deprecated) (directaccess-iphttps) |
DirectAccess IP-HTTPS certificate (Set-RemoteAccess -SslCertificate). |
RemoteAccess, which drops DirectAccess connections (optional). | Previous certificate. | 120 s |
SQL Server (sql-server) |
The instance's TLS certificate (registry SuperSocketNetLib\Certificate); grants the SQL Server service account read access to the key. |
The instance service only when selected; otherwise SQL Server uses the certificate from its next restart. | Previous registry value. | 120 s |
SQL Server Reporting Services (ssrs) |
Replaces the certificate of the existing Reporting Services SSL bindings on the IP address and port (MSReportServer_ConfigurationSetting). |
Reporting Services (optional). | Previous binding. | 120 s |
AD FS (adfs) |
AD FS SSL and service communications certificate (Set-AdfsSslCertificate, Set-AdfsCertificate -CertificateType Service-Communications); grants the AD FS service account read access to the key. |
adfssrv (optional). | Previous certificate; if the second change fails, the SSL certificate is set back. | 120 s |
Web Application Proxy (AD FS proxy) (adfs-wap) |
Web Application Proxy SSL certificate (Set-WebApplicationProxySslCertificate). |
None. | Previous certificate (read from the federation host's HTTP.sys binding on 443). | 120 s |
Network Policy Server (PEAP / EAP-TLS) (nps) |
Replaces the server certificate in the EAP configuration of the named network policy (netsh nps export, edit, import); grants the NPS service account read access to the key. |
NPS (IAS) (optional). | The previous certificate is put back into the policy. | 120 s |
WinRM HTTPS listener (winrm-https) |
CertificateThumbprint of the existing WinRM HTTPS listener (WSMan provider). |
None. | Previous thumbprint. | 120 s |
Active Directory LDAPS (domain controller) (ad-ldaps) (Agent 1.15.0+) |
Copies the certificate into the AD DS service store (NTDS\Personal), takes every other certificate out of that store and asks AD DS to load its certificate again (rootDSE renewServerCertificate). See LDAPS on a domain controller. |
None. | Previous certificate put back in the AD DS store (see Known limits). | 120 s |
Microsoft has deprecated DirectAccess; plan a move to Always On VPN. The DirectAccess template is there for existing deployments.
Setup fields¶
Templates with an endpoint check (Exchange, RD Gateway, RDS deployment, RRAS SSTP, DirectAccess, SSRS, AD FS, Web Application Proxy: port 443; WinRM HTTPS: port 5986; Active Directory LDAPS: port 636) also have Verification hostname (optional) - a hostname the service presents on TLS and the certificate covers; leave it empty to skip the check - and Verification port (for SSRS HTTPS port, the port of the existing HTTPS binding, which the check uses too). A Restart … after a change switch restarts the service at once (connections drop briefly); off means the service uses the certificate after its next restart.
| Template | Fields (default) |
|---|---|
| Exchange Server | Use for IIS (Outlook on the web, EWS, ActiveSync) (on), Use for SMTP (on), Use for IMAP4 (off), Use for POP3 (off) |
| Exchange Server hybrid connectors | The same four switches with IIS off by default, Send connector (required, for example Outbound to Office 365 - <GUID>), Receive connector (optional) (for example Default Frontend EX01; empty changes only the send connector) |
| Remote Desktop Gateway | Restart RD Gateway (TSGateway) after a change (on) |
| Remote Desktop listener (RDP) | Remote Desktop listener (RDP-Tcp), Account that reads the private key (NT AUTHORITY\NETWORK SERVICE) |
| Remote Desktop Services deployment | RD Gateway role, RD Web Access role, RD Connection Broker: enable single sign-on, RD Connection Broker: publishing (all on), RD Connection Broker (optional) (the broker's DNS name; empty when this computer is the broker) |
| RRAS SSTP / DirectAccess | Restart Routing and Remote Access after a change (on) |
| RRAS IKEv2 | Restart Routing and Remote Access after a change (off) |
| SQL Server | SQL Server instance (MSSQLSERVER, or the named instance), Account that reads the private key (required, no default; for example NT SERVICE\MSSQLSERVER or NT SERVICE\MSSQL$SALES), Restart the SQL Server instance after a change (off) |
| SQL Server Reporting Services | Reporting Services instance (SSRS; PBIRS for Power BI Report Server), Binding IP address (0.0.0.0), restart (on) |
| AD FS | Account that reads the private key (required; for example CONTOSO\gmsa-adfs$), Restart AD FS (adfssrv) after a change (on) |
| Web Application Proxy | None of its own |
| Network Policy Server | Network policy (required), Account that reads the private key (NT AUTHORITY\NETWORK SERVICE), Restart NPS (IAS) after a change (on) |
| WinRM HTTPS listener | Listener address (* or IP:<address>) |
| Active Directory LDAPS | None of its own |
Service accounts and private key access¶
Some services read the private key under their own account rather than as
LocalSystem. Their templates fill the store installation step's new
read_principals input from Account that reads the private key, so the
account gets read access to that one key. Nothing is guessed: enter a Windows
account name such as DOMAIN\name, NT SERVICE\name or
NT AUTHORITY\NETWORK SERVICE. The desktop app checks the value as a Windows
account name when you save, and the Agent checks it again when the step runs.
In your own workflows, windows_cert_store.install accepts read_principals
(up to 16 account names; see
step action inputs).
LDAPS on a domain controller¶
(Agent 1.15.0+) Active Directory LDAPS (domain controller) is for a domain controller that serves LDAPS with a certificate CertIntel issues, for example one from a public CA, instead of one from your own AD CS.
What the certificate must cover. Clients check the name they connect to,
so the certificate must cover it: usually the domain controller's full name,
such as dc01.corp.example.com, plus any shared name clients use, such as
ldap.example.com. A public CA issues only for names under a public domain
you control, so this works for an Active Directory domain like
corp.example.com and cannot work for corp.local. A domain controller is
normally not reachable from the internet, so use
DNS-01 validation.
One workflow per domain controller. Install the Agent on every domain controller that serves LDAPS and give each its own workflow and certificate. Each Agent (1.16.0+) reports its own domain controller to CertIntel with the certificate it serves now, so the dashboard can fill the workflow form in for you; see Domain controllers.
What the workflow does. AD DS reads its own service certificate store, NTDS\Personal, before the machine Personal store, and when a store holds several usable certificates its choice cannot be predicted. The workflow therefore:
- installs the certificate in LocalMachine\My;
- copies it into NTDS\Personal;
- takes every other certificate out of NTDS\Personal, so that the new one is the only one there;
- asks AD DS to load its certificate again (the rootDSE operation
renewServerCertificate). Nothing is restarted. LDAPS on port 636 and the global catalog on port 3269 use the same certificate.
No certificate and no private key is deleted. A certificate taken out of NTDS\Personal stays in LocalMachine\My; one that was only in NTDS\Personal is copied to LocalMachine\My first. Certificates that are already in LocalMachine\My, such as a domain controller certificate from AD CS, are left alone.
Set the verification hostname. With Verification hostname (optional) set to the domain controller's name and Verification port 636, the workflow connects afterwards and checks that the domain controller serves the new certificate; if it does not, the binding is rolled back. Without it the workflow does not check what the domain controller serves.
Check your LDAPS clients before the first run
Applications and appliances that trust only your internal CA, or that pinned the old certificate, stop connecting when the domain controller serves a certificate from another CA. Add the new CA to them first, and try one domain controller before the others.
One certificate for several services¶
(Agent 1.18.0+) One certificate for several Windows services
(windows-shared-certificate) issues one certificate, installs it once in
LocalMachine\My (not exportable) and binds it to every service you select
on that computer, for example LDAPS, Remote Desktop and NPS on a domain
controller. Without it, each service needs a workflow and a certificate of
its own.
| Service | Switch | Its settings |
|---|---|---|
| Active Directory LDAPS (domain controller) | use_ldaps |
ldaps_host, ldaps_port (636) |
| Remote Desktop listener (RDP) | use_rdp |
rdp_terminal_name (RDP-Tcp), rdp_service_account (NT AUTHORITY\NETWORK SERVICE) |
| Network Policy Server (PEAP / EAP-TLS) | use_nps |
nps_policy, nps_service_account (NT AUTHORITY\NETWORK SERVICE), nps_restart (on) |
| Remote Desktop Gateway | use_rdgateway |
rdgateway_restart (on), rdgateway_host, rdgateway_port (443) |
| WinRM HTTPS listener | use_winrm |
winrm_address (*), winrm_host, winrm_port (5986) |
| Routing and Remote Access SSTP VPN | use_sstp |
sstp_restart (on), sstp_host, sstp_port (443) |
Each service has a Use for … switch, off by default, followed by the same settings as its own template above, named with the service in front (for example Network Policy Server: network policy). What each service does, restarts and rolls back is what its own template does.
- One of each. A workflow binds one of each service: one Remote Desktop listener, one NPS network policy. A second one needs its own workflow.
- The names. The certificate must cover every name the selected services are reached by, for example the domain controller's full name for LDAPS and Remote Desktop.
- Private key access. Only the accounts of the selected services can read the key. The settings of a service that is not selected are saved empty.
- A failure rolls back the earlier services. When a service, or the check of its verification hostname, fails, that service and the services bound before it get their previous certificate back.
- What is required. At least one service, and for each selected service the settings its own template requires. Otherwise the Agent and the dashboard refuse with, for example, No service is selected. Select at least one of: … or Network Policy Server is selected, so its network policy is required.
- Not included: IIS, which has its own template and store rules, and the services not listed in the table. Give those their own workflow.
In the dashboard, Also use this certificate for fills this template in from the servers the Agent detected. On the Agent:
certintel workflows create --template windows-shared-certificate --certificate-id dc01 --domains dc01.corp.example.com --set use_ldaps=true --set ldaps_host=dc01.corp.example.com --set use_rdp=true --set use_nps=true --set nps_policy="Secure Wireless Connections" --issue
Like the other templates on this page it has not been run on a live server.
Prerequisites¶
- Exchange: run the Agent on the Exchange server; the script loads the Exchange Management Shell snap-in.
- Remote Desktop Services deployment: run it on the RD Connection Broker, or name the broker.
- RRAS and DirectAccess: the role must already be installed and configured (The Routing and Remote Access VPN role is not installed and configured. / DirectAccess is not installed and configured on this server.). For IKEv2, clients must trust the issuing CA and match the server name, and the certificate needs the Server Authentication EKU.
- SSRS: the HTTPS URL must already exist (add it in Report Server Configuration Manager first); otherwise the step fails with Reporting Services has no SSL binding on IP:PORT.
- WinRM: an existing HTTPS listener whose Hostname matches the certificate; the template does not create one (There is no WinRM HTTPS listener at address X.).
- AD FS: run a workflow on every AD FS server of the farm.
- Active Directory LDAPS: run the Agent on the domain controller itself (This computer is not a domain controller.). The certificate needs the Server Authentication EKU, which certificates for TLS servers have.
Known limits¶
- RDS deployment restores a single previous thumbprint, and only when all selected roles shared it.
- SQL Server without a previous certificate is not restored to "no certificate" by rollback.
- Exchange rollback timing: the Agent allows a rollback step 2 minutes, less than the 600 seconds an Exchange binding may take.
- NPS: the policy export also holds the RADIUS shared secrets. It is kept in a folder only SYSTEM and Administrators can open and deleted afterwards.
- RRAS IKEv2 binds nothing and has no rollback.
- Active Directory LDAPS: when NTDS\Personal was empty before the first run, rollback does not empty it again; the new certificate stays there. When it held several certificates, rollback restores the one that expires last.
- Active Directory LDAPS: if AD DS cannot be asked to load the certificate, the step fails with The certificate is in the AD DS certificate store, but AD DS could not be asked to load it (renewServerCertificate) and the certificate stays in NTDS\Personal.
Finding the right template¶
In the desktop app, Detect servers on this computer… in the new-workflow template dialog lists the Remote Desktop, RD Gateway, Remote Access and WinRM bindings it finds and, from Agent 1.18.0, the NPS network policies that use a certificate, the SQL Server instances, and the Reporting Services, AD FS and Web Application Proxy bindings, and pre-fills the matching template (read-only, no administrator prompt). The account that reads the private key is not detected; enter it yourself. See Server detection and SQL Server, Reporting Services and AD FS.
On a domain controller (Agent 1.16.0+) the list also holds Active Directory LDAPS (domain controller), with the domain controller's name and the certificate it serves now, and the Agent reports it to CertIntel: Create workflow under Detected on this server in the dashboard opens the workflow form with the template, the names and the verification hostname and port filled in. See Domain controllers. With an older Agent, choose Active Directory LDAPS (domain controller) yourself.