forked from ss098/certmagic-s3
Files
readme.md
# CertMagic-S3 CertMagic S3-compatible driver written in Go. This fork of ss098/certmagic-s3 serializes certificate issuance across every instance that shares a bucket, thus concurrent renewals do not run into issuer rate limits. ## Guide Build: ```sh xcaddy build --output ./caddy --with github.com/stepbrobd/certmagic-s3 ``` Build container: ```dockerfile FROM caddy:builder AS builder RUN xcaddy build --with github.com/stepbrobd/certmagic-s3 --with ... FROM caddy COPY --from=builder /usr/bin/caddy /usr/bin/caddy ``` Run: ```sh caddy run --config caddy.json ``` Caddyfile example: ```caddyfile # global options { storage s3 { host "s3.example.com" bucket "my-cert-bucket" access_id "Access ID" secret_key "Secret Key" prefix "ssl" insecure false # plain http when true } } ``` Caddyfile example with AWS IAM role:::: ```caddyfile # global options { storage s3 { host "s3.example.com" bucket "my-cert-bucket" use_iam_provider true prefix "ssl" } } ``` JSON config example: ```json { "storage": { "module": "s3", "host": "s3.example.com", "bucket": "my-cert-bucket", "access_id": "Access ID", "secret_key": "Secret Key", "prefix": "ssl", "insecure": false }, "app": { ... } } ``` From the environment, each variable fills the field the config leaves empty: ```sh S3_HOST S3_BUCKET S3_ACCESS_ID S3_SECRET_KEY S3_PREFIX S3_INSECURE S3_USE_IAM_PROVIDER ``` ## Locking Certificate issuance, storage cleaning, ACME account registration and ECH key rotation are serialized across every instance sharing a bucket. Locks are objects under the `locks/` prefix. A lock is created with `If-None-Match: *`, only one instance can take a given name, and the holder rewrites it every 15 seconds with `If-Match` on the version it last wrote. A lock whose last write is older than 1 minute is stale, and a single waiter reclaims it with the same compare-and-swap. A release writes a released marker the …