What was wrong:set_hostname() ran postconf -e 'myhostname = <fqdn>', hostname '<name>' and the /etc/pve/nodes/<old> → <new> move with the values between single quotes of their own; a name with a single quote ended them and the rest ran as root (x';reboot;'). See NetOrk/netork#2456. /etc/hostname, /etc/hosts and /etc/mailname were already written through base64.
Fix: each value passes through shlex.quote; set_hostname keeps its length (quality baseline).
Tests:tests/test_set_hostname.py — the runtime hostname, Postfix's myhostname and the node directory paths each reach the shell as one word, and no command runs what the name holds (red before the fix). The existing rename tests pass unchanged.
The five failures of tests/test_time_sync.py in my environment fail the same way on main; they are not touched here.
**What was wrong:** `set_hostname()` ran `postconf -e 'myhostname = <fqdn>'`, `hostname '<name>'` and the `/etc/pve/nodes/<old>` → `<new>` move with the values between single quotes of their own; a name with a single quote ended them and the rest ran as root (`x';reboot;'`). See NetOrk/netork#2456. `/etc/hostname`, `/etc/hosts` and `/etc/mailname` were already written through base64.
**Fix:** each value passes through `shlex.quote`; `set_hostname` keeps its length (quality baseline).
**Tests:** `tests/test_set_hostname.py` — the runtime hostname, Postfix's `myhostname` and the node directory paths each reach the shell as one word, and no command runs what the name holds (red before the fix). The existing rename tests pass unchanged.
The five failures of `tests/test_time_sync.py` in my environment fail the same way on `main`; they are not touched here.
Closes #64
`postconf -e 'myhostname = <fqdn>'`, `hostname '<name>'` and the
/etc/pve/nodes move put the name between single quotes of their own, so
a name with a single quote ended them and the rest ran as root
(NetOrk/netork#2456). Each value is now passed through shlex.quote.
/etc/hostname, /etc/hosts and /etc/mailname were already written
through base64.
napalm-device-types 4.36.0 (released after main's last CI run) changed
PosixTimeSyncMixin: get_time_sync() reports DHCP-provided servers apart
(dhcp_ntp_servers), and configure_time_sync() no longer comments out the
DHCP client's chrony sourcedir; it gives back one that 4.35.0 took out
(NetOrk/netork#2380). CI installs the newest release, so five time-sync
tests failed on every branch.
The tests now expect that behaviour, read DHCP's servers apart, and check
that a node 4.35.0 aligned gets its DHCP sourcedir back. The floor moves
to 4.36.0, so the lowest-versions job tests the same behaviour; README,
CHANGELOG and the module docstring say what a write leaves alone.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What was wrong:
set_hostname()ranpostconf -e 'myhostname = <fqdn>',hostname '<name>'and the/etc/pve/nodes/<old>→<new>move with the values between single quotes of their own; a name with a single quote ended them and the rest ran as root (x';reboot;'). See NetOrk/netork#2456./etc/hostname,/etc/hostsand/etc/mailnamewere already written through base64.Fix: each value passes through
shlex.quote;set_hostnamekeeps its length (quality baseline).Tests:
tests/test_set_hostname.py— the runtime hostname, Postfix'smyhostnameand the node directory paths each reach the shell as one word, and no command runs what the name holds (red before the fix). The existing rename tests pass unchanged.The five failures of
tests/test_time_sync.pyin my environment fail the same way onmain; they are not touched here.Closes #64