Files
EasyDNS-Web/CONFIGURATION.md
Mateusz Gruszczyński de13d851a8
Go quality gates / test (push) Waiting to run
v0.1.1
2026-11-30 14:44:28 +01:00

150 lines
10 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# EasyDNS Web configuration (0.1.1)
The panel supports two deployment styles and uses the **same settings** in both:
- **Debian `.deb`**: `/etc/easydns-ui/config.toml`, installed as a protected Debian conffile. This is the recommended Debian configuration method.
- **Docker Compose**: `.env` (copy `.env.example`) for the panel, API credentials and optional additional servers. All secrets remain in the Go process; no extra EasyDNS endpoint is needed.
The application version is **0.1.1**, independently of configuration edits or rebuilds.
## Debian: a single TOML configuration file
The Debian package creates `/etc/easydns-ui/` and installs a starter configuration:
```bash
sudoedit /etc/easydns-ui/config.toml
sudo chown root:easydns-ui /etc/easydns-ui/config.toml
sudo chmod 0640 /etc/easydns-ui/config.toml
sudo systemctl restart easydns-ui
```
Example (demonstration addresses only):
```toml
[panel]
listen = "127.0.0.1:8088"
username = "admin"
password = "choose-a-long-unique-panel-password"
# Or omit password and keep the installer-generated password:
# password_file = "/etc/easydns-ui/panel.password"
session_key_file = "/etc/easydns-ui/session.key"
cookie_secure = false
nodes_dir = "/var/lib/easydns-ui"
[api]
url = "https://dns-primary.example.net:9953"
token = "control-token-generated-on-dns-primary"
# Or use token_file = "/etc/easydns/data/control.token"
allow_insecure_http = false
[multiserver]
enabled = true
local_name = "DNS Primary"
local_role = "primary"
[[servers]]
slot = 1
name = "DNS Secondary 1"
role = "secondary"
url = "https://dns-secondary-1.example.net:9953"
token = "control-token-generated-on-secondary-1"
[[servers]]
slot = 2
name = "DNS Secondary 2"
role = "secondary"
url = "https://dns-secondary-2.example.net:9953"
token = "control-token-generated-on-secondary-2"
```
The **default installed file** is more conservative: local HTTP via loopback, the original automatically generated EasyDNS token **file**, an installer-generated admin password file, and Multi-server disabled. The example above only demonstrates explicit configuration options.
**Credential precedence:** `panel.password` overrides `panel.password_file`; `api.token` overrides `api.token_file` (unless the Unix control socket is used); each `servers[].token` is an alternative to its `token_file`, never both. When using an inline password it must be at least 16 characters. Token contents are never returned to the browser.
**TOML supported syntax:** `[panel]`, `[api]`, `[multiserver]`, and `[[servers]]` (up to 15 entries). Values may be quoted strings (including literal single-quoted strings), booleans, or integer `slot` numbers. Use one key per line; unknown or duplicate keys fail with a line number. Array literals, inline tables and multiline TOML strings are not supported by this intentionally dependency-free parser.
Debian `dpkg` protects `/etc/easydns-ui/config.toml` as a **conffile**: edits survive reinstalls and updates. The installer creates `/etc/easydns-ui/panel.password` and `/etc/easydns-ui/session.key` only if missing, and preserves them on updates. Uninstalling without purge leaves settings and tokens; purging removes package-owned state and credentials.
**Upgrading from older packages:** Older releases used `/etc/default/easydns-ui`. That legacy file is **not sourced by the new systemd unit**. If it contains custom API addresses, credentials, or listener settings, copy those values into `/etc/easydns-ui/config.toml` before restarting the upgraded service. The legacy file is not executed or interpreted as shell code.
**Upgrading from 0.1.0:** if you enabled Multi-server through Configuration but your existing TOML contains `enabled = false`, set `enabled = true` in TOML to retain fleet mode. The saved server list and private tokens are preserved; the previous UI preference no longer overrides an explicit TOML value.
## Docker Compose: `.env`
```bash
cp .env.example .env
chmod 600 .env
# Edit at least EASYDNS_UI_PASSWORD, EASYDNS_API_URL and EASYDNS_API_TOKEN.
docker compose up -d --build
docker compose logs -f panel
```
`compose.yaml` exposes only `127.0.0.1:8088` on the host by default, and uses a persistent `panel-data` volume for `session.key`, saved node metadata, user-added tokens and panel preferences. Docker build needs no installed Go toolchain on the host. The container runs as an unprivileged user with a read-only root filesystem, without extra privileges. You can change the published bind address or port in `.env`, but **use HTTPS or a VPN/SSH tunnel** for any access outside the local host.
For three servers, set:
```dotenv
EASYDNS_UI_USERNAME=admin
EASYDNS_UI_PASSWORD=replace-with-a-unique-long-password
EASYDNS_API_URL=https://dns-primary.example.net:9953
EASYDNS_API_TOKEN=token-generated-on-primary
EASYDNS_UI_MULTISERVER=true
EASYDNS_UI_LOCAL_NAME="DNS Primary"
EASYDNS_UI_LOCAL_ROLE=primary
EASYDNS_UI_SERVER_1_NAME="DNS Secondary 1"
EASYDNS_UI_SERVER_1_ROLE=secondary
EASYDNS_UI_SERVER_1_URL=https://dns-secondary-1.example.net:9953
EASYDNS_UI_SERVER_1_TOKEN=token-generated-on-secondary-1
EASYDNS_UI_SERVER_2_NAME="DNS Secondary 2"
EASYDNS_UI_SERVER_2_ROLE=secondary
EASYDNS_UI_SERVER_2_URL=https://dns-secondary-2.example.net:9953
EASYDNS_UI_SERVER_2_TOKEN=token-generated-on-secondary-2
```
Token/password variables are read from the container environment, **not stored as node token files**. Editing `.env` requires recreating the container (`docker compose up -d --force-recreate`). The generated session signing key is retained in `panel-data` and changing the panel password invalidates existing sessions. Docker operators can also use `_TOKEN_FILE` with a read-only secret mount.
**Caution:** Anyone with sufficient access to Docker Engine or `docker inspect` can inspect container environment variables; treat Docker access as privileged. Keep `.env` out of Git and backups exposed to other users. Use token-file mounts or Docker secrets where stricter secret isolation is required. HTTPS protects API bearer tokens in transit. For deliberately unencrypted traffic on a trusted private network, explicitly set `EASYDNS_UI_ALLOW_INSECURE_HTTP=true` (not recommended outside isolated networks).
## TOML / environment correspondence
| TOML setting | Environment override | Meaning |
|---|---|---|
| `panel.listen` | `EASYDNS_UI_LISTEN` | Host:port the panel listens on |
| `panel.username` | `EASYDNS_UI_USERNAME` | Browser login name |
| `panel.password` | `EASYDNS_UI_PASSWORD` | Browser login password (16+ characters) |
| `panel.password_file` | `EASYDNS_UI_PASSWORD_FILE` | Alternative password file |
| `panel.session_key_file` | `EASYDNS_UI_SESSION_KEY_FILE` | Persisted signing secret |
| `panel.session_auto` | `EASYDNS_UI_SESSION_AUTO` | Create the signing secret when absent (Docker) |
| `panel.cookie_secure` | `EASYDNS_UI_COOKIE_SECURE` | Secure cookie for HTTPS browsers |
| `panel.nodes_dir` | `EASYDNS_UI_NODES_DIR` | Writable panel state directory |
| `api.url` | `EASYDNS_API_URL` | Primary/local EasyDNS REST base URL |
| `api.socket` | `EASYDNS_API_SOCKET` | Unix control socket instead of TCP |
| `api.token` | `EASYDNS_API_TOKEN` | Primary/local EasyDNS bearer token |
| `api.token_file` | `EASYDNS_API_TOKEN_FILE` | Alternative existing generated token file |
| `api.allow_insecure_http` | `EASYDNS_UI_ALLOW_INSECURE_HTTP` | Opt into remote HTTP on trusted networks |
| `multiserver.enabled` | `EASYDNS_UI_MULTISERVER` | Enable optional multiple servers |
| `multiserver.local_name` | `EASYDNS_UI_LOCAL_NAME` | Panel-only local label |
| `multiserver.local_role` | `EASYDNS_UI_LOCAL_ROLE` | Panel-only primary/secondary/unassigned label |
| `[[servers]]` `slot`, `name`, `role`, `url`, `token`, `token_file` | `EASYDNS_UI_SERVER_N_NAME`, `_ROLE`, `_URL`, `_TOKEN`, `_TOKEN_FILE` (N=1–15) | Additional independent EasyDNS instances |
**Precedence:** built-in defaults → `/etc/easydns-ui/config.toml` (if present) → environment variables. Set `EASYDNS_UI_CONFIG_FILE=/absolute/path/to/config.toml` to require a specific configuration file; if that path does not exist, startup fails. Docker does not require a TOML file. A fully specified environment server slot overrides the TOML server with the same `slot` number; incomplete slots are rejected. An explicit `[multiserver] enabled` value in TOML is authoritative, as is an explicit `EASYDNS_UI_MULTISERVER` in the environment (which overrides TOML). The panel hides the Multi-server toggle whenever either source defines it. Previously saved UI preferences do not override these values. When neither source defines the flag, the toggle remains available in Configuration.
## Fingerprinted static resources — no query-string cache busting
CSS, JavaScript and SVG files are embedded in the Go binary. **Every build** embeds a build identifier into the SHA-256-based fingerprint, producing resource URLs like:
```text
/static/app.9e2c7db5672a1234.css
/static/charts.7b0280fef17ab999.js
```
The examples above are schematic, not literal build outputs. HTML references the generated filenames. Old unhashed addresses such as `/static/app.css` return 404. Assets are served with `Cache-Control: public, max-age=31536000, immutable`. The version remains **0.1.1**; cache invalidation works through the **filename**, not `?v=` or another query parameter. The Dockerfile and `scripts/build_deb.sh`/`scripts/build-deb.sh` supply a build ID; set `BUILD_ID`/`--build-id` when you need a specific unique deployment stamp.
## API and operational limits
No native EasyDNS endpoints were added. Each configured server uses its **own existing EasyDNS control token**, generated by its own installation. Multi-server management is a panel-only orchestration view: topology role labels do not configure DNS primary/secondary replication. Metrics offer Single, Split and Aggregate using live per-node samples as described in [MULTI-SERVER.md](MULTI-SERVER.md). Only additive metrics are summed; percentage and latency percentiles are not naively added.
### Configuration-managed server labels
Server names, API URLs and roles declared in `[[servers]]` or environment server slots are read-only in the web inventory. The inventory shows `LOCAL` and `REMOTE`, never a configuration-source badge. The panel displays the configured role but offers no editor or Remove action for such nodes; edit the TOML file or `.env` and restart instead. Servers added from the UI continue to support changing their topology label and removing their connection. The local role is also read-only when `multiserver.local_role` or `EASYDNS_UI_LOCAL_ROLE` explicitly defines it.