Skip to content

Remove ufw Package

An XCCDF Rule

Description

The ufw package can be removed with the following command:

$ apt-get remove ufw

Rationale

Running iptables.persistent with ufw enabled may lead to conflict and unexpected results.

ID
xccdf_org.ssgproject.content_rule_package_ufw_removed
Severity
Medium
References
Updated



Remediation - Ansible

- name: Ensure ufw is removed
  package:
    name: ufw
    state: absent
  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
  tags:

Remediation - Puppet

include remove_ufw

class remove_ufw {
  package { 'ufw':
    ensure => 'purged',
  }

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

# CAUTION: This remediation script will remove ufw
#	   from the system, and may remove any packages
#	   that depend on ufw. Execute this