Repository navigation
feat(tsig): Plesk — key in common-allow-transfer, restored after every rewrite - #100
Conversation
…y rewrite
On Plesk every zone has allow-transfer { common-allow-transfer; }, BIND
runs chrooted and Plesk rewrites named.conf from its own settings. The
key file goes into the chroot, the include into the custom directives
block Plesk keeps, and the key into the ACL. enable drops our IPs from
the ACL only after every zone has the key and installs a systemd path
unit on named.conf plus a 5-minute timer that run restore: after a
rewrite it puts the key back and our IPs out again. disable stops them
first. BIND and Plesk now share one list editor (Target).
|
CHANGES REQUESTED at 03e5424, two points. Verified: the Plesk target edits
|
…rs in the rewrite window named-checkconf ran outside the chroot, where the include (/etc/seconddns-tsig.key, the path named sees) does not exist, so enable would roll back on every real Plesk. It now runs with -t <chroot> and the config path inside it. The real-named test now sends signed AXFR, as SecondDNS does: after an ACL-only rewrite it still passes (the include survives); after a rewrite that also drops the include it is refused until restore. README says the same.
|
APPROVED at f34f7bc. Both points are closed, and the first one corrects my claim: after an ACL-only rewrite the key stays known through the include in the custom block and our IP is back in the ACL, so the signed request passes. The refusal only happens when the include goes too. Rows 2 and 3 of
Not verified on a live Plesk host, as recorded in the PR. Ready for the owner's merge. |
#96 for Plesk. It builds on #98 (TSIG for BIND panels) and #99 (Plesk transfer ACL).
What is different on Plesk. Seen read-only on a live Plesk 18.0.81, AlmaLinux 9:
allow-transfer { common-allow-transfer; }, so the list to edit is that ACL, notoptions;-t /var/named/chroot);named.conffrom its own settings and keeps only the "custom directives" block;server_dnshas no command to take an IP out of the Transfer Restrictions Template.How it works:
Targetinseconddns-tsig:bind(as before) orplesk. Plesk is detected by thepleskCLI plus/usr/local/psa, or forced withSECONDDNS_TSIG_FLAVORin tests./var/named/chroot/etc/seconddns-tsig.key, included as/etc/seconddns-tsig.keyright below "PLEASE ADD YOUR CUSTOM DIRECTIVES BELOW THIS LINE";key "…"inacl common-allow-transfer;enablekeeps the BIND order: key next to our IPs →[tsig]+ worker restart → zones get the key → our IPs leave the ACL (removed_entriesrecorded). On Plesk it then installsseconddns-tsig-restore.path(PathChangedon the realnamed.conf),.service(seconddns-tsig restore) and.timer(every 5 min).restore: when the key file, include or ACL key are missing, or a recorded IP came back, it adds the key and drops those IPs again. Otherwise it is silent and writes nothing, so the path unit firing on our own write ends there.restore. SecondDNS signs every request for a keyed zone. After an ACL-only rewrite those signed requests still pass: named keeps knowing the key through the include in the custom block, and our IP is back in the ACL. If Plesk ever drops the include as well, named no longer knows the key, so signed requests are refused (BADKEY) untilrestoreruns, and the secondary retries on its schedule. Both cases are rows in the real-named test.disablestops the units first (they would re-add the key midway), then mirrors enable and removes the unit files. The uninstaller already runsdisable --zonesfirst (feat(tsig): BIND panels — enable, disable, restore and the installer choice #98)._edit_listserves bothedit_allow_transferand the newedit_acl.test_tsig_bind.shpasses unchanged (56/56).Existing code touched:
plesk/install.sh:--tsig=*, one help line, and theseconddns-tsig setupcall before the initial sync (same as cPanel/DirectAdmin in feat(tsig): BIND panels — enable, disable, restore and the installer choice #98).seconddns_bind.py: the body ofedit_allow_transfermoved into_edit_list.seconddns-tsig: the BIND helpers now take aTarget.Tests:
test_tsig_plesk.sh(28, stand-ins for API, checkconf, reload and systemctl, fixture with the live server's structure):named-checkconfcalled as-t <chroot> /etc/named.conf, key in the chroot, include under the custom line with the chroot path, our IP out of the ACL, customer's entry kept, zones untouched, units written and enabled;test_tsig_plesk_named.sh(11, real named with a Plesk-stylenamed.conf, signed AXFR as SecondDNS sends it):Ubuntu 24.04, BIND 9.18, non-root:
test_tsig_plesk_named8/8,test_tsig_plesk27/27,test_tsig_bind_named9/9,test_tsig_bind56/56,test_plesk_acl_named4/4. Locally alsotest_tsig35,test_queue104,test_named_conf_edit26,test_plesk_acl13.test_tsig_plesk_chroot.sh(5, root, run with sudo in CI): the realnamed-checkconf -tagainst a chroot built from the fixture. enable passes and keeps its edit; outside the chroot the include does not resolve, so-tis what makes the check pass. Before this fix, enable rolled back on every real Plesk.Not verified on a live Plesk (owner decision, no test panel): the chroot path on other Plesk/OS combinations, and whether Plesk ever rewrites the custom directives block.