Skip to content

After install: deployment steps

Other services on the server use certificates too. Deployment steps hand each new certificate to them after every install and renewal, in order. In the app, they are on the certificate's After install tab: open Add a step, choose a step, fill in its value, and choose Add step; Run now runs them for the certificate in use.

A certificate's After install tab, with no steps yet and Add a step

From the command line:

Terminal window
SSLense.Cli deploy add --site "Shop" --grant-key-access "IIS AppPool\Shop"
SSLense.Cli deploy list --site "Shop"
SSLense.Cli deploy run --site "Shop" # run them now, for the certificate in use
SSLense.Cli deploy remove --site "Shop" --step 2
In the app Command line What it does
Give an account access to the private key --grant-key-access "IIS AppPool\Shop" Adds one read rule for that account. It never removes rules
Restart a Windows service --restart-service MyApp Restarts it and waits until it runs; SSLense's own service is refused
Run a PowerShell script --script C:\Scripts\deploy.ps1 Runs SSLense's own copy, checked by hash
Use it for an IIS FTP site --ftp-site Files Sets the FTP site's certificate for FTP over TLS
Bind it in HTTP.sys outside IIS --http-sys 0.0.0.0:5986 For WinRM, the Windows Admin Center gateway, or a self-hosted app; an endpoint IIS uses is refused
Use it for Remote Desktop --remote-desktop Gives NETWORK SERVICE the key and sets the listener's certificate; new connections use it at once
Use it for SQL Server --sql-server MSSQLSERVER Gives the instance's account the key, sets its certificate, and restarts it
Use it for Apache, nginx or Tomcat --web-server apache --folder C:\Certs\shop --service Apache2.4 Writes the server's files, then restarts its service
Export a PFX file --export-pfx C:\Certs\shop.pfx Needs an exportable key; the password is asked for
Export PEM files --export-pem C:\Certs\shop cert.pem, chain.pem, fullchain.pem, key.pem; needs an exportable key
Export to the IIS Central Certificate Store --central-store \\files\ccs One PFX per name; needs an exportable key
  • The renewal is never undone. The new certificate is installed and bound in IIS; the failure is reported, and SSLense retries the steps every hour until they succeed.
  • The previous certificate stays installed until then, because services may still use it.
  • A new step runs after the next renewal, or at once with Run now or deploy run. Adding a restart step never restarts a service unasked.

A script gets -Thumbprint, -PreviousThumbprint, -Hosts (comma-separated), -NotAfter and -Site. Ready-made scripts are in C:\Program Files\SSLense\deploy-scripts\, including Exchange.ps1 for Exchange's SMTP service and Template.ps1 to start your own.

  • SSLense runs its own copy, in C:\ProgramData\SSLense\deploy-scripts, checks its SHA-256 before every run, and runs it as SYSTEM, for up to 5 minutes or --timeout seconds.
  • After editing the original, remove the step and add it again.
  • Apache and nginx get cert.pem, chain.pem, fullchain.pem and key.pem in the folder. Point their configuration at fullchain.pem and key.pem.
  • Tomcat gets certificate.pfx, a PKCS#12 keystore, with the password you give when adding the step. Point the connector's certificateKeystoreFile at it, with certificateKeystoreType="PKCS12".
  • nginx on Windows usually runs as a service through a wrapper such as WinSW or NSSM; give that service's name.

Exports: PFX, PEM and the Central Certificate Store

Section titled “Exports: PFX, PEM and the Central Certificate Store”

Private keys are non-exportable unless you choose otherwise, which is all IIS needs. For an export, issue the certificate with an exportable key: tick Exportable private key in Add certificate, or use --exportable-key. It is kept at every renewal.

  • The Central Certificate Store gets example.com.pfx for each name, and _.example.com.pfx for *.example.com, as IIS expects. Use the store's private key password set in IIS.
  • key.pem has no password, so SSLense writes it for Administrators and SYSTEM only.
  • Files are replaced in one step, so a reader never sees half a file. The service writes as SYSTEM, which reaches a share as the computer's account.

For a certificate only for Remote Desktop, SQL Server or another service, issue it under a name of your choice instead of a site. Nothing is bound in IIS; its steps hand it on. In the app, tick No IIS site in Add certificate.

Terminal window
SSLense.Cli issue --no-site "Remote Desktop" --names rdp.example.com --validation dns --email ops@example.com
SSLense.Cli deploy add --site "Remote Desktop" --remote-desktop
SSLense.Cli deploy run --site "Remote Desktop"

It needs DNS validation, or HTTP answered by SSLense. Removing it keeps the certificate in the store, because services outside IIS may still use it.