CMP-3916: Add runtime SSHD config checking for OpenShift#14118
CMP-3916: Add runtime SSHD config checking for OpenShift#14118yuumasato merged 7 commits intoComplianceAsCode:masterfrom
Conversation
b6e4613 to
73abb36
Compare
Add runtime SSHD config checking for OpenShift compliance operatorThe compliance operator fetches runtime SSHD config from the cluster andfeeds it to the scanner before scans. Adds `sshd_runtime_check` option(default: false, true for RHCOS4), updates OVAL macros, and sets default
73abb36 to
22e46de
Compare
Enhance the SSHD runtime configuration checking by updating the path for the compliance operator's runtime effective config file to a temp file. Modify the OVAL macros to conditionally adjust the criteria operator based on the runtime check status, ensuring accurate compliance checks.
|
I was able to get this running in a cluster using: diff --git a/shared/macros/10-oval.jinja b/shared/macros/10-oval.jinja
index da83eefd2b..6ab2b0f245 100644
--- a/shared/macros/10-oval.jinja
+++ b/shared/macros/10-oval.jinja
@@ -1036,7 +1036,7 @@ Generates the :code:`<affected>` tag for OVAL check using correct product platfo
{{%- macro sshd_oval_check(parameter, value, missing_parameter_pass, config_is_distributed, runtime_check="false", xccdf_variable="", datatype="", rule_id=None, rule_title=None) -%}}
{{%- set sshd_config_path = "/etc/ssh/sshd_config" %}}
{{%- set sshd_config_dir = "/etc/ssh/sshd_config.d" -%}}
-{{%- set sshd_runtime_path = "/tmp/runtime/sshd_effective_config" -%}}
+{{%- set sshd_runtime_path = "/runtime/sshd_config" -%}}
{{%- if xccdf_variable -%}}
{{%- set description = "Ensure '" ~ parameter ~ "' is configured with value configured in " ~ xccdf_variable ~ " variable in " ~ sshd_config_path %}}
{{%- else -%}}But - after applying the GSS api authentication remediation, the rule still fails. |
This is a new parameter, that defaults to false. Update the test data so that it's included in product stability.
edeb792 to
f3038dd
Compare
Co-authored-by: Watson Yuuma Sato <wsato@redhat.com>
…iguration check to a fixed "AND" instead of conditionally based on the runtime check status. This change simplifies the logic and ensures consistent behavior in compliance checks.
Mab879
left a comment
There was a problem hiding this comment.
Based on my testing it seems that RHEL is fine. Once other reviewer's comments are addressed I can provide my approval.
|
@Vincent056: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
| <criterion comment="runtime config matches expected value" test_ref="test_runtime_{{{ parameter }}}_{{{ rule_id }}}" /> | ||
| </criteria> | ||
| {{%- endif %}} | ||
| {{%- if runtime_check != "true" %}} |
There was a problem hiding this comment.
{{%- if runtime_check != "true" %}} looks to me as {{%- else %}}
Description:
Add runtime SSHD config checking for OpenShift compliance operator
The compliance operator fetches runtime SSHD config from the cluster and feeds it to the scanner before scans. Adds
sshd_runtime_checkoption(default: false, true for RHCOS4), updates OVAL macros, and sets defaultRationale:
Fixs CMP-3916
Review Hints: