Linux host without containers
Before you start, prepare a namespace and register an agent.
Install the agent
The agent is a single static binary for Linux (amd64 and arm64). Copy it
out of the agent image on any machine with Docker:
docker create --name valgrid-agent ghcr.io/valgrid-dns/valgrid-agent:<version>
docker cp valgrid-agent:/usr/local/bin/valgrid-agent ./valgrid-agent
docker rm valgrid-agent
Add --platform linux/arm64 to docker create for an arm64 host. Install the
binary on the DNS server host, and create an unprivileged user for it:
sudo install -m 0755 valgrid-agent /usr/local/bin/valgrid-agent
sudo useradd --system --no-create-home --shell /usr/sbin/nologin valgrid-agent
Store the agent credential where only root can read it; systemd hands it to
the service:
sudo install -d -m 0700 /etc/valgrid
sudo install -m 0600 agent-token /etc/valgrid/agent-token
Run the agent as a service
Save this unit as /etc/systemd/system/valgrid-agent.service, and set
VALGRID_ZONE_DIR and the profile settings for your DNS server as shown in
CoreDNS or BIND:
[Unit]
Description=Valgrid DNS agent
Wants=network-online.target
After=network-online.target
[Service]
User=valgrid-agent
Environment=VALGRID_API_URL=https://api.valgrid.io
Environment=VALGRID_NAMESPACE_ID=<namespace_id>
Environment=VALGRID_ZONE_DIR=/var/lib/valgrid
LoadCredential=agent-token:/etc/valgrid/agent-token
Environment=VALGRID_AGENT_TOKEN_FILE=%d/agent-token
ExecStart=/usr/local/bin/valgrid-agent
Restart=on-failure
RestartSec=5s
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ReadWritePaths=/var/lib/valgrid
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now valgrid-agent
journalctl -u valgrid-agent -f
CoreDNS
Create the zone directory, owned by the agent and readable by CoreDNS:
sudo install -d -o valgrid-agent -g valgrid-agent -m 0755 /var/lib/valgrid
Add Environment=VALGRID_SERVER=coredns to the unit so the agent writes the
starter Corefile into the zone directory,
then start CoreDNS with it:
coredns -conf /var/lib/valgrid/Corefile
Or add the auto block from the starter Corefile to your own Corefile.
BIND
On Debian and Ubuntu, BIND runs as the bind user and, on Ubuntu, AppArmor
lets it read only a few directories, including /var/lib/bind. Put the zone
directory there, readable by the bind group:
sudo install -d -o valgrid-agent -g bind -m 0750 /var/lib/bind/valgrid
sudo usermod -aG bind valgrid-agent
Change the unit to use that directory, and the BIND profile with the host's own rndc key and control channel:
Environment=VALGRID_ZONE_DIR=/var/lib/bind/valgrid
Environment=VALGRID_SERVER=bind
Environment=VALGRID_RNDC_KEY_FILE=/etc/bind/rndc.key
Environment=VALGRID_RNDC_ADDRESS=127.0.0.1:953
ReadWritePaths=/var/lib/bind/valgrid
Remove the ReadWritePaths=/var/lib/valgrid line. Then include the zone list
in /etc/bind/named.conf.local:
include "/var/lib/bind/valgrid/named.zones.conf";
The agent also writes a starter named.conf and rndc.key into the zone
directory. This setup does not use them, so you can ignore them. Start the
agent first, so that the zone list exists, then reload BIND with
sudo rndc reconfig. After that the agent reloads BIND by itself. See
BIND for more.
Next steps
Verify the DNS server, then point clients at it.