# dns-cli A Docker container that lets an AI agent (or a human) manage DNS records on a [Technitium DNS Server](https://technitium.com/dns/) instance through its REST API. A small bash CLI built on `curl` + `python3` + `dig`. ## Requirements - Docker on the host. - A Technitium DNS Server instance with the REST API enabled. - A DNS API token (Technitium → Settings → API Token). ## Configuration Credentials live in the **centralized credential store** at `~/.creds/technitium.env` (see `tooling-cli/KNELCredsManager`). It holds: ``` TECHNITIUM_URL=http://pfv-netinfra-01:5380 TECHNITIUM_DNS_TOKEN=your-api-token TECHNITIUM_DNS_ZONE=knel.net ``` Use `.env.example` in this directory as a template if you need to create one. Permissions: directory `700`, the env file `600` (owner read/write only). ## Build ```bash docker build -t git.knownelement.com/reachableceo/dns-cli:latest . ``` The image is also available in the Gitea registry: ``` git.knownelement.com/reachableceo/dns-cli:latest ``` ## Usage Invoke the container directly with `docker run`. Pass credentials from the centralized store via `--env-file`: ```bash docker run --rm --env-file ~/.creds/technitium.env \ git.knownelement.com/reachableceo/dns-cli:latest zones docker run --rm --env-file ~/.creds/technitium.env \ git.knownelement.com/reachableceo/dns-cli:latest list docker run --rm --env-file ~/.creds/technitium.env \ git.knownelement.com/reachableceo/dns-cli:latest search ns1 docker run --rm --env-file ~/.creds/technitium.env \ git.knownelement.com/reachableceo/dns-cli:latest add myhost 192.168.1.50 docker run --rm --env-file ~/.creds/technitium.env \ git.knownelement.com/reachableceo/dns-cli:latest delete myhost 192.168.1.50 docker run --rm --env-file ~/.creds/technitium.env \ git.knownelement.com/reachableceo/dns-cli:latest flush ``` ## Commands | Command | Description | |---------|-------------| | `zones` | List all zones. | | `list [zone]` | List records in a zone (default: `TECHNITIUM_DNS_ZONE`). | | `get ` | Resolve a record via `dig` (A/AAAA). | | `add [ttl]` | Add an A record with auto-PTR (default TTL 3600). | | `delete ` | Delete an A record. | | `flush` | Flush the DNS cache. | | `search ` | Search records by name pattern (case-insensitive). | ## Environment variables | Variable | Required | Description | |----------|----------|-------------| | `TECHNITIUM_URL` | yes | Base URL of the Technitium instance. | | `TECHNITIUM_DNS_TOKEN` | yes | API token for the DNS REST API. | | `TECHNITIUM_DNS_ZONE` | yes | Default zone for add/delete/search operations. |