CertMagic is a Go package that obtains, renews, staples, and stores TLS certificates so HTTP servers can serve HTTPS with minimal application code.
Overview
CertMagic is the ACME automation library used by the Caddy web server, packaged for other Go programs. A small integration can stand up HTTPS listeners that redirect HTTP, maintain certificates, and handle renewal without manual file edits.
It supports HTTP, TLS-ALPN, and DNS ACME challenges, multiple issuers, wildcard certificates, on-demand TLS, configurable storage and caching, and event hooks. Retry and backoff logic is built in for long-running issuance attempts.
Developers configure certificate authorities, contact email, rate limits, and staging endpoints for testing. Advanced setups cover clusters behind load balancers and custom DNS providers for challenge solving.
Key features
- Automated issuance and renewal
- HTTP to HTTPS redirect helpers
- HTTP, TLS-ALPN, and DNS challenges
- Wildcard and on-demand TLS options
- Multiple issuer and CA support
- Pluggable storage and cache layers
- OCSP stapling support
- Configurable retry and backoff
Use cases
- Adding HTTPS to custom Go HTTP servers
- Embedding ACME renewal in Go services
- Wildcard TLS with DNS validation
- Testing ACME flows against staging CAs