Repository navigation
fix(ssl): save port 80 stop/start hooks for standalone renewals - #38
Merged
Merged
Conversation
The role stopped the port 80 services in Ansible around the first standalone issuance, so certbot never saved them in the renewal config. Every unattended renewal then failed to bind port 80 while nginx was running, and the certificate expired. The same services are now passed as --pre-hook/--post-hook, which certbot keeps for every renewal.
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.
Written with Claude Opus 5.5
Fixes #37.
Change
In
roles/ssl/tasks/debian.yml, the two standalone requests that answer on port 80 (staging and production, without HAProxy) now passcertbot_create_standalone_stop_servicesto certbot as hooks:certbot saves them in the lineage's renewal config, so unattended renewals free port 80 the same way the first issuance does. If the list is empty, no hooks are passed.
The Ansible stop and start tasks around the first issuance stay in place. The HAProxy variants are unchanged, because they answer on port 8181.
Testing
certbot renew --dry-run --no-random-sleep-on-renewfailed:Could not bind TCP port 80 because it is already in use.commandpasses to certbot:[nginx, haproxy]:'--pre-hook', 'systemctl stop nginx haproxy || true', '--post-hook', 'systemctl start nginx haproxy || true', each hook a single argument;[]: no hook arguments.prettier --checkandyamllintpass.Existing certificates keep their saved renewal config. This only applies to new issuances; older lineages need a re-issue or the hooks added by hand.