A stupid simple Dynamic DNS server using NSD (a Authoritative Only DNS Server) and NodeJs.
This script reads config.json
from the CWD. All paths are relative to the CWD.
The following keys are supported (at time of writing):
Config Var | Description | Default |
---|---|---|
api_anonymous_allowed |
Is basic auth required | false (required) |
api_username |
Username for basic auth | ddns |
api_password |
Password for basic auth | password |
open_registration |
If false, admin password is required to register a new domain | true |
admin_password |
Allows updating or deleting domains without their domain-specific password | null |
max_age |
Domains older than this will be omitted from the zone file | null |
port |
Port to listen on | 8080 |
zone_output_path |
Path to your zone file (in NSD) | /etc/nsd/example.com.zone |
zone_template_path |
Input path of zone template | example.com.zonetemplate |
database_path |
Path JSON record database | dnsDB.json |
dns_pid_file |
Path to PID file for your DNS server | /run/nsd/nsd.pid |
param_blacklist |
These GET parameters will be ignored | ["type","ip"] |
domain_blacklist |
Hostnames that may not be registered | (see server.js) |
allow_subdomains |
If set, hostnames can contain dots | false |
The template file is just a Bind-style zone file with two magic strings:
__DYNAMIC_DNS_RECORDS__
: Insert this where you want the generated zone records to go. Typically at the end of the file.__SERIAL_NUMBER__
: This is where ddns will update your serial number. It will be set to the current time in milliseconds.
ddns writes its temporary state as JSON to database_path
. This is used to
regenerate the zone file whenever anything changes.
To install on Ubuntu using the setup script
sudo bash ./setup.sh
Start node sudo -u nsd node server.js
. You should probably run under supervisor. See conf/ddns.supervisor.conf
for an example config.
GET /
to see the online help:
This is a ddns provider. To add a subdomain, append URL parameters.
Example: /?domain=www2&ttl=600
Available parameters (some may have been disabled by the administrator):
domain: the subdomain to add a record for
ip: the ip address to add (uses your current IP if missing)
password: lock the subdomain with a password, which will be required to
change the entries in the future
ttl: ttl of the record in seconds
type: record type, can be A, AAAA, MX, CNAME, etc
Source: https://github.com/thingless/ddns