ACME Bug: Shared SSL certificate automatically revoked and deleted when used by multiple Virtual Hosts on different listeners

#1
Environment
  • OpenLiteSpeed: 1.9.5
  • Operating system: Debian 12
  • Certificate provider: Let's Encrypt
  • Certificate management: OpenLiteSpeed built-in ACME
I have also reported this issue on GitHub:

https://github.com/litespeedtech/openlitespeed/issues/556

Use case
We need to operate two independent Virtual Hosts using the same domain name but different HTTPS listeners and ports.

A typical use case is running a website and a reverse proxy under the same domain name:

  • Website: server.example.com – HTTPS / 443
  • Reverse Proxy: server.example.com – HTTPS / 8090
Both Virtual Hosts should be able to use the same SSL certificate, automatically issued and renewed by OpenLiteSpeed's built-in ACME implementation.

Considering that OpenLiteSpeed provides built-in reverse proxy functionality, sharing a certificate across multiple Virtual Hosts and listeners should be a supported configuration.

SSL certificates are issued for domain names, not for individual Virtual Hosts or TCP ports.

Our intention was to reuse the existing ACME-managed certificate by referencing its certificate and private key files in the secondary Virtual Host.

Alternatively, the same certificate could be configured directly at listener level by specifying the corresponding file paths.

Neither approach should require a separate certificate to be issued for the same domain name.

Actual behavior
OpenLiteSpeed successfully issues the certificate and performs an automatic graceful restart.

However, under certain configurations, OpenLiteSpeed subsequently revokes the certificate through Let's Encrypt and deletes the corresponding certificate directory, including the private key.

This happens even though the certificate is still being used by active listeners.

Explicitly disabling ACME on the secondary Virtual Host does not reliably prevent this behavior.

We also reproduced the issue with ACME set to "Not Set" when the certificate and private key paths were explicitly configured in the secondary Virtual Host.

Steps to reproduce
  1. Enable the built-in ACME functionality.
  2. Configure a Virtual Host with a domain name on an HTTPS listener using port 443.
  3. Configure a second Virtual Host using the same domain name on a separate HTTPS listener using port 8090.
  4. Use the same ACME-generated certificate for both listeners.
  5. Reference the existing certificate and private key files explicitly in the secondary Virtual Host.
  6. Perform a graceful restart.
  7. Monitor the OpenLiteSpeed error log and the ACME certificate directory.
Observed log entries
Successful certificate creation:

21:16:40 [ACME] Create certificate for server.example.com was successful
After explicitly configuring the certificate paths in the secondary Virtual Host and performing another graceful restart:

21:22:53 [config:server:listener:p443:ssl] Using ACME generated SSL certificate configured for [*:443]
21:22:53 [config:server:listener:p8090:ssl] Using ACME generated SSL certificate configured for [*:8090]
21:22:56 [ACME] Revoke certificate for server.example.com was successful
21:22:56 [ACME] Remove certificate for server.example.com was successful
The certificate is revoked and deleted approximately three seconds after both listeners have successfully loaded it.

Domain names in the log excerpts have been anonymized, and the log entries have been shortened for readability.

Expected behavior
  • Multiple Virtual Hosts and listeners should be able to share the same ACME-managed certificate.
  • Disabling ACME on an individual Virtual Host should only disable automatic certificate management for that Virtual Host.
  • Explicitly referencing an existing ACME-generated certificate should not cause its revocation or deletion.
  • Certificates should be reusable at both Virtual Host and listener level.
  • Automatic certificate renewal should remain functional regardless of how many Virtual Hosts or listeners reference the certificate.
  • OpenLiteSpeed should track certificate usage across all Virtual Hosts and listeners before considering a certificate unused.
  • Certificate revocation should be a separate, explicitly initiated administrative action.
Current workaround
The following configuration appears to prevent the issue:

  • Configure the certificate and private key exclusively at listener level.
  • Leave the certificate and private key fields empty in the secondary Virtual Host.
  • Leave the ACME setting of the secondary Virtual Host at "Not Set".
However, this is only a workaround and unnecessarily restricts SSL configuration at Virtual Host level.

Additional feature request: ACME certificate selection in WebAdmin
Another usability issue is that administrators currently need to manually locate the ACME-generated certificate and private key files on the server and copy their absolute paths into the corresponding configuration fields.

Since OpenLiteSpeed already manages these certificates internally, it should also be able to provide a selection of existing ACME-managed certificates directly within the WebAdmin interface.

At least at listener level, it would be very useful to provide two options:

  • Manually enter certificate and private key paths, as currently supported.
  • Select an existing ACME-managed certificate from a dropdown or selection field.
Ideally, this functionality should also be available at Virtual Host and WebAdmin SSL configuration level.

The selection could display the following information:

  • Certificate domain name
  • Additional domain names (SANs)
  • Certificate issuer
  • Expiration date
  • Certificate status
Selecting an existing certificate should automatically associate the corresponding certificate chain and private key with the listener or Virtual Host.

This would eliminate the need to manually search for certificate files, reduce configuration errors, and simplify the reuse of existing certificates.

Ideally, these references should remain valid throughout the entire certificate lifecycle, including automatic renewal.

Impact and design concerns
This issue has been observed on three independent OpenLiteSpeed servers running version 1.9.5.

The automatic revocation of a certificate that is still actively used is particularly concerning.

It can result in:

  • Invalid or revoked certificates being served to clients.
  • Loss of HTTPS access after a server restart.
  • Loss of access to the OpenLiteSpeed WebAdmin interface when it shares the affected certificate.
  • Unnecessary certificate reissuance.
  • Exhaustion of Let's Encrypt certificate issuance rate limits.
  • Production service interruptions.
Disabling automatic certificate management, removing a certificate from the configuration, deleting local certificate files, and revoking a certificate at the certificate authority are fundamentally different operations.

They should not be treated as equivalent.

Even if OpenLiteSpeed determines that a certificate is no longer required for a particular Virtual Host, this does not mean that the certificate is no longer required elsewhere.

Under no circumstances should disabling ACME for one Virtual Host automatically revoke a certificate that is still being used by another Virtual Host or listener.

Certificate revocation should require explicit administrative authorization.

Possible cause in the source code
While investigating this issue, I also looked at the ACME certificate revocation and deletion logic in:

src/http/useacme.cpp

The relevant source code is available here:

https://github.com/litespeedtech/openlitespeed/blob/master/src/http/useacme.cpp

The changes between versions 1.9.3 and 1.9.4 may also be relevant:

https://fossies.org/diffs/openlitespeed/1.9.3_vs_1.9.4/src/http/useacme.cpp-diff.html

It appears that the underlying problem may be the detection of whether an existing certificate is still in use, although the exact cause has not yet been confirmed.

However, I also question the design decision to automatically revoke certificates in the first place.

A web server should never revoke an otherwise valid certificate simply because its internal configuration or certificate management state has changed.

Removing a certificate reference is not the same as requesting certificate revocation.

Conclusion
Please investigate the ACME certificate lifecycle management and the handling of shared certificates across multiple Virtual Hosts and listeners.

A centralized certificate management and selection mechanism within the WebAdmin interface would also be a very welcome improvement.

The corresponding GitHub issue is available here:

https://github.com/litespeedtech/openlitespeed/issues/556

Thank you.
 
Top