-
Notifications
You must be signed in to change notification settings - Fork 671
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
Ubuntu: Add missing nftables variables and improve remediation and checks #11134
Conversation
as bash special characters
This datastream diff is auto generated by the check Click here to see the full diffbash remediation for rule 'xccdf_org.ssgproject.content_rule_set_nftables_loopback_traffic' differs.
--- xccdf_org.ssgproject.content_rule_set_nftables_loopback_traffic
+++ xccdf_org.ssgproject.content_rule_set_nftables_loopback_traffic
@@ -1,13 +1,15 @@
# Remediation is applicable only in certain platforms
if ( rpm --quiet -q nftables ); then
+
+grubfile="/boot/grub2/grub.cfg"
# Implement the loopback rules:
nft add rule inet filter input iif lo accept
nft insert rule inet filter input ip saddr 127.0.0.0/8 counter drop
# Check IPv6 is disabled, if false implement IPv6 loopback rules
-[ -n "$passing" ] && passing=""
-[ -z "$(grep "^\s*linux" /boot/grub2/grub.cfg | grep -v ipv6.disabled=1)" ] && passing="true"
+disabled="false"
+[ -f "$grubfile" ] && ! grep "^\s*linux" "$grubfile" | grep -vq "ipv6.disable=1" && disabled="true"
grep -Eq "^\s*net\.ipv6\.conf\.all\.disable_ipv6\s*=\s*1\b(\s+#.*)?$" \
/etc/sysctl.conf /etc/sysctl.d/*.conf && \
@@ -15,10 +17,10 @@
/etc/sysctl.conf /etc/sysctl.d/*.conf && sysctl net.ipv6.conf.all.disable_ipv6 | \
grep -Eq "^\s*net\.ipv6\.conf\.all\.disable_ipv6\s*=\s*1\b(\s+#.*)?$" && \
sysctl net.ipv6.conf.default.disable_ipv6 | \
-grep -Eq "^\s*net\.ipv6\.conf\.default\.disable_ipv6\s*=\s*1\b(\s+#.*)?$" && passing="true"
+grep -Eq "^\s*net\.ipv6\.conf\.default\.disable_ipv6\s*=\s*1\b(\s+#.*)?$" && disabled="true"
# Is IPv6 Disabled? (true/false)
-if [ "$passing" = false ] ; then
+if [ "$disabled" = false ] ; then
nft add rule inet filter input ip6 saddr ::1 counter drop
fi
|
permanently on Ubuntu
Code Climate has analyzed commit bea5920 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 56.8% (0.0% change). View more on Code Climate. |
/test images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Overriding the CODEOWNERS was @dodys cannot approve his own PRs.
The Automatus failures are expected, waving. |
Description:
Rationale: