Skip to content

Implement automation and checks for configured_firewalld_default_deny - #14995

Open
pradeepkch6-ai wants to merge 4 commits into
ComplianceAsCode:masterfrom
pradeepkch6-ai:feature/firewalld-default-deny-implementation
Open

Implement automation and checks for configured_firewalld_default_deny#14995
pradeepkch6-ai wants to merge 4 commits into
ComplianceAsCode:masterfrom
pradeepkch6-ai:feature/firewalld-default-deny-implementation

Conversation

@pradeepkch6-ai

Copy link
Copy Markdown

Summary
This PR implements the missing automation (OVAL, Bash, Ansible, and test scenarios) for the configured_firewalld_default_deny rule.

Motivation
The configured_firewalld_default_deny rule maps to critical DISA STIG and NIST compliance requirements (e.g. SRG-OS-000297-GPOS-00115, AC-17) regarding the enforcement of a default-deny, allow-by-exception firewall policy. The rule was previously missing all remediation scripts and automated validation mechanisms.

Technical Implementation

  • OVAL: Extracts the configured DefaultZone dynamically from /etc/firewalld/firewalld.conf using textfilecontent54_object, concatenates it into the corresponding zone XML filename, and ensures the active default zone contains <zone target="DROP"> in either /etc/firewalld/zones/ or /usr/lib/firewalld/zones/.
  • Bash / Ansible: Enforces DefaultZone=drop inside firewalld.conf.
  • Tests: Adds pass and fail test scenarios to simulate compliant and non-compliant base firewalld configurations.

Limitations
The OVAL check successfully validates that the DefaultZone enforces a DROP target, mitigating globally unset interfaces. It does not actively loop through arbitrary custom zones that interfaces may be mapped to if they override the default zone logic. Validating the default zone's XML target represents the most robust OVAL-compatible check.

This adds the missing OVAL, Bash, Ansible, and testing scenarios for the
configured_firewalld_default_deny rule to ensure the DefaultZone is
configured to a deny-all policy (drop) per STIG requirements.
@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown

Hi @pradeepkch6-ai. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Used by openshift-ci bot. label Aug 13, 2026

@Mab879 Mab879 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look the CI failures, they seem valid.

@@ -0,0 +1,44 @@
<def-group>
<definition class="compliance" id="configured_firewalld_default_deny" version="1">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<definition class="compliance" id="configured_firewalld_default_deny" version="1">
<definition class="compliance" id="{{{ rule_id }}" version="1">

@pradeepkch6-ai

Copy link
Copy Markdown
Author

@Mab879 Thank you for catching that! I've just updated the id in the OVAL definition to use the {{{ rule_id }}} macro instead of the hardcoded string so it passes the sanity checks. Let me know if there's anything else!

@Mab879 Mab879 self-assigned this Aug 13, 2026
</local_variable>

<ind:xmlfilecontent_test id="test_firewalld_default_zone_target_drop" version="1" check="all" check_existence="at_least_one_exists" comment="Ensure default zone has target DROP">
<ind:object object_ref="object_firewalld_default_zone_target_drop_etc" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is invalid OVAL. You need split this into test two tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Used by openshift-ci bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants