--ensure option for new-account & order#86
Merged
Merged
Conversation
Provisioning scripts that always invoke `acmesmith new-account` on boot crash on the second run because put_account_key raises AlreadyExist after a fresh ACME account has already been registered against the directory. With --ensure, the command checks for an existing account key up front and exits 0 without contacting ACME. account_key_exist? lands on Storages::Base with a default that uses get_account_key, so any existing storage backend gains the check without modification.
Provisioning scripts that call `acmesmith order` on every boot should be no-ops when storage already holds a usable certificate. With --ensure, the command skips the ACME order if the current stored certificate has not expired and already contains every identifier (CN + SANs, including IP SANs) the order would request. OrderingService gains a covers? instance method that reuses acme_identifier for normalization, so DNS/IP type and IPv6 formatting differences do not produce false negatives. Client reuses the same OrderingService instance for both the coverage check and perform!.
hanazuki
added a commit
to ruby-no-kai/rubykaigi-net
that referenced
this pull request
May 6, 2026
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.
Provisioning scripts that invoke acmesmith on every boot should be no-ops when state is already in place. This branch adds
--ensureto two commands.new-account: --ensure for idempotent runs
Without
--ensure, a secondacmesmith new-accountcrashes onput_account_keyraisingAlreadyExist— after a fresh ACME account has already been registered against the directory. With--ensure, the command checks for an existing account key up front and exits 0 without contacting ACME.account_key_exist?lands onStorages::Basewith a default that usesget_account_key, so any existing storage backend gains the check without modification.order: --ensure for idempotent issuance
With
--ensure, the command skips the ACME order if the current stored certificate has not expired and already contains every identifier (CN + SANs, including IP SANs) the order would request.OrderingServicegains acovers?instance method that reusesacme_identifierfor normalization, so DNS/IP type and IPv6 formatting differences do not produce false negatives.Clientreuses the sameOrderingServiceinstance for both the coverage check andperform!.