Automatic certificates¶
The webfront of Lime CRM Server can get its certificate from an ACME certificate authority, such as Let's Encrypt, and renew it without anyone doing anything. This guide switches an installed server from a certificate file to automatic certificates. It applies to Lime CRM Server 2026.3 and later.
Requirements¶
- Lime CRM Server is installed with HTTPS on port 443.
- The server has a DNS name, for example
crm.example.com, that points to it. An IP address,localhost, a wildcard name or a name ending in.localhost,.local,.internalor.home.arpais not accepted. - The certificate authority can connect to port 443 on the server under that name. With Let's Encrypt the port must be open to the whole internet, see Firewall.
- Nothing in front of the server ends the TLS connection. A load balancer or firewall that passes TCP through works. A reverse proxy or web application firewall that presents its own certificate does not.
- The server can connect out to the certificate authority on port 443, see Firewall.
Port 80 is not used.
Warning
After the switch the server answers only on https://<DNS name>/. Requests to the IP address, to localhost or to another server name fail. Change integrations, monitoring and bookmarks that use another name before you switch.
Firewall¶
With Let's Encrypt, two openings are needed:
| Direction | Port | Address |
|---|---|---|
| Out from the server | TCP 443 | acme-v02.api.letsencrypt.org and acme-staging-v02.api.letsencrypt.org |
| In to the server | TCP 443 | Any address |
Both must stay open after the switch. The webfront renews the certificate at a time it chooses, and every renewal uses both.
Out from the server. Allow both names, also if you never test with staging. After a failed attempt the webfront tries against Let's Encrypt staging first, and asks the real service again only when that works. If the staging name is blocked, the retries fail as well. Allow the names, not IP addresses. Let's Encrypt does not publish the IP addresses of its service, and they change without notice.
In to the server. The port can not be limited to certain addresses. Let's Encrypt checks the name from several places on the internet. It does not publish their addresses, and they can change at any time.
If port 443 can not be open to the whole internet, automatic certificates with Let's Encrypt do not work. There are two other ways:
- Renew with your own tool and DNS validation, which needs no open port. See Renewal with win-acme.
- Use an internal ACME certificate authority, see Other certificate authorities. Then only that certificate authority has to reach the server on port 443, and the server has to reach it.
Before you switch¶
- Check that the DNS name resolves to the server from outside your network.
- Check that
https://<DNS name>/opens from outside your network. A certificate warning is fine at this point. - Pick a time when a short interruption is acceptable. The webfront restarts, and Lime CRM is unavailable until the new certificate is in place, normally less than a minute. If the switch is rolled back, the webfront restarts a second time.
Switch with the window¶
- Log on to the server as an administrator.
- Open
%ProgramFiles(x86)%\Lundalogik\LIME Pro Server\webserver\toolsand double-clickenable-acme-ui.exe. Accept the elevation prompt. The folder is under the installation folder, so the path is different if the server was installed somewhere else. - The window shows Current setup: certificate file and, below it, the certificate the server uses now with its name, issuer and expiry date. The line is red when that certificate has expired or has fewer than 30 days left. Fill in:
- Public DNS name of this server: the name from the requirements. A pasted address such as
https://crm.example.com/is reduced to the name. - Certificate authority:
Let's Encrypt. - Seconds to wait for the certificate: leave at 300.
- Public DNS name of this server: the name from the requirements. A pasted address such as
- Click Switch and confirm. The webfront restarts and the window shows what the tool does.
- Wait for the result. Automatic certificates are enabled means that the server now serves a certificate for the name. Click Close.
- Open
https://<DNS name>/in a browser and check that the certificate is trusted. If the browser says Not secure, see If the browser still shows Not secure.
If the server can not be switched, the window says why in red and Switch is disabled. This is the case when the server is installed with http or on another port than 443.
Switch from the command line¶
From an elevated command prompt:
"%ProgramFiles(x86)%\Lundalogik\LIME Pro Server\webserver\tools\enable-acme.cmd" -Hostname crm.example.com
Optional arguments are -Ca <directory URL>, -CaRoot <root.pem>, -EabKid <id> with -EabMac <key>, -Email <address> and -IssuanceTimeoutSeconds <seconds>. -Hostname takes the DNS name only, without https://. The window runs this command and shows its output.
| Exit code | Meaning |
|---|---|
| 0 | Switched. A certificate for the name is served. |
| 1 | Wrong input or missing files. Nothing was changed. |
| 2 | Caddy rejected the new configuration. Nothing was changed. |
| 3 | The service could not be restarted, or no certificate came in time. The previous configuration was restored. |
| 4 | The switch failed and the previous configuration could not be restored. See Recover by hand. |
Test with Let's Encrypt staging first¶
Let's Encrypt allows 5 failed attempts per hour for a name. To check DNS and the firewall without using up attempts, choose Let's Encrypt staging (test certificates) as certificate authority, or pass -Ca https://acme-staging-v02.api.letsencrypt.org/directory. Browsers do not trust the staging certificate, so a certificate warning is expected after this test. When the switch succeeds, run the tool once more with Let's Encrypt.
If the browser still shows Not secure¶
A browser that opened the site before the switch and accepted a certificate warning can keep showing Not secure, although the new certificate is valid. This happens after the self-signed certificate from the installer and after a test with Let's Encrypt staging. The site information then says Certificate is valid together with Your connection to this site isn't secure.
The browser remembers that the warning was accepted. Nothing is wrong on the server. Restart the browser completely, or open the site in a private window, and the site is shown as secure. In Microsoft Edge, go to edge://restart. Closing the window is not always enough, since Edge can keep running in the background.
Users who never accepted a warning for the site see it as secure at once.
If no certificate is issued¶
The tool waits for the time given, 300 seconds by default. If no valid certificate for the name is served by then, it restores the previous configuration and restarts the webfront, so the server keeps its certificate file. The last errors from the webfront are shown in the window and written to the log.
| Log | Content |
|---|---|
%ProgramData%\Lundalogik\LIME Pro Server\caddy\logs\enable-acme.log |
What the tool did. The View log file link in the window opens it. |
%ProgramData%\Lundalogik\LIME Pro Server\caddy\logs\caddy.log |
Why the certificate authority refused, in the lines with "level":"error". |
Common reasons:
- The DNS name does not point to this server.
- Port 443 is not open from the internet, or is open only for some addresses.
- A proxy in front of the server ends the TLS connection.
- The server can not connect out to the certificate authority.
After the switch¶
The webfront renews the certificate itself, well before it expires, without a restart and without a scheduled task. If a renewal fails it tries again and writes the reason to caddy.log. No message is sent about a failed renewal, so keep an external check on the expiry date of the certificate.
The window shows a late renewal to the one who opens it. Open enable-acme-ui.exe and read the certificate line under Current setup. It is red when less than a quarter of the lifetime of the certificate is left, and then ends with It should have been renewed by now; the reason is in caddy.log. It is also red when the certificate has expired.
Certificates and the account key are stored in %ProgramData%\Lundalogik\LIME Pro Server\caddy\data. The files in Web Server\certs are no longer used, and the certificate deployment tool refuses to run. The files are kept, see Go back to a certificate file.
The switch writes a new Caddyfile. Manual changes in it, such as an enabled eSign portal block, are not carried over and must be made again. The previous files are kept in caddy\config as Caddyfile.before-enable-acme-<time> and settings.json.before-enable-acme-<time>.
Other certificate authorities¶
Choose Other certificate authority in the window to use a commercial or internal ACME certificate authority.
- Directory URL (
-Ca): the ACME directory of the certificate authority. It must start withhttps://. - Root certificate file (
-CaRoot): the root certificate of an internal certificate authority, as a PEM file. The file is read every time the service starts, so keep it in a permanent place. -
External Account Binding key id and key (
-EabKid,-EabMac): for certificate authorities that require an existing account. The key is stored incaddy\config\settings.jsonand in theCaddyfile, which administrators and the service account can read. On the command line it is visible in the process list while the tool runs.The key is written with letters, digits,
-and_only. Some certificate authorities hand out the key with+,/or=in it. Convert it first: replace+with-and/with_, and remove=at the end. The key id must not contain spaces, quotes, braces or backslashes. -
Contact email (optional) (
-Email): an address the certificate authority can use for notices about the certificate. Let's Encrypt does not use a contact address, so the window shows this field for other certificate authorities only.
The window, the command line and the installer check these fields before anything is changed, and say which one is wrong.
The certificate authority must support the TLS-ALPN-01 challenge. It is the only challenge the webfront uses.
Upgrades and new installations¶
At an upgrade, choose Use existing certificate, or --certaction=existing on the command line. The server keeps automatic certificates.
Any other certificate option switches automatic certificates off, and the installer gives no warning about it. It writes the configuration for a certificate file again. With Generate a self-signed certificate it also creates a new cert.pem and privkey.pem in Web Server\certs, and the server answers under any name again. The certificate and the account in caddy\data are left in place, unused. To get automatic certificates back, run the tool again. If the stored certificate is still valid, the webfront uses it again.
The installer window has no page for automatic certificates. For a new server, install with Generate a self-signed certificate and then run the tool. An unattended installation can choose the mode directly:
--certaction=acme --acmehostname=crm.example.com
Go back to a certificate file¶
The certificate file that was used before the switch is still in Web Server\certs. To use it again, open enable-acme-ui.exe, click Use certificate file and confirm. The question shows the name and the expiry date of that certificate. From an elevated command prompt:
"%ProgramFiles(x86)%\Lundalogik\LIME Pro Server\webserver\tools\enable-acme.cmd" -UseCertificateFile
The webfront restarts and Lime CRM is unavailable for a few seconds. The tool waits until the certificate file is served. If it is not served within 60 seconds, the tool restores automatic certificates. The exit codes are the same as for the switch.
The certificate is then no longer renewed by itself. Replace it before it expires, see Replacing a certificate by hand.
A server that was installed with --certaction=acme has no certificate file to go back to. Run the installer and choose another certificate option than Use existing certificate.
Recover by hand¶
If the tool ends with exit code 4, or its window is closed while it runs, the server can be left with the new configuration and no certificate.
- In
%ProgramData%\Lundalogik\LIME Pro Server\caddy\config, copy the newestCaddyfile.before-enable-acme-<time>overCaddyfile. - Copy the newest
settings.json.before-enable-acme-<time>oversettings.json. - Start the
lime-crm-webfrontservice.