Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

cert-issuer

A small, stateless ACME DNS-01 certificate issuer, built on lego. It is designed for the ComputeStacks load balancer wildcard certificate, but works for any certificate you can validate with DNS.

  • 100+ DNS providers through lego, plus a built-in cloudpress provider.
  • Stateless. It stores nothing. The caller keeps the account key, the certificate key and the issued certificate, and sends a CSR with each request.
  • Run as a command. One JSON request on stdin, one JSON result on stdout, a stable exit-code table. No daemon, no config files, no secrets on argv.

The full interface is in docs/contract.md.

Install

Static linux binaries (amd64, arm64) are attached to each GitHub release.

A minimal container image is published for each release:

docker pull ghcr.io/computestacks/cert-issuer:<version>

To embed the binary in another image:

COPY --from=ghcr.io/computestacks/cert-issuer:<version> /usr/local/bin/cert-issuer /usr/local/bin/cert-issuer

Usage

cert-issuer issue       # JSON request on stdin, JSON result on stdout
cert-issuer version
cert-issuer providers   # supported DNS provider codes

DNS credentials come from the environment, using each provider's own variable names (for lego providers, see the lego DNS docs).

Request using a lego provider (Cloudflare reads CLOUDFLARE_DNS_API_TOKEN):

CLOUDFLARE_DNS_API_TOKEN=... cert-issuer issue < request.json
{
  "version": 1,
  "directory_url": "https://acme-v02.api.letsencrypt.org/directory",
  "account": { "email": "ops@example.com", "key_pem": "-----BEGIN EC PRIVATE KEY-----\n...\n-----END EC PRIVATE KEY-----\n" },
  "csr_pem": "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----\n",
  "dns": { "provider": "cloudflare" }
}

Request using cloudpress (same shape, different provider and credentials):

CLOUDPRESS_API_KEY=... cert-issuer issue < request.json
{
  "version": 1,
  "directory_url": "https://acme-v02.api.letsencrypt.org/directory",
  "account": { "email": "ops@example.com", "key_pem": "..." },
  "csr_pem": "...",
  "dns": { "provider": "cloudpress", "propagation_timeout_seconds": 300 }
}

A successful run prints {"version":1,"status":"ok","certificate_pem":"...",...} and exits 0. Failures print an error document and exit non-zero; see the contract for the fields and exit codes.

The cloudpress provider

Variable Default Description
CLOUDPRESS_API_KEY required API key. CLOUDPRESS_API_KEY_FILE reads it from a file.
CLOUDPRESS_ACCOUNT none Workspace to act in (sent as X-Auth-Account).
CLOUDPRESS_BASE_URL https://my.cloudpress.com A bare host (my.example.com, https:// assumed) or a full URL with an optional path prefix. White-label brands use their own host.
CLOUDPRESS_TTL 60 TTL of the challenge records, in seconds.
CLOUDPRESS_PROPAGATION_TIMEOUT 120 Seconds to wait for propagation.
CLOUDPRESS_POLLING_INTERVAL 2 Seconds between propagation checks.
CLOUDPRESS_HTTP_TIMEOUT 30 API request timeout, in seconds.

Delegating the challenge to a dedicated zone

DNS-01 follows CNAMEs. Instead of giving the issuer access to the zone that holds your real records, create a CNAME once:

_acme-challenge.lb.example.com.  CNAME  lb1.acme.example.net.

The issuer then writes its TXT records into acme.example.net and nothing else. Create a dedicated workspace and API key that can only edit that one zone, so a leaked key cannot touch your production DNS.

Development

make build            # static binary with version metadata
make test             # go test -race ./...
make vet
make lint             # staticcheck
make generate         # regenerate the provider list from lego
make generate-check   # fail if generated files are stale
make integration      # end-to-end tests against Pebble; needs docker
make snapshot         # local GoReleaser dry run (uses docker if goreleaser is absent)

License

AGPL-3.0.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages