acme

package
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package acme manages automatic TLS certificate issuance and renewal.

Index

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

func (m *Manager) ManageDomains(ctx context.Context, domains []string) error

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

func (m *Manager) ManagedDomains() []string

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) Delete added in v0.33.0

func (s *S3Storage) Delete(ctx context.Context, key string) error

Delete removes a value from S3.

func (*S3Storage) Exists added in v0.33.0

func (s *S3Storage) Exists(ctx context.Context, key string) bool

Exists checks whether a key exists in S3.

func (*S3Storage) List added in v0.33.0

func (s *S3Storage) List(ctx context.Context, prefix string, recursive bool) ([]string, error)

List returns all keys matching a prefix.

func (*S3Storage) Load added in v0.33.0

func (s *S3Storage) Load(ctx context.Context, key string) ([]byte, error)

Load retrieves a value from S3.

func (*S3Storage) Lock added in v0.33.0

func (s *S3Storage) Lock(ctx context.Context, key string) error

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.

func (*S3Storage) Stat added in v0.33.0

func (s *S3Storage) Stat(ctx context.Context, key string) (certmagic.KeyInfo, error)

Stat returns information about a key in S3.

func (*S3Storage) Store added in v0.33.0

func (s *S3Storage) Store(ctx context.Context, key string, value []byte) error

Store puts a value into S3.

func (*S3Storage) Unlock added in v0.33.0

func (s *S3Storage) Unlock(ctx context.Context, key string) error

Unlock releases an advisory lock on a key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL