When nftables.service is enabled (Ubuntu container templates enable it by default), the nftables package's postinst restarts it on upgrade. The stock /etc/nftables.conf begins with flush ruleset, so every rule ufw and Docker had loaded is deleted, and the host runs without its firewall until they reload.
The ufw role now masks the unit without stopping it, because the unit's ExecStop flushes too. The mask applies when the role enables ufw, and a new opt-out input, ufw_mask_nftables, turns it off. The fragment warns that a host loading its own ruleset through nftables.service must opt out before upgrading.
Closes nothing: there is no Kamino issue for this.
Verified
The pre-commit hooks passed on the commit.
Package scripts (noble 1.0.9 and resolute 1.1.7) and the systemd, debhelper and init-system-helpers sources were read; the commit message gives the mechanism.
By hand on real Ubuntu 24.04 hosts: after a manual systemctl mask, upgrading nftables left every ufw and Docker rule in place, and after a reboot the unit stayed inactive while ufw and Docker loaded their rules.
Molecule: the new verify play reinstalls the package with the unit masked and checks that ufw's chains survive. A control case without the mask checks that they are flushed. See this pull request's CI run.
Not verified
ufw_mask_nftables: false, and Docker's rules in molecule (the scenario has no Docker).
apt remove nftables with the unit masked. By reading the source no flush happens, but that is not tested.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code:claude-opus-5-5
## What and why
When `nftables.service` is enabled (Ubuntu container templates enable it by default), the `nftables` package's postinst restarts it on upgrade. The stock `/etc/nftables.conf` begins with `flush ruleset`, so every rule ufw and Docker had loaded is deleted, and the host runs without its firewall until they reload.
The `ufw` role now masks the unit without stopping it, because the unit's `ExecStop` flushes too. The mask applies when the role enables ufw, and a new opt-out input, `ufw_mask_nftables`, turns it off. The fragment warns that a host loading its own ruleset through `nftables.service` must opt out before upgrading.
Closes nothing: there is no Kamino issue for this.
## Verified
- The pre-commit hooks passed on the commit.
- Package scripts (noble 1.0.9 and resolute 1.1.7) and the systemd, debhelper and init-system-helpers sources were read; the commit message gives the mechanism.
- By hand on real Ubuntu 24.04 hosts: after a manual `systemctl mask`, upgrading `nftables` left every ufw and Docker rule in place, and after a reboot the unit stayed inactive while ufw and Docker loaded their rules.
- Molecule: the new verify play reinstalls the package with the unit masked and checks that ufw's chains survive. A control case without the mask checks that they are flushed. See this pull request's CI run.
## Not verified
- `ufw_mask_nftables: false`, and Docker's rules in molecule (the scenario has no Docker).
- `apt remove nftables` with the unit masked. By reading the source no flush happens, but that is not tested.
---
- [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none.
Assisted-by: Claude Code:claude-opus-5-5
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
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 and why
When
nftables.serviceis enabled (Ubuntu container templates enable it by default), thenftablespackage's postinst restarts it on upgrade. The stock/etc/nftables.confbegins withflush ruleset, so every rule ufw and Docker had loaded is deleted, and the host runs without its firewall until they reload.The
ufwrole now masks the unit without stopping it, because the unit'sExecStopflushes too. The mask applies when the role enables ufw, and a new opt-out input,ufw_mask_nftables, turns it off. The fragment warns that a host loading its own ruleset throughnftables.servicemust opt out before upgrading.Closes nothing: there is no Kamino issue for this.
Verified
systemctl mask, upgradingnftablesleft every ufw and Docker rule in place, and after a reboot the unit stayed inactive while ufw and Docker loaded their rules.Not verified
ufw_mask_nftables: false, and Docker's rules in molecule (the scenario has no Docker).apt remove nftableswith the unit masked. By reading the source no flush happens, but that is not tested.NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code:claude-opus-5-5