Skip to content
(Multi-domain ready) Limited DNS server with RESTful HTTP API to handle ACME DNS challenges easily and securely.
Branch: ossobv-readabl…
Clone or download
Pull request Compare This branch is 9 commits ahead, 2 commits behind joohoi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status Coverage Status Go Report Card


A simplified DNS server with a RESTful HTTP API to provide a simple way to automate ACME DNS challenges.


Many DNS servers do not provide an API to enable automation for the ACME DNS challenges. Those which do, give the keys way too much power. Leaving the keys laying around your random boxes is too often a requirement to have a meaningful process automation.

Acme-dns provides a simple API exclusively for TXT record updates and should be used with ACME magic "_acme-challenge" - subdomain CNAME records. This way, in the unfortunate exposure of API keys, the effects are limited to the subdomain TXT record in question.

So basically it boils down to accessibility and security.


  • Simplified DNS server, serving your ACME DNS challenges (TXT)
  • Custom records (have your required A, AAAA, NS, etc. records served)
  • HTTP API automatically acquires and uses Let's Encrypt TLS certificate
  • Limit /update API endpoint access to specific CIDR mask(s), defined in the /register request
  • Supports SQLite & PostgreSQL as DB backends
  • Rolling update of two TXT records to be able to answer to challenges for certificates that have both names: yourdomain.tld and *.yourdomain.tld, as both of the challenges point to the same subdomain.
  • Simple deployment (it's Go after all)

Features in OSSO's ossobv-readable-subdomains

  • Create a single account with a good password
  • Manually set subdomain in records to * to allow setting of all subdomains
  • Use this configuration: CHALLENGE.your.tld NS ACMEDNS.your.tld in static config
  • Then register SUBDOMAIN ("") instead of GUID ("...") which gets tacked onto your hosted domain
  • Point peoples _acme-challenge to your domains:
  • You'll need a slightly adapted version of the acme-dns-certbot
  • Now you can manage multiple domains/subdomains easily


A Certbot authentication hook for acme-dns is available at: ./


Using acme-dns is a three-step process (provided you already have the self-hosted server set up):

  • Get credentials and unique subdomain (simple POST request to eg.
  • Create a (ACME magic) CNAME record to your existing zone, pointing to the subdomain you got from the registration. (eg. _acme-challenge.domainiwantcertfor.tld. CNAME )
  • Use your credentials to POST new DNS challenge values to an acme-dns server for the CA to validate from.
  • Crontab and forget.


Register endpoint

The method returns a new unique subdomain and credentials needed to update your record. Fulldomain is where you can point your own _acme-challenge subdomain CNAME record to. With the credentials, you can update the TXT response in the service to match the challenge token, later referred as ___validation_token_received_from_the_ca___, given out by the Certificate Authority.

Optional:: You can POST JSON data to limit the /update requests to predefined source networks using CIDR notation.

POST /register

OPTIONAL Example input

    "allowfrom": [

Status: 201 Created

    "allowfrom": [
    "fulldomain": "",
    "password": "htB9mR9DYgcu9bX_afHF62erXaH2TS7bg9KW3F7Z",
    "subdomain": "8e5700ea-a4bf-41c7-8a77-e990661dcc6a",
    "username": "c36f50e8-4632-44f0-83fe-e070fef28a10"

Update endpoint

The method allows you to update the TXT answer contents of your unique subdomain. Usually carried automatically by automated ACME client.

POST /update

Required headers

Header name Description Example
X-Api-User UUIDv4 username received from registration X-Api-User: c36f50e8-4632-44f0-83fe-e070fef28a10
X-Api-Key Password received from registration X-Api-Key: htB9mR9DYgcu9bX_afHF62erXaH2TS7bg9KW3F7Z

Example input

    "subdomain": "8e5700ea-a4bf-41c7-8a77-e990661dcc6a",
    "txt": "___validation_token_received_from_the_ca___"


Status: 200 OK

    "txt": "___validation_token_received_from_the_ca___"

Health check endpoint

The method can be used to check readiness and/or liveness of the server. It will return status code 200 on success or won't be reachable.

GET /health

Example using a Kubernetes deployment

# ...
    path: /health
    port: 80
  periodSeconds: 2
  initialDelaySeconds: 2
  failureThreshold: 3
  successThreshold: 1
  # same as for readinessProbe...


You are encouraged to run your own acme-dns instance, because you are effectively authorizing the acme-dns server to act on your behalf in providing the answer to the challenging CA, making the instance able to request (and get issued) a TLS certificate for the domain that has CNAME pointing to it.

See the INSTALL section for information on how to do this.


  1. Install Go 1.11 or newer.

  2. Install acme-dns: go get This will install acme-dns to ~/go/bin/acme-dns.

  3. Edit config.cfg to suit your needs (see configuration). acme-dns will read the configuration file from /etc/acme-dns/config.cfg or ./config.cfg, or a location specified with the -c flag.

  4. If your system has systemd, you can optionally install acme-dns as a service so that it will start on boot and be tracked by systemd. This also allows us to add the CAP_NET_BIND_SERVICE capability so that acme-dns can be run by a user other than root.

    1. Make sure that you have moved the configuration file to /etc/acme-dns/config.cfg so that acme-dns can access it globally.

    2. Move the acme-dns executable from ~/go/bin/acme-dns to /usr/local/bin/acme-dns (Any location will work, just be sure to change acme-dns.service to match).

    3. Create a minimal acme-dns user: sudo adduser --system --gecos "acme-dns Service" --disabled-password --group --home /var/lib/acme-dns acme-dns.

    4. Move the systemd service unit from acme-dns.service to /etc/systemd/system/acme-dns.service.

    5. Reload systemd units: sudo systemctl daemon-reload.

    6. Enable acme-dns on boot: sudo systemctl enable acme-dns.service.

    7. Run acme-dns: sudo systemctl start acme-dns.service.

  5. If you did not install the systemd service, run acme-dns. Please note that acme-dns needs to open a privileged port (53, domain), so it needs to be run with elevated privileges.

Using Docker

  1. Pull the latest acme-dns Docker image: docker pull joohoi/acme-dns.

  2. Create directories: config for the configuration file, and data for the sqlite3 database.

  3. Copy configuration template to config/config.cfg.

  4. Modify the config.cfg to suit your needs.

  5. Run Docker, this example expects that you have port = "80" in your config.cfg:

docker run --rm --name acmedns                 \
 -p 53:53                                      \
 -p 53:53/udp                                  \
 -p 80:80                                      \
 -v /path/to/your/config:/etc/acme-dns:ro      \
 -v /path/to/your/data:/var/lib/acme-dns       \
 -d joohoi/acme-dns

Docker Compose

  1. Create directories: config for the configuration file, and data for the sqlite3 database.

  2. Copy configuration template to config/config.cfg.

  3. Copy docker-compose.yml from the project, or create your own.

  4. Edit the config/config.cfg and docker-compose.yml to suit your needs, and run docker-compose up -d.

DNS Records

Note: In this documentation:

  • is the hostname of the acme-dns server
  • acme-dns will serve * records
  • is the public IP address of the system running acme-dns

These values should be changed based on your environment.

You will need to add some DNS records on your domain's regular DNS server:

  • NS record for pointing to (this means, that is responsible for any * records)
  • A record for pointing to
  • If using IPv6, an AAAA record pointing to the IPv6 address.
  • Each domain you will be authenticating will need a _acme-challenge CNAME subdomain added. The client you use will explain how to do this.

Testing It Out

You may want to test that acme-dns is working before using it for real queries.

  1. Confirm that DNS lookups for the acme-dns subdomain works as expected: dig

  2. Call the /register API endpoint to register a test domain:

$ curl -X POST
  1. Call the /update API endpoint to set a test TXT record. Pass the username, password and subdomain received from the register call performed above:
$ curl -X POST \
  -H "X-Api-User: eabcdb41-d89f-4580-826f-3e62e9755ef2" \
  -H "X-Api-Key: pbAXVjlIOE01xbut7YnAbkhMQIkcwoHO0ek2j4Q0" \
  -d '{"subdomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf", "txt": "___validation_token_received_from_the_ca___"}' \

Note: The txt field must be exactly 43 characters long, otherwise acme-dns will reject it

  1. Perform a DNS lookup to the test subdomain to confirm the updated TXT record is being served:
$ dig -t txt


# DNS interface. Note that systemd-resolved may reserve port 53 on
# In this case acme-dns will error out and you will need to define the listening interface
# for example: listen = ""
listen = ":53"
# protocol, "both", "both4", "both6", "udp", "udp4", "udp6" or "tcp", "tcp4", "tcp6"
protocol = "both"
# domain name to serve the requests off of
domain = ""
# zone name server
nsname = ""
# admin email address, where @ is substituted with .
nsadmin = ""
# predefined records served in addition to the TXT
records = [
    # domain pointing to the public IP of your acme-dns server
    " A",
    # specify that will resolve any * records
    " NS",
# debug messages from CORS etc
debug = false

# Database engine to use, sqlite3 or postgres
engine = "sqlite3"
# Connection string, filename for sqlite3 and postgres://$username:$password@$host/$db_name for postgres
connection = "/var/lib/acme-dns/acme-dns.db"
# connection = "postgres://user:password@localhost/acmedns_db"

# domain name to listen requests for, mandatory if using tls = "letsencrypt"
api_domain = ""
# disable registration endpoint
disable_registration = false
# autocert HTTP port, eg. 80 for answering Let's Encrypt HTTP-01 challenges. Mandatory if using tls = "letsencrypt".
autocert_port = "80"
# listen ip, default "" listens on all interfaces/addresses
ip = ""
# listen port, eg. 443 for default HTTPS
port = "8080"
# possible values: "letsencrypt", "cert", "none"
tls = "none"
# only used if tls = "cert"
tls_cert_privkey = "/etc/tls/"
tls_cert_fullchain = "/etc/tls/"
# only used if tls = "letsencrypt"
acme_cache_dir = "api-certs"
# CORS AllowOrigins, wildcards can be used
corsorigins = [
# use HTTP header to get the client ip
use_header = false
# header name to pull the ip address / list of ip addresses from
header_name = "X-Forwarded-For"

# logging level: "error", "warning", "info" or "debug"
loglevel = "debug"
# possible values: stdout, TODO file & integrations
logtype = "stdout"
# file path for logfile TODO
# logfile = "./acme-dns.log"
# format, either "json" or "text"
logformat = "text"


Authentication hooks



  • v0.7.2
    • Changed
      • Fixed: Regression error of not being able to answer to incoming random-case requests.
      • Fixed: SOA record added to a correct header field in NXDOMAIN responses.
  • v0.7.1
    • Changed
      • Fixed: SOA record correctly added to the TCP DNS server when using both, UDP and TCP servers.
  • v0.7
    • New
      • Added an endpoint to perform health checks
    • Changed
      • A new protocol selection for DNS server "both", that binds both - UDP and TCP ports.
      • Refactored DNS server internals.
      • Handle some aspects of DNS spec better.
  • v0.6
    • New
      • Command line flag -c to specify location of config file.
      • Proper refusal of dynamic update requests.
      • Release signing
    • Changed
      • Better error messages for goroutines
  • v0.5
    • New
      • Configurable certificate cache directory
    • Changed
      • Process wide umask to ensure created files are only readable by the user running acme-dns
      • Replaced package that handles UUIDs because of a flaw in the original package
      • Updated dependencies
      • Better error messages
  • v0.4 Clear error messages for bad TXT record content, proper handling of static CNAME records, fixed IP address parsing from the request, added option to disable registration endpoint in the configuration.
  • v0.3.2 Dockerfile was fixed for users using autocert feature
  • v0.3.1 Added goreleaser for distributing binary builds of the releases
  • v0.3 Changed autocert to use HTTP-01 challenges, as TLS-SNI is disabled by Let's Encrypt
  • v0.2 Now powered by httprouter, support wildcard certificates, Docker images
  • v0.1 Initial release


  • Logging to a file
  • Want to see something implemented, make a feature request!


acme-dns is open for contributions. If you have an idea for improvement, please open an new issue or feel free to write a PR!


acme-dns is released under the MIT License.

You can’t perform that action at this time.