acmedns

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const DefaultListen = ":53"

DefaultListen is where the server listens (UDP and TCP).

View Source
const SettingKey = "acme_dns"

SettingKey holds the configuration (JSON) in the settings table.

View Source
const SslipSuffix = "sslip.io"

SslipSuffix is the wildcard DNS service whose _acme-challenge delegation the zone relies on.

Variables

View Source
var ErrOff = errors.New("the challenge server is off")

ErrOff means the server has no zone.

Functions

func IsSslip added in v0.5.4

func IsSslip(c Config) bool

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

func ValidConfig(c Config) error

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.

func ForIP added in v0.5.4

func ForIP(ip string) Config

ForIP is the configuration for a public address: the zone sslip.io delegates to it, with nothing to create at any DNS host.

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 New

func New(st *store.Store, log *slog.Logger, listen string) *Server

New makes a server that is off until Load or Configure gives it a zone.

func (*Server) Addr

func (s *Server) Addr() string

Addr is the first address the server listens on ("" when it does not).

func (*Server) Close

func (s *Server) Close()

Close stops the server.

func (*Server) Config

func (s *Server) Config() Config

Config is the current configuration.

func (*Server) Configure

func (s *Server) Configure(ctx context.Context, c Config) error

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) Delete

func (s *Server) Delete(ctx context.Context, id string) error

Delete removes a value stored by Put.

func (*Server) Enabled

func (s *Server) Enabled() bool

Enabled reports whether a zone is configured (the server may still have failed to listen: Status says so).

func (*Server) Load

func (s *Server) Load(ctx context.Context) error

Load reads the saved configuration and starts listening if a zone is set.

func (*Server) Put

func (s *Server) Put(ctx context.Context, name, value string) (string, error)

Put stores a TXT value to answer at a name inside the zone and returns what to hand to Delete.

func (*Server) Status

func (s *Server) Status(ctx context.Context) Status

Status describes the server.

func (*Server) Zone

func (s *Server) Zone() string

Zone is the challenge zone ("" when off).

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.

Jump to

Keyboard shortcuts

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