Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rule set_ip6tables_default_rule #12659

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions controls/cis_ubuntu2404.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1491,10 +1491,9 @@ controls:
levels:
- l1_server
- l1_workstation
related_rules:
rules:
- set_ip6tables_default_rule
status: planned
notes: TODO. Partial/incorrect implementation exists.See related rules. Analogous to ubuntu2204/3.5.3.3.1.
status: automated

- id: 4.4.3.2
title: Ensure ip6tables loopback traffic is configured (Automated)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# platform = multi_platform_all
{{% if 'ubuntu' in product %}}
{{{ bash_package_install("iptables-persistent") }}}
sed -i 's/^:INPUT ACCEPT.*/:INPUT DROP [0:0]/g' /etc/iptables/rules.v6
{{% else %}}
sed -i 's/^:INPUT ACCEPT.*/:INPUT DROP [0:0]/g' /etc/sysconfig/ip6tables
{{% endif %}}

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ description: |-
To set the default policy to DROP (instead of ACCEPT) for
the built-in INPUT chain which processes incoming packets,
add or correct the following line in
{{% if 'ubuntu' in product %}}
<tt>/etc/iptables/rules.v6</tt>:
{{% else %}}
<tt>/etc/sysconfig/ip6tables</tt>:
{{% endif %}}
<pre>:INPUT DROP [0:0]</pre>
If changes were required, reload the ip6tables rules:
<pre>$ sudo service ip6tables reload</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ -z "${output}" ]; then
fi

while read -r line; do
chain=$(echo "$line" | awk '{print $1, $2}')
policy=$(echo "$line" | awk '{print $4}' | tr -d ")")
chain=$(echo "$line" | cut -f1-2 -d' ')
policy=$(echo "$line" | cut -f4 -d' ' | tr -d ')')
if [ "$chain" = "Chain INPUT" ] || [ "$chain" = "Chain FORWARD" ] ||
[ "$chain" = "Chain OUTPUT" ]; then
if [ "$policy" != "DROP" ] && [ "$policy" != "REJECT" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# platform = multi_platform_ubuntu
# packages = iptables,iptables-persistent

apt purge -y nftables ufw

ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT DROP
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# platform = multi_platform_ubuntu
# packages = iptables,iptables-persistent

apt purge -y nftables ufw

ip6tables -P INPUT ACCEPT
sysctl net.ipv6.conf.all.disable_ipv6=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# platform = multi_platform_ubuntu
# remediation = none
# packages = iptables,iptables-persistent

apt purge -y nftables ufw

ip6tables -P INPUT ACCEPT
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT DROP
Loading