Skip to content

Verify ufw Enabled

An XCCDF Rule

Description

The ufw service can be enabled with the following command:
$ sudo systemctl enable ufw.service

Rationale

The ufw service must be enabled and running in order for ufw to protect the system

ID
xccdf_org.ssgproject.content_rule_service_ufw_enabled
Severity
Medium
References
Updated

Remediation Templates

A Puppet Snippet

include enable_ufw
class enable_ufw {
  service {'ufw':
    enable => true,
    ensure => 'running',
  }
}

OS Build Blueprint

[customizations.services]
enabled = ["ufw"]

A Shell Script

# Remediation is applicable only in certain platforms
if dpkg-query --show --showformat='${db:Status-Status}
' 'kernel' 2>/dev/null | grep -q installed && { ( dpkg-query --show --showformat='${db:Status-Status}\n' 'ufw' 2>/dev/null | grep -q installed && dpkg-query --show --showformat='${db:Status-Status}
' 'kernel' 2>/dev/null | grep -q installed ); }; then
SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" unmask 'ufw.service'

An Ansible Snippet

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - enable_strategy
  - low_complexity