Skip to content

Conversation

@Vincent056
Copy link
Contributor

@Vincent056 Vincent056 commented Nov 12, 2025

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_check option(default: false, true for RHCOS4), updates OVAL macros, and sets default

Rationale:

Fixs CMP-3916

Review Hints:

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
@rhmdnd rhmdnd changed the title Add runtime SSHD config checking for OpenShift CMP-3916: Add runtime SSHD config checking for OpenShift Nov 14, 2025
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.
@rhmdnd
Copy link
Collaborator

rhmdnd commented Nov 17, 2025

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.

@Vincent056 Vincent056 requested review from a team and matusmarhefka as code owners November 18, 2025 18:45
This is a new parameter, that defaults to false. Update the test data so
that it's included in product stability.
Vincent056 and others added 2 commits November 19, 2025 08:54
Co-authored-by: Watson Yuuma Sato <[email protected]>
…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.
Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Based on my testing it seems that RHEL is fine. Once other reviewer's comments are addressed I can provide my approval.

@jan-cerny jan-cerny removed this from the 0.1.79 milestone Nov 20, 2025
@jan-cerny jan-cerny added this to the 0.1.80 milestone Nov 20, 2025
Copy link
Contributor

@dodys dodys left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@openshift-ci
Copy link

openshift-ci bot commented Nov 25, 2025

@Vincent056: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-openshift-node-compliance 90898bd link true /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link
Member

@yuumasato yuumasato left a comment

Choose a reason for hiding this comment

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

/lgtm

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants