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

Implements explicit desired-lineage pruning in an isolated archive. More...

Functions

int certbotbot_orphans_selected_validate (String selected)
 Confirms the explicit selected identity belongs to the desired set.
 
int certbotbot_orphans_survivors_fingerprint (String config, String selected)
 Fingerprints all retained unselected lineages without archive mutation.
 
int certbotbot_orphans_account_fingerprint (String config)
 Snapshots all existing account material around local pruning only.
 
int certbotbot_orphans_material_preflight (String workspace, String name)
 Checks an original archived certificate without requiring nonexpiry.
 
int certbotbot_orphans_plan (String workspace, String config, String selected)
 Establishes immutable authorized prune targets before provider work.
 
int certbotbot_orphans_apply (String workspace, String config, String selected)
 Deletes only confirmed orphan triplets after successful selected work.
 

Variables

IndexedArray CERTBOTBOT_ORPHANS_TO_REMOVE
 Exact confirmed original archived identities excluded from desired set.
 

Detailed Description

Implements explicit desired-lineage pruning in an isolated archive.

ADR-059 authorizes bounded deletion of only complete, independently classified orphan certificate lineages from one restored, mode-0700 owned workspace. The desired set is not inferred from SANs, selected identity, existing archive members, or implicit defaults. Complete preflight precedes provider action; a selected operation and its unselected-state integrity check precede pruning. The existing validated one-key publisher is the only remote writer. No host-global Certbot deletion is performed.

No state path in this module comes directly from an unvalidated archive string or a shell glob. The expected post-state is a complete, exact nonempty set and account state is verified to survive local pruning.

Function Documentation

◆ certbotbot_orphans_account_fingerprint()

int certbotbot_orphans_account_fingerprint ( String  config)

Snapshots all existing account material around local pruning only.

The selected Certbot action may lawfully update account metadata. This function is invoked after that action, and again after local deletion, which itself has no authority to mutate any account directory or files.

Parameters
configRestored owned configuration root.
STDIN
Nothing is read from STDIN.
STDOUT
SHA-256 digest of sorted account tree including file metadata.
STDERR
Nothing is written to STDERR.
Return values
0Existing account tree fingerprinted.
1Missing account directory or required hash tooling.

◆ certbotbot_orphans_apply()

int certbotbot_orphans_apply ( String  workspace,
String  config,
String  selected 
)

Deletes only confirmed orphan triplets after successful selected work.

Receives the immutable plan calculated from the original archive. The selected lifecycle has already verified its provider result, all original nonselected fingerprints, and the selected certificate. This function snapshots retained and account state, checks each deletion boundary against the still-canonical complete workspace, removes literal matching paths only, and validates the exact requested post-inventory. Any failure discards the local candidate and prohibits publication by the caller.

Parameters
workspaceOwned isolated private workspace.
configCanonical private Certbot config root.
selectedExact verified selected certificate lineage name.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Fixed stage diagnostics, without certificate identity disclosure.
Return values
0Pruned state exactly matches desired members, all valid.
65Unsafe deletion boundary or post-state mutation.
74Local filesystem deletion, fingerprint or verification failed.

◆ certbotbot_orphans_material_preflight()

int certbotbot_orphans_material_preflight ( String  workspace,
String  name 
)

Checks an original archived certificate without requiring nonexpiry.

Expired but structurally authentic certificates remain eligible for an explicitly selected due-renewal or deliberate orphan removal. This read-only preflight validates X.509 PEM syntax, leaf/public-key identity, syntactic chain, and the fullchain's leaf without requiring current validity. Canonical archive state and persisted DNS SANs are checked separately before this call. Temporary comparison files live under the invocation-owned workspace and are removed on every result.

Parameters
workspaceFresh private mode-0700 workspace.
nameOne original validated non-wildcard archived lineage name.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Fixed nonsecret stage diagnostic on failure.
Return values
0All original archived certificate material is structurally valid.
65Malformed or inconsistent leaf, key or chain.
69OpenSSL or compare command is unavailable.

◆ certbotbot_orphans_plan()

int certbotbot_orphans_plan ( String  workspace,
String  config,
String  selected 
)

Establishes immutable authorized prune targets before provider work.

Inventories and canonicalizes the complete original state, verifies the selected identity and every required nonselected desired identity, then treats only original complete lineages absent from the explicit set as orphans. All existing leaves and private keys are independently checked before destructive authority can proceed. Account-only first issuance is allowed when the explicitly selected name is the sole desired identity. A malformed or unreadable candidate fails rather than being deleted.

Parameters
workspaceOwned private restored invocation workspace.
configCanonical private Certbot configuration root.
selectedValidated exact selected lineage.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Nonsecret stage diagnostics, never names or private material.
Returns
Orphans in CERTBOTBOT_ORPHANS_TO_REMOVE.
Return values
0All desired members and orphan candidates are unambiguous.
65Missing desired identity or invalid original lineage material.
Note
Lower-level state or OpenSSL statuses may propagate.

◆ certbotbot_orphans_selected_validate()

int certbotbot_orphans_selected_validate ( String  selected)

Confirms the explicit selected identity belongs to the desired set.

Only a fully valid ordinary selected certificate may anchor a destructive reconciliation. This guard runs after the identity resolver and before the first external S3 operation.

Parameters
selectedResolved non-wildcard selected Certbot lineage name.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
A fixed nonsecret diagnostic if selection is missing or contradictory.
Return values
0Selected identity is an explicitly retained desired member.
64Missing, invalid or contradictory destructive authority.

◆ certbotbot_orphans_survivors_fingerprint()

int certbotbot_orphans_survivors_fingerprint ( String  config,
String  selected 
)

Fingerprints all retained unselected lineages without archive mutation.

A stable GNU tar stream includes file content, modes, relative symlinks, and historical private-key generations. A selected lineage is deliberately omitted because its ordinary provider operation may modify it.

Parameters
configRestored owned configuration root.
selectedExact selected lineage name to exclude.
STDIN
Nothing is read from STDIN.
STDOUT
One SHA-256 digest, without material or identity exposure.
STDERR
Nothing is written to STDERR.
Return values
0Complete digest was calculated.
1Invalid input or absent required tooling.

Variable Documentation

◆ CERTBOTBOT_ORPHANS_TO_REMOVE

CERTBOTBOT_ORPHANS_TO_REMOVE

Exact confirmed original archived identities excluded from desired set.

Bash variable: read-write indexed_array