Files
Kamino/changelogs/fragments/ufw-mask-nftables.yml
T
Defame1297 c617bee02a
Build / build (pull_request) Successful in 33s
Molecule / select (pull_request) Successful in 2s
Lint / lint (pull_request) Successful in 4m5s
Molecule / scenarios (pull_request) Successful in 12m51s
Molecule / Result (pull_request) Successful in 0s
fix(ufw): mask nftables.service so an upgrade cannot flush the rules
When nftables.service is enabled, the nftables package's postinst
restarts it on upgrade. The stock /etc/nftables.conf begins with
`flush ruleset` and the unit's ExecStop flushes too, so every rule ufw
and Docker loaded was deleted until they reloaded.

The role now masks the unit without stopping it, gated on ufw_enabled
and the new opt-out input ufw_mask_nftables. systemd refuses every job
but a stop on a masked unit, so the postinst's try-restart fails
before anything runs (the postinst ignores the failure) and the unit
does not start at boot. Masking works when the unit is absent too.

Assisted-by: Claude Code:claude-opus-5-5
2026-12-05 22:33:26 +00:00

11 lines
789 B
YAML

---
bugfixes:
- >-
ufw - An upgrade of the ``nftables`` package no longer deletes the firewall rules on hosts where
``nftables.service`` is enabled. The package's postinst restarts that unit, whose stock ``/etc/nftables.conf``
begins with ``flush ruleset``, so the rules ufw and Docker loaded were gone until they reloaded. The role now
masks ``nftables.service`` without stopping it whenever ``ufw_enabled`` is true, also when the unit or the
package is absent, so the first run reports ``changed`` once. A host that loads its own ruleset through
``nftables.service`` (NAT tables or sets, for example) would lose it at the next reboot without a warning, because
a masked unit does not start: set ``ufw_mask_nftables: false`` on such a host before upgrading.