Skip to content

Install iptables-persistent Package

An XCCDF Rule

Description

The iptables-persistent package can be installed with the following command:
$ apt-get install iptables-persistent

Rationale

A method of configuring and maintaining firewall rules is necessary to configure a Host Based Firewall.

ID
xccdf_org.ssgproject.content_rule_package_iptables-persistent_installed
Severity
Medium
References
Updated

Remediation Templates

A Puppet Snippet

include install_iptables-persistent
class install_iptables-persistent {
  package { 'iptables-persistent':
    ensure => 'installed',
  }
}

An Ansible Snippet

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

OS Build Blueprint

[[packages]]
name = "iptables-persistent"
version = "*"

A Shell Script

# Remediation is applicable only in certain platforms
if dpkg-query --show --showformat='${db:Status-Status}\n' 'iptables' 2>/dev/null | grep -q installed; then
DEBIAN_FRONTEND=noninteractive apt-get install -y "iptables-persistent"

else
    >&2 echo 'Remediation is not applicable, nothing was done'
fi