feat: Private ACME server support, installed-CA viewer, and CA install into the system trust store (freepbx 16) - #14
Open
vsc55 wants to merge 2 commits into
Open
Conversation
…I option to install a CA certificate into the system trust store (via privileged sysadmin hook).
- Escape the certificate CN in result messages (it is rendered as HTML), preventing stored XSS from a crafted certificate subject. - Reject private keys, multi-certificate bundles and oversized input; only a single CA certificate may be installed at a time. - Trust the privileged hook's result: it now checks the exit code of update-ca-trust/update-ca-certificates, rolls back the anchor on failure, and the PHP side reports success only on a real "OK". - Restrict the root hook to the staged file via an explicit argument, wipe stale staged files before each run, and ignore staged files older than 5 minutes (defence in depth). - Include the certificate fingerprint in the stored filename to avoid collisions between different CAs sharing a Common Name.
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.
Summary
Adds the ability to issue Let's Encrypt certificates against a private / self-hosted ACME server (not only the public service) over the existing
http-01challenge, plus tooling to manage the CA certificates the server trusts.Motivation: many deployments run an internal ACME-compatible CA (step-ca, Boulder, Pebble, …) and need certman to talk to it instead of
acme-v02.api.letsencrypt.org.What's included
1. Private / self-hosted ACME server support
fwconsoleoptions):AcmeHttpClienttransport implementingAnalogic\ACME\ClientInterface(does not patch the vendoredlescript, so it survives composer updates). It supports an explicit directory URL (so non-standard paths like step-ca's/acme/<provisioner>/directoryor Pebble's/dirwork), a custom CA bundle (CURLOPT_CAINFO) and an optional insecure mode.updateLE()points lescript at the configured directory and skips the publicmirror1.freepbx.orgreachability probe when a custom server is used (it's only meaningful for the public service). Settings are persisted per certificate and inherited automatically by the renewal paths (cron + web).fwconsole certificates --generate --type le ... --acme-url=<dir> [--acme-ca=<pem>] [--acme-insecure].2. Installed-CA viewer
3. Install a CA into the system trust store (web + CLI)
hooks/install-ca): the web side stages the PEM and the hook copies it into the distribution trust anchors and runsupdate-ca-trust/update-ca-certificates. Installation is confirmed by re-scanning the trust store by fingerprint.fwconsole certificates --install-ca=/path/to/ca.pem(runs the hook directly when root).Security notes
Files of note
Acme/AcmeHttpClient.php(new) — custom ACME transport.hooks/install-ca(new) — privileged CA install hook.views/systemcas.php(new) — Installed CAs page + install form.Certman.class.php,Console/Certman.class.php,views/le.php,views/certgrid.php,assets/js/certman.js,module.xml.Testing
http-01: issued and renewed against the configured directory.fwconsole --install-capath (root, no hook) works.Known limitations / pending testing