Documentation
¶
Overview ¶
Package acme manages automatic TLS certificate issuance and renewal.
Index ¶
- func DiscoverDomains(cfg *config.ACMEDNSConfig) ([]string, error)
- type CertStatus
- type Manager
- type S3Storage
- func (s *S3Storage) Delete(ctx context.Context, key string) error
- func (s *S3Storage) Exists(ctx context.Context, key string) bool
- func (s *S3Storage) List(ctx context.Context, prefix string, recursive bool) ([]string, error)
- func (s *S3Storage) Load(ctx context.Context, key string) ([]byte, error)
- func (s *S3Storage) Lock(ctx context.Context, key string) error
- func (s *S3Storage) Stat(ctx context.Context, key string) (certmagic.KeyInfo, error)
- func (s *S3Storage) Store(ctx context.Context, key string, value []byte) error
- func (s *S3Storage) Unlock(ctx context.Context, key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverDomains ¶
func DiscoverDomains(cfg *config.ACMEDNSConfig) ([]string, error)
DiscoverDomains fetches all active zones from the DNS provider account and returns domain pairs (zone + wildcard) for certificate management. Uses the same API token configured for DNS-01 challenges.
Types ¶
type CertStatus ¶
type CertStatus struct {
Domain string `json:"domain"`
Status string `json:"status"` // "active", "pending"
Expires *time.Time `json:"expires,omitempty"`
Issuer string `json:"issuer,omitempty"`
}
CertStatus describes the current state of a managed certificate.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager wraps CertMagic to provide automatic certificate management.
func New ¶
func New(cfg *config.ACMEConfig, configDir string) (*Manager, error)
New creates an ACME manager from the service's ACME config. configDir is the directory containing the config file, used to resolve relative storage paths.
func (*Manager) CertificateStatus ¶
func (m *Manager) CertificateStatus() []CertStatus
CertificateStatus returns the status of all managed certificates. For each managed domain, it checks if a valid certificate exists in the CertMagic cache. Domains without a cached certificate are reported as "pending".
func (*Manager) Close ¶
func (m *Manager) Close()
Close cleanly shuts down the ACME manager and its certificate cache.
func (*Manager) GetCertificate ¶
func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns the CertMagic GetCertificate callback for use in tls.Config.
func (*Manager) ManageDomains ¶
ManageDomains starts certificate management for the given domains. This triggers certificate issuance for any domains that don't already have valid certificates in storage. Certificates are obtained in the background — the call returns immediately without blocking.
func (*Manager) ManagedDomains ¶
ManagedDomains returns the currently managed domain list.
type S3Storage ¶ added in v0.33.0
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements certmagic.Storage and certmagic.Locker using an S3-compatible object storage backend.
func NewS3Storage ¶ added in v0.33.0
func NewS3Storage(cfg *config.ACMES3Config) (*S3Storage, error)
NewS3Storage creates an S3Storage from the ACME S3 config.
func (*S3Storage) Lock ¶ added in v0.33.0
Lock acquires an advisory lock on a key using S3 objects. It polls until the lock is acquired or the context is cancelled. Lock acquisition is serialized per-key within the same process to avoid concurrent PutObject calls to the same key (prevents 429 rate limits) while allowing independent domains to lock in parallel.