Skip to content

feat(use-cases): add a certbot example - #40

Merged
pigri merged 3 commits into
mainfrom
feat/certbot-example
Nov 2, 2026
Merged

pigri merged 3 commits into
mainfrom
feat/certbot-example

Conversation

@pigri

@pigri pigri commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

A runnable example of certificates from certbot: certbot gets and renews the certificate with --webroot, and Synapse serves it without a restart. Embedded ACME is deprecated and reverse-proxy-waf already points readers to certbot; there was no example of how.

use-cases/certbot/: Synapse proxy mode with proxy.certificates: /etc/letsencrypt/live and acme.enabled: false; the challenge path routed to an nginx webroot by a second path entry; Pebble (the ACME test server) and certbot in compose; a demo script. Index rows in both READMEs.

Run

With a 0.8.9 build mounted into ubuntu:24.04 (the published image does not exist yet), Pebble 2.9.0, certbot 2.11.0:

  • Before issuing: the handshake fails with alert 40, the log says no certificates were found, the challenge path answers 404 from the webroot.
  • Issue: certificate received; the served chain verifies against Pebble's root.
  • Forced renewal: the served serial changes and the container's start time is the same before and after. No restart, no SIGHUP. The log shows the watcher seeing the new key file.
  • Bad case: no live directory, Synapse does not start: proxy.certificates directory "/etc/letsencrypt/live" does not exist.
  • Control: with the challenge path left out of the routes, the CA gets the / upstream's answer and certbot reports unauthorized. The first draft's route key with a trailing slash did not match; the README says to write it without.
  • make lint and make test pass (36 sets passed, 2 skipped).
  • / carries force_https: true; the challenge route does not. With the challenge route left out, the CA is redirected to HTTPS and certbot reports a connection error (tls: handshake failure).

Not run

  • Real Let's Encrypt.
  • The published 0.8.9 image (the compose default); SYNAPSE_IMAGE overrides it.
  • Releases before 0.8.9 read the same directory but do not pick up a renewal made by certbot's link swap; the README says 0.8.9 or later.

First certificate

A first issuance could be missed by 0.8.9-rc.2 and earlier: certbot makes live/<name>/ and its links within a fraction of a millisecond, and under load Synapse saw only the directory and ignored it. That is fixed on the 0.8.9 branch. Against a build with the fix, the first certificate was served at the first poll in 10 of 10 runs of demo.sh and in 10 of 10 runs with Synapse sharing one CPU with two busy loops. The same starved runs on a build without the fix served it 1 time in 10. The renewal showed a new serial with no restart in each of the 10 idle runs.

Code-reviewed: ad08d3e — 3 findings

  • the app was served in clear on port 80: fixed, force_https on / only, and the control re-run
  • the README's production list kept --email admin@example.com, which Let's Encrypt refuses: fixed
  • the Pebble test certificate was never made again after 30 days: fixed, and the expiry case run

Not re-reviewed: d7e7763 — should-fix batch, config and docs only

Not reviewed: 539b64c — docs only

@pigri
pigri marked this pull request as ready for review November 2, 2026 20:12
@pigri
pigri merged commit a319830 into main Nov 2, 2026
3 checks passed
@pigri
pigri deleted the feat/certbot-example branch November 2, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant