Skip to content

Commit fa6d38c

Browse files
committed
Bloodhound: Add warning for 3.4.1.1 check fail in K8s
This test is expected to fail on Kubernetes variants as Kubernetes needs the iptables rule -P FORWARD ACCEPT for its operation and it is not recommended to modify this rule as it could lead to adverse effects of service operation. This rule exists in Bottlerocket because it is possible to run Bottlerocket with default deny (on ECS for instance).
1 parent 37d2cb4 commit fa6d38c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sources/bloodhound/src/output.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ impl ReportWriter for TextReportWriter {
4343
writeln!(output, "{:17}{}", "Skipped:", report.skipped)?;
4444
writeln!(output, "{:17}{}", "Total checks:", report.total)?;
4545
writeln!(output)?;
46-
writeln!(output, "Compliance check result: {}", report.status)
46+
if report.contain_known_fail_check("3.4.1.1".to_string()) {
47+
writeln!(
48+
output,
49+
"\x1b[93m Check 3.4.1.1 fails in Kubernetes Variants due to a known issue(https://github.com/bottlerocket-os/bottlerocket-core-kit/issues/540 ). Please work with your auditor to log an exception.\x1b[0m"
50+
)?;
51+
}
52+
writeln!(output, "Compliance check result: {} ", report.status)
4753
}
4854
}
4955

sources/bloodhound/src/results.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,10 @@ impl ReportResults {
180180
self.results
181181
.insert(metadata.name.clone(), IndividualResult { metadata, result });
182182
}
183+
184+
pub fn contain_known_fail_check(&self, target_id: String) -> bool {
185+
self.results.values().any(|result| {
186+
result.metadata.id == target_id && result.result.status == CheckStatus::FAIL
187+
})
188+
}
183189
}

0 commit comments

Comments
 (0)