Skip to content

Verify Group Who Owns /etc/iptables Directory

An XCCDF Rule

Description

To properly set the group owner of /etc/iptables, run the command:
$ sudo chgrp root /etc/iptables

Rationale

The ownership of the /etc/iptables directory by the root group is important because this directory hosts iptables configuration. Protection of this file is critical for system security. Assigning the ownership to root ensures exclusive control of the iptables configuration.

ID
xccdf_org.ssgproject.content_rule_directory_groupowner_etc_iptables
Severity
Medium
References
Updated

Remediation Templates

An Ansible Snippet

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - configure_strategy
  - directory_groupowner_etc_iptables

A Shell Script

# Remediation is applicable only in certain platforms
if rpm --quiet -q iptables; then
find -H /etc/iptables/ -maxdepth 1 -type d -exec chgrp -L root {} \;

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