Skip to content

fix(ssl): ssl add leaves no rejected nginx conf; ACME first conversion rolls back; prepare errors are E471 (D-0412) - #903

Merged
acamarata merged 2 commits into
mainfrom
debt-8-d0412
Oct 20, 2026
Merged

acamarata merged 2 commits into
mainfrom
debt-8-d0412

Conversation

@acamarata

Copy link
Copy Markdown
Collaborator

Closes the cli items of D-0412 (the harness item landed in plugins#161).

  • ssl add (certbot path and --acme): snapshot custom-.conf before writing it; when nginx -t or the reload rejects the new conf, remove it (or restore the previous bytes) and say so in the error. Before, a bad --upstream left a conf that failed the next nginx restart.
  • acme.prepare: if the symlink switch fails right after a real directory was renamed to its first generation, rename it back (the target was left without a link until the next Repair).
  • acme.Install: prepare errors are wrapped with ErrInstall, so they answer E471 instead of a bare refusal.

Tests: TestACMEFirstConversionFailure (restore + E471), TestConfSnapshotRestore (new and existing conf), TestSSLAddACMENginxRejectsConf (end to end). The first fails before the fix on both assertions; the last fails with the restore call removed. gofmt clean; go vet ./cmd/commands ./internal/ssl/... and go test -race ./internal/ssl/... ./cmd/commands/ pass.

…d first conversion, tag prepare errors as install failures (D-0412)

ssl add (certbot and --acme) snapshots custom-<domain>.conf before writing it
and puts it back when nginx -t or the reload rejects it, so the next restart
still starts. The first ACME conversion of a real directory renames it back when
the symlink switch fails. Errors from preparing a generation carry ErrInstall so
they answer E471.
@acamarata
acamarata merged commit a3adcdf into main Oct 20, 2026
31 of 34 checks passed
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