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

Retrieves one mandatory S3 archive without trusting its contents. More...

Functions

int certbotbot_s3_report (String message, String status)
 Reports a static, non-sensitive failure with a defined status.
 
int certbotbot_s3_fetch (String workspace, String bucket, String key)
 Stages the selected existing S3 archive inside an owned workspace.
 

Detailed Description

Retrieves one mandatory S3 archive without trusting its contents.

This first-party AWS CLI boundary follows ADR-020 and ADR-021. A successful read makes unvalidated bytes available only within a private workspace. It never extracts the archive, reads local Certbot state, issues a certificate, or publishes anything. All external output is withheld from CLI diagnostics. The archive validator, not this module, determines whether those bytes may become active certificate state.

Function Documentation

◆ certbotbot_s3_fetch()

int certbotbot_s3_fetch ( String  workspace,
String  bucket,
String  key 
)

Stages the selected existing S3 archive inside an owned workspace.

The caller must provide a newly created absolute workspace with mode 0700 and ensure it is cleaned after use. This function refuses to overwrite a pre-existing downloaded.tar.gz file. It uses a successful HeadObject call to permit a GetObject download. A HeadObject 404 is confirmed through a successful HeadBucket request before declaring the seeded key absent. Inability to read the remote object is never an invitation to bootstrap.

A nonempty GetObject result is promoted only after AWS reports success. Neither completeness of the tar stream nor trust in archive members is established here. The caller must separately verify both before extraction. AWS stderr and metadata are captured in private files and never repeated.

Parameters
workspacePrivate absolute directory owned by the invocation.
bucketExact existing S3 bucket name.
keyExact selected S3 object key.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
Fixed safe diagnostics only; external output is never copied here.
Return values
0Unvalidated nonempty bytes staged at downloaded.tar.gz.
64Invalid workspace or configuration.
66A confirmed missing seeded S3 object.
69AWS client unavailable or remote state uncertain.
74Transfer, local staging, or zero-length download failed.
Examples
workspace="$(umask 077; mktemp -d)" || exit 1
certbotbot_s3_fetch "$workspace" "$CERTBOTBOT_S3_BUCKET" "$CERTBOTBOT_S3_KEY"
# Validate downloaded.tar.gz before extracting or using its contents.
int certbotbot_s3_fetch(String workspace, String bucket, String key)
Stages the selected existing S3 archive inside an owned workspace.

◆ certbotbot_s3_report()

int certbotbot_s3_report ( String  message,
String  status 
)

Reports a static, non-sensitive failure with a defined status.

Parameters
messageLiteral error message containing no cloud output.
statusDefined nonzero status for this adapter.
STDIN
Nothing is read from STDIN.
STDOUT
Nothing is written to STDOUT.
STDERR
One static diagnostic.
Return values
64Invalid arguments.
66Seeded object positively absent.
69AWS state unavailable or uncertain.
74Download or local staging failure.