Skip to content

Renewal with win-acme

win-acme is an ACME client for Windows. It gets a certificate from a certificate authority such as Let's Encrypt and renews it with a scheduled task. This guide sets win-acme up to hand each new certificate to Lime CRM Server. It applies to Lime CRM Server 2026.3 and later.

win-acme gets and renews the certificate. The certificate deployment tool that comes with Lime CRM Server puts it in place. Do not let win-acme write into the certificate folder of Lime CRM Server, and do not restart the service from a script of your own. The tool does both, and it puts the previous certificate back if the new one does not work.

This guide is for those who already use win-acme or want to run their own ACME client. If you have no such tool today, let Lime CRM Server renew the certificate itself with automatic certificates.

Requirements

  • Lime CRM Server is installed with HTTPS and has a certificate. A self-signed certificate from the installer is enough to start with.
  • The DNS names in the certificate point to the server.
  • The certificate authority can validate the names. Either port 80 on the server is open from the internet, or your DNS provider is supported by win-acme for DNS validation.
  • You are logged on to the server as an administrator.

The commands are written for win-acme 2.2 and for the default data folder %ProgramData%\Lundalogik\LIME Pro Server.

1. Install win-acme

Download win-acme from win-acme.com and unpack it to a permanent folder, for example C:\Tools\win-acme. The scheduled task runs wacs.exe from this folder.

2. Create a folder for the certificate files

win-acme writes the certificate and its private key to a folder of its own. Create it and give access to administrators and the system account only. From an elevated command prompt:

mkdir C:\Certificates\lime
icacls C:\Certificates\lime /inheritance:r /grant "*S-1-5-32-544:(OI)(CI)F" "*S-1-5-18:(OI)(CI)F"

Use a path without spaces.

3. Choose how the names are validated

HTTP validation is the default. The certificate authority connects to port 80 on the server, and win-acme answers while the validation runs. Lime CRM Server does not listen on port 80. Open inbound TCP port 80 in Windows Firewall and in the firewalls in front of the server. Use --validation selfhosting in the command below.

DNS validation needs no open port and is required for wildcard names. win-acme creates a DNS record at your DNS provider. Replace --validation selfhosting with the arguments of your provider from the win-acme reference.

Validation on port 443 (TLS-ALPN) can not be used, because the webfront holds that port.

4. Create the certificate

From an elevated command prompt in the win-acme folder, with your own DNS name and email address:

wacs.exe --source manual --host crm.example.com ^
  --validation selfhosting ^
  --store pemfiles --pemfilespath C:\Certificates\lime --pemfilesname lime ^
  --installation script ^
  --script "C:\ProgramData\Lundalogik\LIME Pro Server\Web Server\tools\deploy-certificate.ps1" ^
  --scriptparameters "-CertFile C:\Certificates\lime\lime-chain.pem -KeyFile C:\Certificates\lime\lime-key.pem" ^
  --accepttos --emailaddress ops@example.com

Several names are given as --host crm.example.com,esign.example.com.

What the arguments do:

  • --store pemfiles writes the certificate as PEM files. lime-chain.pem holds the certificate with its intermediate certificates and lime-key.pem the private key.
  • --installation script runs the certificate deployment tool after every new certificate, with the two files as arguments.
  • Do not add --pempassword. The webfront can not read a private key with a password.
  • Give lime-chain.pem to the tool, not lime-crt.pem. Without the intermediate certificates many clients do not trust the certificate.

win-acme gets the certificate, runs the tool and creates a scheduled task for renewal. The webfront restarts once.

5. Check the result

  1. Open https://crm.example.com/ in a browser and check that the certificate is trusted and has the new expiry date.
  2. Open %ProgramData%\Lundalogik\LIME Pro Server\Web Server\certs\deploy-certificate.log. The last run ends with Certificate deployed and verified successfully.
  3. Open Task Scheduler and check that there is a task whose name starts with win-acme renew.

6. Test a renewal

Run a renewal now, to see that it works without you:

wacs.exe --renew --force

win-acme gets a new certificate and runs the tool again. Check the log as in step 5. Do not repeat this more than needed, since Let's Encrypt limits how many certificates a name can get in a week.

When renewals run

The scheduled task runs every day and renews the certificate when it is due. By default it starts at 09:00 with a random delay of up to four hours, and the webfront restarts when a new certificate is put in place. To move the restart outside working hours, change StartBoundary and RandomDelay under ScheduledTask in settings.json in the win-acme folder, then run:

wacs.exe --setuptaskscheduler

Get told when a renewal fails

The tool ends with an exit code other than 0 when it could not put the certificate in place, and win-acme then logs the script as failed. To get an email, fill in SmtpServer, SenderAddress and ReceiverAddresses under Notification in the same settings.json.

Keep an external check on the expiry date of the certificate as well. A server that is turned off renews nothing.

What the deployment tool does

  1. Copies the current cert.pem and privkey.pem to Web Server\certs\backup.
  2. Puts the new files in place and lets Caddy check that the certificate and the key belong together.
  3. Restarts the lime-crm-webfront service.
  4. Checks that the new certificate is served and that the server answers.
  5. On any failure, puts the previous files back and restarts the service again.
Exit code Meaning Line in deploy-certificate.log
0 The new certificate is served. Certificate deployed and verified successfully.
1 Wrong input. Nothing was changed. A file was not found, this tool only replaces an already installed certificate, or ACME mode
2 Caddy rejected the certificate and key. The previous certificate was put back, without a restart. caddy rejected the new certificate; rolling back without restart.
3 The restart or the check failed. The previous certificate was put back. Could not restart, or was not served by a healthy 'lime-crm-webfront' within 60 seconds

The tool replaces cert.pem and privkey.pem only. The certificate files of a separate eSign portal site, esigncert.pem and esignprivkey.pem, are not changed.

On a server with automatic certificates the tool ends with exit code 1.

Upgrades

At an upgrade of Lime CRM Server, choose Use existing certificate, or --certaction=existing on the command line. The certificate from win-acme is kept. The installer writes the tool to the same folder again, so the win-acme setup needs no change.

Other ACME clients

Any client that can run a command after a renewal works the same way. Let it run one of these as administrator:

"%ProgramData%\Lundalogik\LIME Pro Server\Web Server\tools\deploy-certificate.cmd" -CertFile <fullchain.pem> -KeyFile <privkey.pem>
"%ProgramData%\Lundalogik\LIME Pro Server\Web Server\tools\deploy-certificate.cmd" -PfxFile <certificate.pfx> -PfxPassword <password>

The PEM form is preferred, since it keeps the password off the command line.