|
certbotbot
Reference documentation for a modular Bash project
|
Publishes a verified current archive and optional dated backup. More...
Functions | |
| int | certbotbot_s3_publish (String workspace, String selected, String bucket, String key, String changed, String override) |
| Publishes the full validated candidate to current, then optional dated S3 key. | |
Publishes a verified current archive and optional dated backup.
Implements ADR-028's current-key no-op policy and ADR-033's optional same-payload dated copy. The default remains one authoritative object. This module is a post-success execution adapter. It requires an already successful selected Certbot operation and its independently verified durable-change result from the caller. It never calls Certbot, restores cloud resources, selects an ACME account, or infers a fallback S3 object.
Before PutObject it requires private canonical state and invokes the existing candidate archive builder itself. No arbitrary provided file may bypass validation. Certificate renewal and durable-state changes are distinct: changed=true requires publication even if Certbot issued no new leaf. When changed=false, a successful unchanged no-op publishes only if the explicit override is true. The normative product truth table is in doc/mvp-upload-no-renewal-policy.md. AWS CLI v2 is inherited from the operator's environment; command output is suppressed. Failed PutObject leaves remote state unknown, not necessarily unchanged. The caller owns cleanup and externally serialized S3 writers. Mocked before/after remote digest and lost-response tests are specified in doc/mvp-failure-preservation.md.
| int certbotbot_s3_publish | ( | String | workspace, |
| String | selected, | ||
| String | bucket, | ||
| String | key, | ||
| String | changed, | ||
| String | override | ||
| ) |
Publishes the full validated candidate to current, then optional dated S3 key.
WORKSPACE/config must contain a complete, already processed selected lineage, a single registered production account, and canonical renewal metadata for every stored lineage. The full candidate includes every unrelated lineage, not a selected-only subset. The caller must have verified the Certbot result and certificate material, and must pass the exact bucket/key used for the earlier S3 read.
When CHANGED and OVERRIDE are both false, no candidate or AWS call is performed; CERTBOTBOT_S3_PUBLISHED=false indicates a successful skip. Otherwise the function creates WORKSPACE/candidate.tar.gz through certbotbot_archive_package, which enforces strict tar/gzip validation. When ADR-031 encryption is enabled, only a validated authenticated OCB
## envelope is eligible for the single same-key PutObject call. Migration
## forces one verified publication even for otherwise unchanged Certbot state.
## It sends the chosen file using one AWS CLI v2 s3api put-object call with explicit SHA256 checksum algorithm and application/gzip content type. On successful current PUT CERTBOTBOT_S3_PUBLISHED=true. A failed backup after accepted current PUT is reported as a distinct nonzero partial success, without a speculative rollback. The same exact validated candidate bytes are used for current and backup; there is no independent re-encryption.
The status says whether this local invocation requested and received success from AWS, not whether a later independent read will succeed. S3 concurrent writes and partial/interrupted publication are outside this module's guarantees. The private candidate remains for the workspace owner to remove.
| workspace | Canonical private, owned mode-0700 invocation workspace. |
| selected | Validated selected non-wildcard certificate lineage name. |
| bucket | The same configured existing S3 bucket used for retrieval. |
| key | The same configured object key used for retrieval. |
| changed | Literal true/false verified durable-state change result. |
| override | Literal true/false UPLOAD_NO_RENEWAL configuration value. |
| 0 | Upload was accepted, or a verified unchanged no-op was skipped. |
| 64 | Invalid arguments, bucket/key or private workspace. |
| 65 | Restored selected account/lineage or metadata is unsuitable. |
| 69 | AWS CLI unavailable. |
| 74 | Candidate or current PutObject failed, or current was accepted but the optional backup PutObject/confirmation failed. |