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

Builds and validates one private portable Certbot archive candidate. More...

Functions

int certbotbot_archive_package (String workspace, String selected)
 Builds one validated gzip tar candidate from selected durable state.
 

Detailed Description

Builds and validates one private portable Certbot archive candidate.

Implements ADR-027: only a complete selected lineage, safe existing selected CA account, and all canonical renewal configurations can enter the candidate stage. Source state is never rewritten to validate paths. GNU tar/gzip serializes config contents, and the existing bounded archive validator checks the exact bytes before the candidate appears.

The builder does not execute Certbot, use S3, authorize publication, or decide whether a successful no-op must be uploaded. The lifecycle owns the private workspace, verifies certificate cryptography separately, and removes all local candidate material after the operation.

Function Documentation

◆ certbotbot_archive_package()

int certbotbot_archive_package ( String  workspace,
String  selected 
)

Builds one validated gzip tar candidate from selected durable state.

Requires a canonical owned mode-0700 workspace with a complete WORKSPACE/config tree and an absent WORKSPACE/candidate.tar.gz. The account/lineage preflight must find the selected lineage present, while permitting other complete lineages. Every archived lineage is validated canonically before serializing the full unchanged configuration tree. The existing renewal parser's verify mode requires the five persisted path values to refer to canonical /etc/letsencrypt, and rejects unsupported metadata without modifying any source file. Selected private-key PEMs may not be readable by anyone other than the owner.

GNU tar writes to an owned mode-0600 staging file using ustar headers, sorted member order and fixed numeric ownership. Only relative configuration contents are archived, retaining live PEM symlinks, versioned keys, account data and renewal configuration. Unsupported tar names, member types or permissions fail the shared pre-extraction validator. The temporary file is removed on failure; after successful validation it is renamed into the single fixed candidate path.

The final candidate has not been cryptographically validated as a certificate and has not been uploaded. Consumers must separately prove usable certificate material and enforce the single-key publication policy and remote error semantics.

Parameters
workspaceCanonical absolute caller-owned mode-0700 workspace.
selectedStable selected non-wildcard certificate lineage name.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Fixed non-sensitive diagnostics; no archive contents or tool output.
Returns
Nothing is written to STDOUT.
Return values
0One verified private candidate is present.
64Invalid workspace, name, or occupied candidate path.
65Unsafe source account, lineage, metadata, or candidate format.
74Local private staging or tar/gzip operation failed.
Note
The caller owns workspace cleanup and must serialize writers.
Examples
certbotbot_archive_package "$workspace" "$CERTBOTBOT_CERT_NAME" ||
exit $?
# Verify certificate/key and upload policy before any S3 mutation.
int certbotbot_archive_package(String workspace, String selected)
Builds one validated gzip tar candidate from selected durable state.