A CoreDNS plugin to serve temporary TXT records for validation purposes (eg. Let's Encrypt DNS-01)

temptxt

Name

temptxt - serves TXT records for validation purposes (eg. ACME DNS-01 challenge) updated through a HTTP api.

Description

The temptxt plugin is useful for delegating the configuration of TXT records for purposes such as certificate validation (eg. ACME DNS-01).

Users can update the content of the TXT records through a HTTP API. Authentication to the API is handled by a HTTP header passed from the upstream reverse proxy.

Syntax

temptxt [PREFIX] [SUFFIX] {
    [txt FQDN REGEXP1 REGEXP2 ...]
    [txt_alias ACTUAL_FQDN UPDATE_FQDN REGEXP1 REGEXP2 ...]

    [auth_header X-Forwarded-User]
    [clean_interval DURATION]
    [max_age DURATION]
    [listen ADDRESS]
}
  • PREFIX - Prefix to add to FQDNs. This only affects DNS queries. Updates through the API need to use the FQDN without the prefix (txt_alias doesn't used prefix).
  • SUFFIX - Suffix to add to FQDNs. This only affects DNS queries. Updates through the API need to use the FQDN without the suffix (txt_alias doesn't used suffix).
  • txt - FQDN to serve txt records for. If one of the regexps matches the username, the API request will be allowed. Regexps are automatically anchored with ^ and $.
  • txt_alias - Useful in use cases like example 2. UPDATE_FQDN is the FQDN that is used when calling the API, but the TXT record for ACTUAL_FQDN will be the one that is actually updated.
  • auth_header - The header that contains the username for API authentication. Make sure that this a user cannot set the contents of the header. Default: X-Forwarded-User
  • clean_interval - The interval that records will be periodically cleared. Set to 0 to disable cleaning. Default: 0.
  • max_age - If the time since the record has last been updated is greater than the given duration, the contents will be cleared. Default: 15m0s
  • listen - The address to listen on. Default: :8080

Example 1 - ACME DNS-01

Use temptxt for acme DNS-01 validation for test1.example.com and test2.example.com. CoreDNS is authoritative for example.com.

Configuration

  1. CoreDNS configuration

    temptxt _acme-challenge. {
        txt test1.example.com user1
        txt test2.example.com user[0-2] user4
    }
    

    Also equivalent:

    temptxt {
        txt _acme-challenge.test1.example.com user1
        txt _acme-challenge.test2.example.com user[0-2] user4
    }
    
  2. Configure the ACME client to call the temptxt API.

Outcome

  • The content of _acme-challenge.test1.example.com can be updated by user1.

  • The content of _acme-challenge.test2.example.com can be updated by user1, user2, and user4.

  • Queries for other _acme-challenge.*.example.com records will fallthrough.

  • If the content of the txt record is "", NXDOMAIN will be returned.

Example 2 - ACME DNS Alias

  • The is similar to acme-dns. It allows temptxt to be used for validation when CoreDNS is not the authoritative server for a given zone using CNAMEs.

Configuration

  1. Create NS records for acme-dns.example.com pointing to this server.

  2. Create a CNAME from _acme-challenge.www.example.com to www.acme-dns.example.com on the DNS server for example.com

  3. Configure CoreDNS

    temptxt {
        txt_alias www.acme-dns.example.com www.example.com user1
    }
    
  4. Configure the ACME client to call the temptxt API.

Results

  1. The ACME client will update the TXT record for www.acme-dns.example.com using the API.

  2. Since there is a CNAME from _acme-challenge.www.example.com the ACME server will query temptxt for the validation string.

Example certbot hooks

Update using basic auth

curl -X POST \
    -d "fqdn=www.example.com&content=$CERTBOT_TOKEN" \
    -u username:password \
    https://acme-dns.example.com/update

Clear record using certificate auth

curl -X POST \
    -d "fqdn=www.example.com&content=test" \
    --cert ./cert.crt \
    --key ./cert.key \
    https://acme-dns.example.com/update
Similar Resources

Txt-lsp - A toy project with Language Server Protocol (LSP)

txt-lsp txt-lsp is a toy project where I play around with Language Server Protoc

Jan 22, 2022

Service that calls uzma24/project1 service, takes input from .txt file and prints JSON output returned from the service.

Service that calls uzma24/project1 service, takes input from .txt file and prints JSON output returned from the service. Program can take large input files.

Feb 6, 2022

This small Docker project is the easiest way to send notifications directly via .txt files to services like: Gotify, Telegram, SMTP (Email) or Webhook.

This small Docker project is the easiest way to send notifications directly via .txt files to services like: Gotify, Telegram, SMTP (Email) or Webhook.

This small Docker project is the easiest way to send notifications directly via .txt files to services like: Gotify, Telegram, SMTP (Email) or Webhook.

Oct 5, 2022

GoLang ads.txt scraper

Collects and parses ads.txt GoLang program scrapes sites for ads.txt and stores its significant details to PostgreSQL database. Give it a file with CS

Feb 11, 2022

Collection of useful golang code snippets, mainly for learning purposes

Go-Things Collection of go code snippets, tools, etc. mainly for learning purpos

Dec 31, 2021

Generate wordlist from already collected subdomains for bruteforcing purposes.

goSubsWordlist Generate a wordlist from a list of already discovered subdomains. This list can be used for further bruteforcing for more subdomains. I

Sep 25, 2022

An event driven remote access trojan for experimental purposes.

erat An event driven remote access trojan for experimental purposes. This example is very simple and leverages ssh failed login events to trigger erat

Jan 16, 2022

DNS Ping: to check packet loss and latency issues with DNS servers

DNSping DNS Ping checks packet loss and latency issues with DNS servers Installation If you have golang, easiest install is go get -u fortio.org/dnspi

Nov 18, 2022

Verify IP addresses of respectful crawlers like Googlebot by reverse dns and forward dns lookups

Verify IP addresses of respectful crawlers like Googlebot by reverse dns and forward dns lookups

goodbots - trust but verify goodbots verifies the IP addresses of respectful crawlers like Googlebot by performing reverse dns and forward dns lookups

Aug 16, 2022
Related tags
gproxy is a tiny service/library for creating lets-encrypt/acme secured gRPC and http reverse proxies
gproxy is a tiny service/library for creating lets-encrypt/acme secured gRPC and http reverse proxies

gproxy is a reverse proxy service AND library for creating flexible, expression-based, lets-encrypt/acme secured gRPC/http reverse proxies GProxy as a

Sep 11, 2022
Hetzner-dns-updater - A simple tool to update a DNS record via Hetzner DNS API. Used for simple HA together with Nomad

hetzner-dns-updater A small utility tool to update a single record via Hetzner D

Feb 12, 2022
Coredns plugin for relaying .local domains

CoreDNS Local_Query This is a plugin for coredns that was developed to allow for the use of naked hosts in place of .local domains i.e example.local b

Nov 4, 2021
dynflare is a tool to automatically update dns records at Cloudflare, when the ip changes.

dynflare dynflare is a tool to automatically update dns records at Cloudflare, when the ip changes. How it works The current ips are determined by ask

Dec 7, 2021
Automatically register a list of domain names, add them to Cloudflare and set DNS records.

NameCannon Automatically register a list of domain names, add them as zones on Cloudflare, then add DNS records. Usage $ ./NameCannon --namesiloSecret

Jan 26, 2022
Updating DNS records for dynamically changing IPs via the Cloudflare API

Cloudflare Dynamic IP Server About The Project About The Project Updating DNS re

Dec 24, 2021
Hostkeydns - Library for verifying remote ssh keys using DNS and SSHFP resource records

hostkeydns import "suah.dev/hostkeydns" Package hostkeydns facilitates verifying

Feb 11, 2022
Ipctl - Listen to IP change and change your DNS' records dynamically

ipctl Listen to IP change and change your DNS' records dynamically Table of cont

Feb 17, 2022
Check DNS and optionally Consul and serve the status from a Web page

dns-checker Table of contents Preamble Compiling the program Keepalived and LVS Available options Setting up systemd Preamble This application checks

Nov 7, 2021
grobotstxt is a native Go port of Google's robots.txt parser and matcher library.

grobotstxt grobotstxt is a native Go port of Google's robots.txt parser and matcher C++ library. Direct function-for-function conversion/port Preserve

Dec 27, 2022