Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
Handler
// The server's hostnames. Used for obtaining TLS certificates.
Hostnames []string `json:"hostnames"`
// The sockets on which to listen. For example, "127.0.0.1:9095" or ":443".
Listen []string `json:"listen"`
// Configures the set of trusted proxies, for accurate logging of client IP
// addresses.
TrustedProxiesRaw json.RawMessage `json:"trusted_proxies,omitempty" caddy:"namespace=http.ip_sources inline_key=source"`
// contains filtered or unexported fields
}
A proxy server for ACME DNS-01 challenges. Designed to work with acme.sh's `acmeproxy`, lego's `httpreq`, and Caddy's `acmeproxy` DNS providers.
This is a Caddy application module.
func (App) CaddyModule ¶
func (App) CaddyModule() caddy.ModuleInfo
func (*App) MakeTLSConfig ¶
Returns a TLS app configuration that uses the user-specified DNS provider for ACME challenges during TLS automation.
type ClientPolicy ¶
type ClientPolicy struct {
// Identifies the client to which this policy applies.
UserID string `json:"user_id"`
// Determines the domains for which the user can get TLS certificates. This
// largely follows Smallstep's domain name rules:
// https://smallstep.com/docs/step-ca/policies/#domain-names
//
// Due to a limitation in ACME and DNS-01, allowing a domain also allows
// wildcard certificates for that domain.
AllowDomainsRaw []string `json:"allow_domains,omitempty"`
DenyDomainsRaw []string `json:"deny_domains,omitempty"`
// The policy to be applied to the DNS domains for answering DNS-01
// challenges.
DomainPolicy x509policy.X509Policy `json:"-"`
}
The policy configuration for a user. Specifies the domains at which the user is allowed to answer DNS-01 challenges.
type ClientRegistry ¶
type ClientRegistry struct {
// contains filtered or unexported fields
}
A registry of known users and their corresponding policy configuration.
func (*ClientRegistry) AuthorizeUserChallengeDomain ¶
func (r *ClientRegistry) AuthorizeUserChallengeDomain( req *http.Request, challengeDomain string, ) (optionals.Optional[DenyReason], error)
Determines whether the current authenticated user is allowed to answer a DNS-01 challenge at the given challenge domain. Returns None on success. Otherwise, returns the reason for denial.
func (*ClientRegistry) Provision ¶
func (c *ClientRegistry) Provision( ctx caddy.Context, accountsRaw []RawAccount, ) error
type ConfigFile ¶
type ConfigFile = App
A dns01proxy configuration file is the same as the app configuration.
type DNSConfig ¶
type DNSConfig struct {
// The DNS provider for publishing DNS-01 responses.
ProviderRaw json.RawMessage `json:"provider" caddy:"namespace=dns.providers inline_key=name"`
Provider certmagic.DNSProvider `json:"-"`
// The TTL to use in DNS TXT records when answering challenges. Optional. Not
// usually needed.
TTL *caddy.Duration `json:"ttl,omitempty"`
// Custom DNS resolvers to prefer over system or built-in defaults. Set this
// to a public resolver if you are using split-horizon DNS.
Resolvers []string `json:"resolvers,omitempty"`
}
type DenyReason ¶
type DenyReason string
const ( // Indicates that authorization failed because the user's ID was not found in // the client registry. DenyUnknownUser DenyReason = "unknown user" // Indicates that authorization failed because the user is not authorized to // answer challenges for the requested domain. DenyDomainNotAllowed DenyReason = "requested domain denied by policy" // Indicates that authorization failed because the user requested an invalid // domain. DenyInvalidDomain DenyReason = "requested domain not valid" // Indicates that an error occurred during authorization. DenyError DenyReason = "an error occurred" )
type Handler ¶
type Handler struct {
DNS DNSConfig `json:"dns"`
// Configures HTTP basic authentication and the domains for which each user
// can get TLS certificates.
//
// (During provisioning, this is used to fill in [Authentication] and
// [ClientRegistry].)
AccountsRaw []RawAccount `json:"accounts"`
// Specifies how clients should be authenticated. If absent, then clients must
// be authenticated by an `http.handlers.authentication` instance earlier in
// the handler chain. Derived from [AccountsRaw].
//
// XXX This should be an Optional[*caddyauth.Authentication], but Caddy's
// documentation generator doesn't work with generics.
Authentication *caddyauth.Authentication `json:"-"`
// Identifies the domains at which each client is allowed to answer DNS-01
// challenges. Derived from [AccountsRaw].
ClientRegistry ClientRegistry `json:"-"`
// contains filtered or unexported fields
}
Implements an API for proxying ACME DNS-01 challenges.
This is a Caddy `http.handlers` module.
func (Handler) CaddyModule ¶
func (Handler) CaddyModule() caddy.ModuleInfo
func (*Handler) UnmarshalCaddyfile ¶
Parses a dns01proxy directive into a Handler instance.
Syntax:
dns01proxy {
dns <provider_name> [<params...>]
dns_ttl <ttl>
resolvers <resolvers...>
user <userID> {
password <hashed_password>
allow_domains <domains...>
deny_domains <domains...>
}
}
type RawAccount ¶
type RawAccount struct {
ClientPolicy
// The user's password, hashed using `caddy hash-password`. Optional. If
// omitted, then clients must be authenticated by an
// `http.handlers.authentication` instance earlier in the handler chain.
Password *string `json:"password,omitempty"`
}
type RequestBody ¶
type RequestBody struct {
// The challenge domain at which the DNS-01 response should be written.
ChallengeFQDN string `json:"fqdn"`
// The value of the DNS-01 response.
Value string `json:"value"`
}
func (RequestBody) IsValid ¶
func (r RequestBody) IsValid() bool
type ResponseBody ¶
type ResponseBody = RequestBody