Skip to content

--ensure option for new-account & order#86

Merged
sorah merged 3 commits into
masterfrom
ensure-option
May 6, 2026
Merged

--ensure option for new-account & order#86
sorah merged 3 commits into
masterfrom
ensure-option

Conversation

@sorah

@sorah sorah commented May 5, 2026

Copy link
Copy Markdown
Owner

Provisioning scripts that invoke acmesmith on every boot should be no-ops when state is already in place. This branch adds --ensure to two commands.

new-account: --ensure for idempotent runs

Without --ensure, a second acmesmith new-account crashes on put_account_key raising AlreadyExistafter 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.

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.

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!.

@sorah sorah force-pushed the ensure-option branch from 66614c5 to f16f16d Compare May 6, 2026 00:06
sorah added 3 commits May 6, 2026 09:08
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!.
@sorah sorah force-pushed the ensure-option branch from f16f16d to c1d1a8c Compare May 6, 2026 00:08
@sorah sorah enabled auto-merge May 6, 2026 00:09
@sorah sorah merged commit 127a97c into master May 6, 2026
6 checks passed
@sorah sorah deleted the ensure-option branch May 6, 2026 00:21
hanazuki added a commit to ruby-no-kai/rubykaigi-net that referenced this pull request May 6, 2026
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