Add support for custom ACME servers#617
Open
Sausageroll2077 wants to merge 2 commits into
Open
Conversation
Allow using a custom/internal ACME server (e.g. step-ca) via CERTPROVIDER=custom and CERTPROVIDERURL=<acme directory url>. - ACMECABUNDLE (file path or base64 PEM) is written to /config/cabundle.pem and trusted via REQUESTS_CA_BUNDLE for both initial issuance and renewals (le-renew.sh). - Optional External Account Binding via EAB_KID/EAB_HMAC_KEY for servers that require it; both must be set or neither. - Custom provider is tracked for change-detection and revocation, so switching servers re-issues against the correct ACME server. Closes linuxserver#186 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Adds a third cert provider option alongside Let's Encrypt and ZeroSSL: a user-defined ACME server. This lets SWAG obtain and renew certificates from an internal/private ACME CA such as step-ca.
New environment variables (all only used when
CERTPROVIDER=custom):CERTPROVIDERURLhttps://ca.example.com/acme/acme/directory. If unset, the container logs an error and sleeps.ACMECABUNDLE/config/cabundle.pemand exported asREQUESTS_CA_BUNDLE.EAB_KID/EAB_HMAC_KEYImplementation notes:
cli.iniserverkey, the same mechanism used for Let's Encrypt/ZeroSSL.REQUESTS_CA_BUNDLEis exported during both initial issuance (init-certbot-config) and renewals (le-renew.sh), since it is an env var and is not persisted incli.ini./config/cabundle.pemis removed when switching back to a non-custom provider..donoteditthisfile.conffor change-detection and revocation, so switching servers revokes against, and re-issues from, the correct ACME server.readme-vars.ymlunder theCERTPROVIDERoption (README is auto-generated), plus a changelog entry.Benefits of this PR and context:
Resolves request #186 for custom ACME server support. Right now there's no way to point SWAG at an internal ACME CA (step-ca, etc.). This will let you set
CERTPROVIDER=customand go. It's fully backwards compatible; nothing changes unless you opt in.It's a fresh take on the abandoned #204, ported to the current s6-overlay v3 /
s6-rc.dlayout, and also wires up CA-bundle trust on the renewal path plus optional EAB support.How Has This Been Tested?
Built the image locally and ran an end-to-end integration suite against real ACME servers on a Docker network:
step-ca (smallstep/step-ca) — issuance, trust, renewal
ACMECABUNDLEprovided as a file path — cert issued by the custom CA;server=set incli.ini;/config/cabundle.pemwritten; no staleeab-kid.ACMECABUNDLEprovided as base64 — bundle decoded and cert issued.CERTPROVIDERURL— container warns and does not issue.le-renew.sh: without the CA bundle the renewal fails withCERTIFICATE_VERIFY_FAILED; with it, certbot establishes a trusted connection and reaches the renewing stage — confirmingREQUESTS_CA_BUNDLEis correctly exported on the cron renewal path.Pebble (letsencrypt/pebble) with EAB required — EAB happy path
EAB_KID+EAB_HMAC_KEY— cert issued;eab-kid/eab-hmac-keywritten tocli.ini; log confirms EAB registration.EAB_HMAC_KEY— registration rejected by the server, no cert.EAB_KID/EAB_HMAC_KEYset — container warns and does not issue.Switching provider back from
customcustom(step-ca) → Let's Encrypt — the old cert is revoked against the custom CA (no TLS verify error),/config/cabundle.pemis removed, andserver=is repointed to Let's Encrypt.custom+ EAB (Pebble) → Let's Encrypt — staleeab-kid/eab-hmac-keyare cleared fromcli.iniand the cabundle is removed, so Let's Encrypt registers cleanly.All scenarios passed.
Source / References: