Skip to content

Commit

Permalink
Remove ufw from new and existing installs
Browse files Browse the repository at this point in the history
We don't use ufw and in noble, it conflicts with iptables-persistent,
which we do want to use.

Remove it during provisioning and install a systemd timer to remove it.
(We can't do it during a postinst because we're already in an apt
session at that time.)

Fixes #7313.
  • Loading branch information
legoktm committed Oct 31, 2024
1 parent eb39e65 commit c13410f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
custom kernel that is not signed. Please disable SecureBoot on the
target servers and try again.
- name: Remove cloud-init
- name: Remove cloud-init and ufw
apt:
name: cloud-init
name:
- cloud-init
- ufw
state: absent
purge: yes
tags:
Expand Down
1 change: 1 addition & 0 deletions molecule/testinfra/common/test_system_hardening.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def test_iptables_packages(host):
firewall config across reboots.
"""
assert host.package("iptables-persistent").is_installed
assert not host.package("ufw").is_installed


def test_snapd_absent(host):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Remove ufw if installed
ConditionPathExists=/usr/sbin/ufw

[Service]
Type=oneshot
Environment="DEBIAN_FRONTEND=noninteractive"
ExecStart=/usr/bin/apt-get purge --yes ufw
User=root
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Remove ufw if installed

[Timer]
OnCalendar=daily
Persistent=true
RandomizedDelaySec=5m

[Install]
WantedBy=timers.target
2 changes: 2 additions & 0 deletions securedrop/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ override_dh_systemd_enable:
dh_systemd_enable --no-enable securedrop-submissions-today.service
dh_systemd_enable --no-enable securedrop-clean-tmp.service
dh_systemd_enable --no-enable securedrop-remove-pending-sources.service
dh_systemd_enable --no-enable securedrop-remove-ufw.service
dh_systemd_enable

# This is basically the same as the enable stanza above, just whether the
Expand All @@ -86,4 +87,5 @@ override_dh_systemd_start:
dh_systemd_start --no-start securedrop-submissions-today.service
dh_systemd_start --no-start securedrop-clean-tmp.service
dh_systemd_start --no-start securedrop-remove-pending-sources.service
dh_systemd_start --no-start securedrop-remove-ufw.service
dh_systemd_start
1 change: 1 addition & 0 deletions securedrop/debian/securedrop-config.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
debian/config/etc /
debian/config/lib /
debian/config/opt /

0 comments on commit c13410f

Please sign in to comment.