certs: order on the domain that covers the mail host (#82) #87

Merged
jcoffey-dev merged 1 commits from fix/82-certs-other-domain into main 2026-11-18 17:03:08 +00:00
Owner

Fixes #82.

  • planOrder picks the domain whose name is the closest suffix of the mail host. On another domain it orders there with the install's ACME account: it adds a certificate-only domain (no DKIM keys, nothing published) when the server has none, as the console's Order a certificate does, or adds the host to names entered in the console.
  • A domain on the default names whose server hostname is still another name gets told where to change it, instead of a three-minute wait.
  • certs stops early when the managed Caddy serves another mail host, since the challenge can't reach the server then.
  • Also fixes: RetryCertificates reset a domain's names to the default set on every retry, so names entered in the console were dropped. They're kept now.

Checked in the lab (debian13) with the three fixes together: the new e2e/cases/rename.sh 25/25 (install on lab.test, rename to names on other.test, dns, certs, hostname change, dns --refresh), and the existing certs.sh 21/21 and move-server.sh 56/56. Locally: gofmt, go vet (amd64 and arm64), go test -count=1 ./.... govulncheck only flags this workstation's Go 1.27.3 standard library (GO-2026-6859); CI's Go 1.26.11 has the fix.

Fixes #82. - `planOrder` picks the domain whose name is the closest suffix of the mail host. On another domain it orders there with the install's ACME account: it adds a certificate-only domain (no DKIM keys, nothing published) when the server has none, as the console's Order a certificate does, or adds the host to names entered in the console. - A domain on the default names whose server hostname is still another name gets told where to change it, instead of a three-minute wait. - `certs` stops early when the managed Caddy serves another mail host, since the challenge can't reach the server then. - **Also fixes:** `RetryCertificates` reset a domain's names to the default set on every retry, so names entered in the console were dropped. They're kept now. Checked in the lab (debian13) with the three fixes together: the new `e2e/cases/rename.sh` 25/25 (install on lab.test, rename to names on other.test, `dns`, `certs`, hostname change, `dns --refresh`), and the existing `certs.sh` 21/21 and `move-server.sh` 56/56. Locally: gofmt, `go vet` (amd64 and arm64), `go test -count=1 ./...`. govulncheck only flags this workstation's Go 1.27.3 standard library (GO-2026-6859); CI's Go 1.26.11 has the fix.
jcoffey-dev added 1 commit 2026-11-18 17:00:07 +00:00
certs retried the order on the install's own domain only. The server
orders one certificate per domain, and a domain's default names include
the server's hostname only when it is inside that domain, so a mail host
on another domain was never covered: certs waited three minutes and
failed.

planOrder now picks the domain whose name is the closest suffix of the
mail host. On another domain it orders there with the install's ACME
account: adding a certificate-only domain (no DKIM keys, nothing
published) when the server has none, as the console's Order a
certificate does, or adding the host to names entered in the console. A
domain on the default names whose server hostname is still another name
gets the place to change it instead of a three-minute wait. certs also
stops early when the managed Caddy serves another mail host, since the
challenge can't reach the server then.

RetryCertificates no longer resets a domain's names to the default set
on every retry: names entered in the console are kept.
jcoffey-dev self-assigned this 2026-11-18 17:00:28 +00:00
jcoffey-dev merged commit 4e761b234c into main 2026-11-18 17:03:08 +00:00
jcoffey-dev deleted branch fix/82-certs-other-domain 2026-11-18 17:03:09 +00:00
Sign in to join this conversation.