Skip to content

Release: BIND on cPanel, and an installer that no longer breaks named - #94

Merged
0kaba0 merged 3 commits into
mainfrom
develop
Sep 6, 2026
Merged

0kaba0 merged 3 commits into
mainfrom
develop

Conversation

@0kaba0

@0kaba0 0kaba0 commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Follows the previous release. Switching the cPanel box from PowerDNS to BIND — the one backend path never exercised on a live server — turned up an installer that broke DNS and reported success.

What it did

sed -i "/^[[:space:]]*};/i\\  also-notify { $SECONDARY_IP; };"

An insert before every closing brace. cPanel ships a named.conf with a logging block and three views, so the directive landed inside logging and inside a log channel:

/etc/named.conf:30: unknown option 'also-notify'
/etc/named.conf:34: unknown option 'also-notify'

named stopped answering. The installer printed [+] BIND configured and reloaded.

On a flat named.conf the same code looks right, which is why it survived three panels.

Second on the same path: cPanel's ACL is quoted, allow-transfer { "none"; };, and only an unquoted none; was stripped — leaving { IP; "none"; }.

In this release

  • the edit is bounded to the options block, in cPanel and Plesk (DirectAdmin already did this)
  • the quoted "none" is removed everywhere
  • every BIND path runs named-checkconf before reporting anything, and restores the backup from a config named cannot parse. Third time this cycle an installer claimed success over a service it had just broken — the other two were fixed in Restart PowerDNS instead of reloading it, and notice when it stays down #89
  • the edit is one function, configure_named_axfr, shared by the three installers
  • it is POSIX now: sed -i and \? are GNU-only and produced different, silently wrong output on BSD

Test

tests/test_named_conf_edit.sh applies the function to a copy of the real cPanel named.conf, kept as a fixture, and asserts one allow-transfer and one also-notify, both inside options, nothing in logging or any view, no leftover "none", balanced braces, and named-checkconf clean.

Mutation with the original unbounded sed: 13 inserts, into logging and into a view.

Verified live

The cPanel server now runs BIND with the correct allow-transfer, named-checkconf clean, and the zone answering from the secondary.

0kaba0 and others added 3 commits September 6, 2026 13:38
Switching the cPanel box to BIND and rerunning the installer broke DNS. The
insert was:

    sed -i "/^[[:space:]]*};/i\\  also-notify { IP; };"

which writes before *every* closing brace in the file. cPanel ships a
named.conf with three views and a logging block, so also-notify landed inside
logging and inside a log channel:

    /etc/named.conf:30: unknown option 'also-notify'
    /etc/named.conf:34: unknown option 'also-notify'

named stopped answering, and the installer printed "[+] BIND configured and
reloaded". On a flat named.conf with one block the same code looked correct,
which is why it survived.

Also, cPanel's ACL is quoted — `allow-transfer { "none"; };` — and the code
stripped only an unquoted `none;`, leaving `{ IP;  "none"; }`.

- the insert is bounded to the options block, as DirectAdmin already did
- the quoted "none" is removed too, in all three installers
- after editing, named-checkconf decides: a config it rejects is restored from
  the backup and reported, instead of reloading and claiming success

Verified against the real cPanel named.conf, kept as a fixture: one
also-notify in options, logging untouched, named-checkconf clean.

tests/test_named_conf_edit.sh asserts, for every installer that edits
named.conf: the insert is bounded to options, a quoted "none" is removed, the
config is verified, a broken one is reported, and the backup is restored.
Lower bound of 3 installers.
The test asserted the shape of a sed command and left the fixture unused —
checking the wording instead of the lock, and the fixture was the one thing
that reproduced the failure.

The edit is now a function, configure_named_axfr, that the test extracts from
each installer and applies to a copy of the real cPanel named.conf: exactly one
allow-transfer and one also-notify, both inside options, nothing in logging or
any view, no leftover "none", braces balanced, and named-checkconf clean where
it is available. The greps stay as cheap checks that the reload is gated.

Making it callable also made it portable: sed -i and \? are GNU-only, and on
BSD the old commands silently produced 'talso-notify' and left the quoted
"none" in place. The insert is awk now, bounded to the options block.

Mutations: the original unbounded sed writes also-notify 13 times, into
logging and into a view — 3 red; not stripping "none" — 1 red; replacing
'if named-checkconf' with 'if true' — 1 red, after the criterion was narrowed
from the word appearing anywhere to it gating the branch.
Edit only the options block of named.conf, and verify the result
@0kaba0

0kaba0 commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Release check: main has only the #92 merge commit beyond develop, so this is content-equivalent to a fast-forward (three commits: #93 and its two fixes), MERGEABLE, CI green on develop, no Co-Authored-By: Claude trailer. Ready for the owner's merge into main.

@0kaba0
0kaba0 merged commit 50a062c into main Sep 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant