Documentation
¶
Overview ¶
Package acmedns is SynCloud's own ACME challenge server (acme-dns style): a small authoritative DNS server that answers the TXT records of DNS-01 challenges for one zone, so a domain at any registrar can renew wildcard certificates with a single CNAME and no DNS provider.
The zone is _acme-challenge.<a-b-c-d>.sslip.io (ForIP): sslip.io already delegates every name under it to the IP a-b-c-d, so turning the server on needs no NS or A record anywhere, only port 53 open on that IP.
It is not a general name server. It answers TXT, plus the zone's SOA and NS, for names under its challenge zone, and refuses everything else.
Index ¶
- Constants
- Variables
- func IsSslip(c Config) bool
- func ValidConfig(c Config) error
- type Config
- type Server
- func (s *Server) Addr() string
- func (s *Server) Close()
- func (s *Server) Config() Config
- func (s *Server) Configure(ctx context.Context, c Config) error
- func (s *Server) Delete(ctx context.Context, id string) error
- func (s *Server) Enabled() bool
- func (s *Server) Load(ctx context.Context) error
- func (s *Server) Put(ctx context.Context, name, value string) (string, error)
- func (s *Server) Status(ctx context.Context) Status
- func (s *Server) Zone() string
- type Status
Constants ¶
const DefaultListen = ":53"
DefaultListen is where the server listens (UDP and TCP).
const SettingKey = "acme_dns"
SettingKey holds the configuration (JSON) in the settings table.
const SslipSuffix = "sslip.io"
SslipSuffix is the wildcard DNS service whose _acme-challenge delegation the zone relies on.
Variables ¶
var ErrOff = errors.New("the challenge server is off")
ErrOff means the server has no zone.
Functions ¶
func IsSslip ¶ added in v0.5.4
IsSslip reports whether a configuration is the sslip.io form of ForIP (an older one may be a zone under one of the person's domains).
func ValidConfig ¶
ValidConfig checks a configuration (an empty zone switches the server off).
Types ¶
type Config ¶
type Config struct {
Zone string `json:"zone"` // _acme-challenge.203-0-113-9.sslip.io ("" = off)
NS string `json:"ns"` // 203-0-113-9.sslip.io: the host sslip.io delegates the zone to
IP string `json:"ip"` // the controller's public address
// Pinned: the address was given by hand (NAT): it is not followed.
Pinned bool `json:"pinned,omitempty"`
}
Config is the zone the server answers for, the name server host that points at it, and the controller's public address. ForIP makes it.
type Server ¶
type Server struct {
// Listen is the address for UDP and TCP; empty means DefaultListen.
Listen string
// contains filtered or unexported fields
}
Server is the challenge server.
func (*Server) Configure ¶
Configure saves a configuration and (re)starts or stops the listeners. A listen failure does not fail the call: it is shown in the status.
func (*Server) Enabled ¶
Enabled reports whether a zone is configured (the server may still have failed to listen: Status says so).
func (*Server) Put ¶
Put stores a TXT value to answer at a name inside the zone and returns what to hand to Delete.
type Status ¶
type Status struct {
Config
Enabled bool `json:"enabled"`
Listen string `json:"listen"`
Listening bool `json:"listening"`
// Addresses it listens on: Listen itself, or each address that is not
// loopback when another server (systemd-resolved) holds the port on one.
Addresses []string `json:"addresses,omitempty"`
Error string `json:"error,omitempty"`
Records int `json:"records"`
}
Status is what the server is doing.