Skip to content

Verify iptables Enabled

An XCCDF Rule

Description

The iptables service can be enabled with the following command:

$ sudo systemctl enable iptables.service

Rationale

The iptables service provides the system's host-based firewalling capability for IPv4 and ICMP.

ID
xccdf_org.ssgproject.content_rule_service_iptables_enabled
Severity
Medium
References
Updated



Remediation - OS Build Blueprint


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

Remediation - Ansible

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - NIST-800-53-AC-4
  - NIST-800-53-CA-3(5)

Remediation - Puppet

include enable_iptables

class enable_iptables {
  service {'iptables':
    enable => true,
    ensure => 'running',

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q iptables ); then

SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" unmask 'iptables.service'
"$SYSTEMCTL_EXEC" start 'iptables.service'