caddyserver /certmagic

Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal

★ 5,617⑂ 368👁 59⑃ 187● 237▤ 34
TA的项目
下载:v0.25.6v0.25.6 ↓0.25.62026-09-30
-1
日增长
5,617
stars
368
forks
59
watchers
187
prs
237
issues
34
releases

README

Easy and Powerful TLS Automation
The same library used by the Caddy Web Server

	
	
	



Caddy's automagic TLS features—now for your own Go programs—in one powerful and easy-to-use library!

CertMagic is the most mature, robust, and powerful ACME client integration for Go... and perhaps ever.

With CertMagic, you can add one line to your Go application to serve securely over TLS, without ever having to touch certificates.

Instead of:

go
// plaintext HTTP, gross 🤢
http.ListenAndServe(":80", mux)


Use CertMagic:

go
// encrypted HTTPS with HTTP-HTTPS redirects - yay! 🔒😍
certmagic.HTTPS([]string{"example.com"}, mux)


That line of code will serve your HTTP router mux over HTTPS, complete with HTTP-HTTPS redirects. It obtains and renews the TLS certificates. It staples OCSP responses for greater privacy and security. As long as your domain name points to your server, CertMagic will keep its connections secure.

Compared to other ACME client libraries for Go, only CertMagic supports the full suite of ACME features, and no other library matches CertMagic's maturity and reliability.




CertMagic - Automatic HTTPS using Let's Encrypt
===============================================

 Menu

- Features
- Requirements
- Installation
- Usage
	- Package Overview
		- Certificate authority
		- The Config type
		- Defaults
		- Providing an email address
		- Rate limiting
	- Development and testing
	- Examples
		- Serving HTTP handlers with HTTPS
		- Starting a TLS listener
		- Getting a tls.Config
		- Advanced use
	- Wildcard Certificates
	- Behind a load balancer (or in a cluster)
- The ACME Challenges
	- HTTP Challenge
	- TLS-ALPN Challenge
	- DNS Challenge
- On-Demand TLS
- Storage
- Cache
- Events
- ZeroSSL
- FAQ
- Contributing
- Project History
- Credits and License


 Features

- Fully automated certificate management including issuance and renewal
- One-line, fully managed HTTPS servers
- Full control over almost every aspect of the system
- HTTP-HTTPS redirects
- Multiple issuers supported: get certificates from multiple sources/CAs for redundancy and resiliency
- Solves all 3 common ACME challenges: HTTP, TLS-ALPN, and DNS (and capable of others)
- Most robust error handling of _any_ ACME client
	- Challenges are randomized to avoid accidental dependence
	- Challenges are rotated to overcome certain network blockages
	- Robust retries for up to 30 days
	- Exponential backoff with carefully-tuned intervals
	- Retries with optional test/staging CA endpoint instead of production, to avoid rate limits
- Written in Go, a language with memory-safety guarantees
- Powered by ACMEz, _the_ premier ACME client library for Go
- All libdns DNS providers work out-of-the-box
- Pluggable storage backends (default: file system)
- Pluggable key sources
- Wildcard certificates
- Automatic OCSP stapling (done right) keeps your sites online!
	- Will automatically attempt to replace revoked certificates!
	- Staples stored to disk in case of responder outages
-

Top issues

Latest release

v0.25.6 v0.25.6 2026-09-30
Almost forgot to update the ZeroSSL dependency which uses the new Authorization: ApiKey ... header.

Full Changelog: https://github.com/caddyserver/certmagic/compare/v0.25.5...v0.25.6

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON