NicTool is an open-source DNS management system. This package provides the server — a Node.js process that ties the NicTool DNS system together. It wears several hats:
- Starts a web server that serves the setup UI
- On first run it presents a config form to set the data store and API.
- Discovers an existing cert or uses openssl to generate a cert.
- Picks a listen port: prefers 443 → 8443 → random free port.
- CLI entry (nictool-server -c ), reads nictool.toml. When api.mode =
- local: hosts the @nictool/api server in-process
- remote: it proxies /api/* and /doc to the remote API
- Handles SIGINT/SIGTERM to cleanly stop nameservers.
- Reads nameserver configs from data store, starts/stops each DNS engine
- Supports a native in-memory authoritative server plus export engines (bind, knot, nsd, powerdns, tinydns, maradns), wiring up the right Source (mysql / toml-directory), Publisher (memory / rfc1035 / tinydns-cdb / powerdns-db), Transport (noop / rsync / axfr / db-replication), and DNSSEC Signer per engine.
- Standalone nt-powerdns binary implementing the PowerDNS pipe/co-process v1 protocol over stdin/stdout.
- Queries the NicTool MySQL schema directly to answer Q / SOA / NS / ANY / AXFR, with a TTL cache and reconnect-on-drop.
- Everything is driven by nictool.toml ([store], [api], [[nameserver]]). Store can be MySQL or a file directory (see data/zone.toml, data/zone_record.toml).
- Depends on the sibling workspace packages via file:../ links: @nictool/api, dns-nameserver, dns-zone, dns-resource-record.
- Node.js 20 or later
opensslin$PATH(to auto-generate self-signed TLS certs)- MySQL 8+ or a writable directory (for the file-based stores)
npm install -g @nictool/servermkdir -p /var/lib/nictoolnpm run serverOn first run the server will:
- Generate a self-signed TLS certificate for your hostname and save it to
/var/lib/nictool/etc/tls/. - Open the web configurator at
https://<hostname>(falls back to port8443if 443 is unavailable).
Open the URL printed to the console, fill in the configuration form, and click Save. The configurator writes /var/lib/nictool/etc/nictool.toml and starts the API automatically.
TLS warning – The auto-generated certificate is self-signed. Accept the browser security warning for the initial setup, then replace it with a trusted certificate (see TLS below).
All settings live in <config-dir>/etc/nictool.toml. The file is created by the web configurator but can also be edited by hand. The server reads it on every start.
store.type |
Description |
|---|---|
mysql |
Production-ready; requires MySQL 8+ |
directory |
File-based TOML store; good for development |
[store]
type = "mysql"
host = "127.0.0.1"
port = 3306
user = "nictool"
password = "secret"
database = "nictool"[store]
type = "directory"
path = "/var/lib/nictool/zones"The API can run in-process (default) or as a remote service:
[api]
mode = "local" # "local" | "remote"
port = 3000 # only used for remote mode
host = "" # only used for remote modeOn startup the server looks for certificates in <config-dir>/etc/tls/ in this order:
<hostname>.pem— combined PEM (private key + certificate chain)localhost.pem— combined PEM, bound aslocalhostcert.pem+key.pem— legacy split files
If none are found, a self-signed certificate is generated via openssl and saved as <hostname>.pem.
To use your own certificate, place a combined PEM file at:
<config-dir>/etc/tls/<hostname>.pem
NicTool can serve DNS via a built-in native nameserver or by acting as a
co-process backend for PowerDNS. Both are configured in nictool.toml under
[[nameserver]] blocks.
The native engine is a pure-Node.js authoritative DNS server built on dns2.
It loads zone data into memory from the NicTool store at startup and keeps it
current through event-driven re-publishing (with a configurable cooldown).
Supports A, AAAA, CNAME, MX, NS, TXT, PTR, SRV, CAA, SOA over UDP and TCP.
[[nameserver]]
name = "ns1.example.com."
engine = "native"
# Bind UDP and TCP on all interfaces, port 53.
[[nameserver.listen]]
address = "0.0.0.0"
port = 53
proto = "udp"
[[nameserver.listen]]
address = "0.0.0.0"
port = 53
proto = "tcp"
[nameserver.source]
type = "inherit" # use the top-level [store]; or override with {type, host, ...}
[nameserver.publisher]
type = "memory" # required for the native engine
[nameserver.transport]
type = "noop"
interval = 0 # 0 = event-driven (publish on zone change); >0 = poll interval in seconds
cooldown = 5 # minimum seconds between consecutive publishes (burst protection)Multiple native nameservers can run side-by-side by adding more [[nameserver]]
blocks — each gets its own UDP/TCP listener set.
Attach an optional signing stage between the publisher and transport:
[nameserver.dnssec]
enabled = false # set true once MemorySigner is implemented
algorithm = "ECDSAP256SHA256"
keyset = "/var/lib/nictool/dnssec/ns1"
nsec3 = truent-powerdns (bin/nt_powerdns.js) implements the
PowerDNS pipe/co-process backend
protocol (v1). PowerDNS forks the script and communicates with it over
stdin/stdout; the script queries the NicTool MySQL database directly.
launch=pipe
pipe-command=/usr/bin/nt-powerdns
pipe-timeout=2000
# If you need more than one backend process:
# pipe-command=/usr/bin/nt-powerdns --workers 4Or, with the path from a local install:
launch=pipe
pipe-command=node /var/lib/nictool/bin/nt_powerdns.js
pipe-timeout=2000export NT_PDNS_DB_HOST=127.0.0.1
export NT_PDNS_DB_PORT=3306
export NT_PDNS_DB_USER=nictool
export NT_PDNS_DB_PASS=secret # required
export NT_PDNS_DB_NAME=nictool
export NT_PDNS_NS_ID=1 # nt_nameserver.nt_nameserver_id to serve
export NT_PDNS_CACHE_TTL=20 # seconds to cache query results
export NT_PDNS_LOG=0 # set to 1 for verbose stderr loggingSet these in /etc/default/pdns (Debian/Ubuntu) so PowerDNS picks them up when it forks the co-process.
printf 'HELO\t1\nQ\texample.com\tIN\tSOA\t-1\t127.0.0.1\n' \
| NT_PDNS_DB_PASS=secret node bin/nt_powerdns.jsExpected output:
OK NicTool PowerDNS backend ready
DATA example.com IN SOA 3600 1 ns1.example.com hostmaster.example.com 2026010101 86400 7200 1209600 3600
END
| Type | Source |
|---|---|
| A, AAAA, CNAME, MX, PTR, TXT, SRV | nt_zone_record |
| NS | nt_nameserver via nt_zone_nameserver |
| SOA | nt_zone (serial, refresh, retry, expire, ttl) |
| ANY | union of records + NS rows |
| AXFR | all records for the requested zone id |
nictool-server -c <config-dir>
Options:
-c, --config <dir> Path to the NicTool data root (required).
# Install dependencies
npm install
# Run tests
npm test
# Run tests in watch mode
npm run watch
# Check formatting and linting
npm run format:check
# Auto-fix formatting and linting
npm run formatBSD-3-Clause © Matt Simerson