Automatic TLS certificate issuance and renewal for Go programs, enabling fully-managed HTTPS with a single line of code.
CertMagic is a robust Go library that automates TLS certificate management, providing fully-managed HTTPS for any Go application. It handles certificate issuance, renewal, OCSP stapling, and HTTP-to-HTTPS redirects, eliminating manual certificate operations. Originally developed as the core of Caddy's TLS automation, it brings enterprise-grade security and reliability to custom Go programs.
Go developers building web servers, APIs, or any networked application requiring automated TLS certificate management, especially those deploying behind load balancers or in clustered environments. It is also suitable for developers needing on-demand TLS for dynamic domain names or wildcard certificates.
Developers choose CertMagic for its maturity, robustness, and comprehensive ACME feature support, including on-demand TLS, cluster-ready storage, and intelligent error handling with retries. It offers one-line HTTPS setup with automatic renewals and OCSP stapling, proven in production by Caddy, making it more reliable than other ACME client libraries for Go.
Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables fully-managed HTTPS with automatic HTTP-to-HTTPS redirects using a single function call like `certmagic.HTTPS()`, as demonstrated in the README's examples.
Implements intelligent retries with exponential backoff for up to 30 days, challenge rotation, and fallback to staging CAs to overcome network issues and rate limits, ensuring reliability.
Supports shared storage backends for coordinated certificate management across multiple instances or behind load balancers, making it ideal for distributed deployments.
Pioneers on-demand certificate issuance during TLS handshakes for dynamic domain names, with configurable policies, as detailed in the On-Demand TLS section.
Works with any ACME-compliant CA, supports all challenge types including DNS for wildcards, and includes features like OCSP stapling and automatic renewal.
Requires persistent storage to cache certificates and avoid CA rate limits; ephemeral storage leads to frequent renewals and potential lockouts, as emphasized in the Storage section.
Configuring DNS challenges for wildcard certificates involves setting up API keys for supported DNS providers via libdns, adding operational overhead and external dependencies.
Custom setups for on-demand TLS or custom storage require implementing decision functions or storage interfaces, which can be complex compared to simpler libraries.
Requires Go 1.21 or newer, which may limit adoption in legacy codebases or environments with fixed older Go versions.