certbotbot
Reference documentation for a modular Bash project
Loading...
Searching...
No Matches
Functions | Variables
renew.bash File Reference

Renews only one restored Certbot lineage and classifies local changes. More...

Functions

int certbotbot_renew_sans_read (String cert)
 Reads a certificate's strict DNS-only SAN set without changing state.
 
int certbotbot_renew_sans_match (String cert, String arg)
 Compares validated actual DNS SANs with the desired set exactly.
 
int certbotbot_renew_fingerprint (String config)
 Computes a stable private digest of all persistent config state.
 
int certbotbot_provider_renew (String workspace, String selected, String arg)
 Renews one existing lineage when due, preserving ordinary no-ops.
 

Variables

IndexedArray CERTBOTBOT_EXISTING_SANS
 Canonical DNS names read from a validated existing leaf extension.
 

Detailed Description

Renews only one restored Certbot lineage and classifies local changes.

ADR-025 permits normal due-renewal only for an already selected and fully restored lineage with exactly matching current and desired DNS SANs. Path mapping is reversible, and returned result variables reflect only verified local state, never remote S3 publication. ADR-029 broadens valid same-lineage SAN drift while malformed leaf SAN extensions fail closed. The installed Certbot and Route53 plugin retain ACME/DNS authority.

Function Documentation

◆ certbotbot_provider_renew()

int certbotbot_provider_renew ( String  workspace,
String  selected,
String  arg 
)

Renews one existing lineage when due, preserving ordinary no-ops.

A private canonical workspace and its one restored selected lineage must pass local preflight. DNS SANs in the leaf PEM must match requested SANs. A mismatch is an explicit policy failure, not an implicit reissue.

Installed Certbot must list dns-route53 and recognize the exact restored account. The provider maps five canonical renewal path fields to private paths, then invokes 'certbot renew –cert-name NAME' with explicit private directories, account, selected ACME server, noninteractive mode, and hook suppression. It validates resulting lineage and SANs, returns renewal paths to canonical form, and compares durable state fingerprints. It never invokes global renew, register, forced renewal or publication.

CERTBOTBOT_RENEWAL_OCCURRED and CERTBOTBOT_DURABLE_CHANGED are cleared at entry and on failure; on success they are set to true or false. The first indicates whether selected certificate content/link changed. The second detects any changed restored configuration bytes, links or permissions. The caller must still validate a candidate archive prior to remote writes.

Parameters
workspaceOwned canonical mode-0700 private runner directory.
selectedStable non-wildcard selected Certbot certificate name.
argExact desired distinct literal DNS SANs (one to 100).
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Fixed non-sensitive diagnostics; Certbot output is not forwarded.
Returns
Nothing is written to STDOUT.
Return values
0Selected-only renewal completed and local state is coherent.
64Unsafe workspace, identity or requested SAN set.
65Mismatched SANs or inconsistent/unsafe local renewal state.
69Installed provider unavailable or account not recognized.
74Failed Certbot invocation or local snapshot/staging.
Examples
certbotbot_provider_renew "$workspace" "$name" "${sans[@]}" || exit $?
# Combine durable-change result with UPLOAD_NO_RENEWAL later.
int certbotbot_provider_renew(String workspace, String selected, String arg)
Renews one existing lineage when due, preserving ordinary no-ops.

◆ certbotbot_renew_fingerprint()

int certbotbot_renew_fingerprint ( String  config)

Computes a stable private digest of all persistent config state.

GNU tar recursively serializes configuration in name order with fixed modification time, owner and group metadata; permissions, file bytes and symbolic-link targets remain part of the digest. GNU sha256sum hashes the byte stream; neither stream nor hash is emitted outside the caller. This is local change detection, not a filesystem transaction or lock.

Parameters
configPrivate Certbot configuration directory to inspect.
STDIN
Nothing is read from STDIN.
STDOUT
One lowercase SHA-256 digest followed by newline.
STDERR
Nothing is written to STDERR.
Returns
SHA-256 digest of the normalized local archive stream.
Return values
0Snapshot completed successfully.
1A required tool or tar/hash stage failed.

◆ certbotbot_renew_sans_match()

int certbotbot_renew_sans_match ( String  cert,
String  arg 
)

Compares validated actual DNS SANs with the desired set exactly.

A strict structural read occurs before set comparison. DNS identities may belong to unrelated apexes, with ordering irrelevant. This predicate is not sufficient to distinguish malformed from merely different old SANs; callers authorizing reconciliation MUST first use certbotbot_renew_sans_read.

Parameters
certAbsolute readable existing leaf PEM path.
argOne to 100 distinct canonical desired DNS SAN strings.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Nothing is written to STDERR.
Returns
Nothing is written to STDOUT.
Return values
0Actual and requested DNS SAN sets match.
1Invalid leaf/desired SANs or differing sets.

◆ certbotbot_renew_sans_read()

int certbotbot_renew_sans_read ( String  cert)

Reads a certificate's strict DNS-only SAN set without changing state.

A supported OpenSSL extension has an exact ordinary or critical SAN header and one comma-separated line of DNS entries. Missing, unsupported, duplicated, malformed, excessive or non-DNS entries are rejected before certificate mutation. The parser does not compare against requested SANs: valid-but-different and invalid-existing state must remain distinguishable during reconciliation.

Parameters
certAbsolute readable existing leaf PEM path.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Nothing is written to STDERR.
Returns
Nothing is written to STDOUT; CERTBOTBOT_EXISTING_SANS is set.
Return values
0Existing SAN list is canonical, DNS-only, nonempty and distinct.
1No valid supported SAN extension was available.

Variable Documentation

◆ CERTBOTBOT_EXISTING_SANS

CERTBOTBOT_EXISTING_SANS

Canonical DNS names read from a validated existing leaf extension.

Reset on every read. No private certificate bytes are printed to the caller. This array is an internal transient result, not durable state.

Bash variable: read-write indexed_array