Repository navigation
feat(tsig): key lookup, root-only secret and tsigKeyId in the queue - #97
Conversation
seconddns-tsig finds the account's TSIG key through the API (default or by label), checks a secret against the key's algorithm, writes a [tsig] section to seconddns.conf and the secret to /etc/seconddns/tsig.secret (0600) so the key can be put back if the panel rewrites its DNS config. With a [tsig] section, seconddns-queued creates zones with tsigKeyId; without one the request is unchanged. Installers fetch the tool, the uninstallers remove it and the secret file.
|
CHANGES REQUESTED at 57579e0, one point. Verified:
PR 2 approach: agreed. In BIND |
…tly, status No default-key fallback: the key is named by its label or full name, so the server later shows which key it uses. The pair follows dig -y; an algorithm prefix must match the key. seconddns-tsig status reports the key and whether the account still has it under the same id.
|
APPROVED at c69ef42. The previous point is closed by construction: the key and its secret now arrive as one Taking the label or name instead of the id was the right call; the id is not visible in the dashboard. |
Step 1 of 3 for #96 (TSIG-signed transfers from hosting panels). Owner decisions:
--tsig=[ALGORITHM:]KEY:SECRET(dig -yform); KEY is the label or full name shown in Settings › DNS; no default-key fallback, so the server always shows which key it uses;New, touches no tested path:
common/seconddns-tsig:resolve --tsig=… [--write]: finds KEY viaGET /api/user/tsig-keyswith the panel's API key. An unknown key fails and lists the account's keys. An algorithm prefix must match the key. The secret is checked against the key's algorithm (base64, 32/64 bytes).--writeit stores[tsig] key_id/key_name/algorithm/secret_fileinseconddns.conf, and the secret in/etc/seconddns/tsig.secret(0600). The config stays 0644 because hooks read it as non-root. The secret is kept so a later step can put the key back when a panel rewrites its DNS config.status: the key in use, whether the secret is stored, and whether the account still has the key under the same id.check-secret,secret,clear.seconddns_common.py:resolve_tsig_key,parse_tsig_pair,check_tsig_secret(appended).Existing code, every touched line:
seconddns-queued:load_configreads[tsig] key_id.send_opcreate addstsigKeyIdonly when it is set, and logs a 422 with the key id. Without[tsig]the request body is byte-identical (asserted).*/install.sh: one appended line fetchingseconddns-tsig.*/uninstall.sh: two appended lines removing it and the secret file.Nothing calls
seconddns-tsigyet. Steps 2 (BIND panels) and 3 (PowerDNS panels) addinstall.sh --tsig=…,seconddns-tsig enable/disable/restoreand the DNS-server side.Tests:
test_tsig.sh(35 checks):--write: section written; secret not in the config; file 0600; rest of the config and its mode kept; one section after a rewrite;status: ok, recreated key, deleted key, off;tsigKeyIdsent, 422 explained, body unchanged without[tsig].test_queue.shstill 104/104. CI step added.