first commit
Go quality gates / test (push) Waiting to run

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-30 11:37:40 +01:00
commit 8c4d463f1e
96 files changed
+3319

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
# Security model
## Trust boundaries
Browser → session cookie (HMAC-SHA256, HttpOnly, SameSite=Strict, optional Secure) → Go backend → EasyDNS REST using generated `control.token` or local Unix socket. The EasyDNS bearer never reaches HTML, JavaScript, CSS, logs or browser requests.
The panel is highly privileged. The login password is generated by the `.deb` postinst into `/etc/easydns-ui/panel.password` (`root:easydns-ui`, `0640`, directory `0750`). The panel session key is independently generated into `/etc/easydns-ui/session.key`. Password files have no hardcoded defaults. The Go service account is added to the `easydns` Unix group, when available, so it can read the Rust server's **existing** token (`control.token`) or access its control socket.
All state-changing browser actions are POST and require a per-session HMAC CSRF token; browser Origin (if supplied) must match the current host. No generic API endpoint proxy is exposed. ETag/If-Match on record and zone replacement prevents silent serial conflict. Error messages are server-derived; no secrets logged. Data is escaped by Go `html/template`. The default listen address is `127.0.0.1:8088` only; never publish plaintext on the internet. Serve HTTPS through a trusted reverse proxy and set `EASYDNS_UI_COOKIE_SECURE=true`.
## Operational recommendations
- Keep EasyDNS API on loopback or Unix socket, and panel on loopback behind a TLS proxy, or access over SSH tunnel.
- Restrict who can read `/etc/easydns/data/control.token`: token is admin-level access to DNS.
- Avoid copying server token into config files or front-end. The panel reads it dynamically.
- Rotate panel session key to invalidate all current sessions after an incident; restart service.
- Rotate the panel password by replacing the password file and restarting the panel.
- Secure reverse proxy with IP allowlist or VPN and an additional authentication layer as appropriate.
- Audit privileges: Go service account has no write permission to Rust EasyDNS configuration or token file.
- Logging: `journalctl -u easydns-ui`; does not log credentials or API payloads.
## Scope / known limitations
Login lockout is per remote IP and in-memory (8 failed attempts / 15 minutes); multi-instance coordination is not supported. Session credentials are stateless: once issued they expire within 12 h; logout removes the browser cookie, but does not revoke a previously stolen copy. The panel does not implement additional user/role CRUD, SSO, TOTP or token rotation because EasyDNS REST does not expose these operations. For multi-user administration, add an upstream authenticated reverse proxy rather than inventing DNS API endpoints.