acmedns

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: MIT Imports: 7 Imported by: 5

README

Joohoi's ACME-DNS provider for libdns

Go Reference

This package implements the libdns interfaces for Joohoi's ACME-DNS.

ACME-DNS server is meant to be used solely for obtaining HTTPS certificates using DNS-01 challenges. Its API is by design limited - the only operation ACME-DNS allows is updating TXT records of one subdomain associated with ACME-DNS account. There are at most two records and older records are deleted as new ones are appended. Due to these limitations, this libdns provider implements only RecordAppender and RecordDeleted interfaces. And DeleteRecords method is a no-op - it doesn't do anything.

This provider is written mostly for Caddy's acmedns plugin. For more information, see:

  1. github.com/caddy-dns/acmedns

  2. github.com/joohoi/acme-dns

  3. A Technical Deep Dive: Securing the Automation of ACME DNS Challenge Validation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainConfig

type DomainConfig struct {
	Username   string `json:"username,omitempty"`
	Password   string `json:"password,omitempty"`
	Subdomain  string `json:"subdomain,omitempty"`
	FullDomain string `json:"fulldomain,omitempty"`
	ServerURL  string `json:"server_url,omitempty"`
}

type Provider

type Provider struct {
	// Provider.Configs defines a map from domain string to
	// DomainConfig. It uses the same structure as ACME-DNS client
	// JSON storage file (https://github.com/acme-dns/acme-dns-client).
	Configs map[string]DomainConfig `json:"config,omitempty"`

	// ACME-DNS account username as returned by ACME-DNS API /register endpoint.
	Username string `json:"username,omitempty"`

	// ACME-DNS account password as returned by ACME-DNS API /register endpoint.
	Password string `json:"password,omitempty"`

	// ACME-DNS account subdomain as returned by ACME-DNS API /register endpoint.
	Subdomain string `json:"subdomain,omitempty"`

	// ACME-DNS API base URL. For example, https://auth.acme-dns.io
	ServerURL string `json:"server_url,omitempty"`
}

Provider must be set up in one of two ways:

1) Set Configs field. Configs field defines a map from domains to different ACME-DNS accounts.

2) Set fields Username, Password, Subdomain, ServerURL. If these fields are set, one account will be used for AppendRecords for all zones and record names.

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, recs []libdns.Record) ([]libdns.Record, error)

Implements libdns.RecordAppender.

The only operation Joohoi's ACME-DNS API supports is a rolling update of two TXT records.

If Provider Configs field is not nil, zone and record names are used to select relevant credentials from Provider.Configs.

If Configs is nil and Provider is set up with non-nil Username, Password, Subdomain and ServerURL fields, these credentials will be used to update ACME-DNS account TXT records regardless of what zone and record names are passed.

Only TXT records are supported. ID, TTL and Priority fields of libdns.Record are ignored.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, recs []libdns.Record) ([]libdns.Record, error)

Implements libdns.RecordDeleter.

DeleteRecords does nothing at all - ACME-DNS does not support record deletion. However, older records are automatically deleted as newer records are added (a rolling update of two records).

Jump to

Keyboard shortcuts

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