-
Notifications
You must be signed in to change notification settings - Fork 749
CMP-3624,CMP-3553: Sshd rules for rhel8 and rhel9 nodes #13953
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
base: master
Are you sure you want to change the base?
CMP-3624,CMP-3553: Sshd rules for rhel8 and rhel9 nodes #13953
Conversation
This limit applicabiliy of current existing Kubernetes remediations to OCP 4.12. OCP 4.12 has RHEL8 based RHCOS nodes, which don't support drop-in directories and are thus, remediated by a single file. This leads to poor granularity with multiple rules being fixed a single remediation.
Limit applicability of this remediation to OCP 4.12 or older.
Remove Include sshd_config.d directive from sshd_config_source() macro. RHEL8 nodes don't support .d config directory for the daemon.
Add a macro that renders a MachineConfig a for SSHD rules, applicable from OCP 4.13 and newer. They leverage the SSHD drop-in config directory.
Leverage the drop-in macro to create SSHD drop-in MachineConfigs.
Example of how remediations not matching the ocp-version can be found: $ oc get events | grep SkippingRemediation
116m Warning SkippingRemediation compliancescan/upstream-rhcos4-high-master Skipping ComplianceRemediation 'openshift-compliance/upstream-rhcos4-high-master-sshd-disable-rhosts'. Cluster doesn't match version range <=4.13.0
117m Warning SkippingRemediation compliancescan/upstream-rhcos4-high-worker Skipping ComplianceRemediation 'openshift-compliance/upstream-rhcos4-high-worker-sshd-disable-rhosts'. Cluster doesn't match version range <=4.13.0 And then the second yaml file is applied: $ oc get rems -oyaml upstream-rhcos4-high-master-sshd-disable-rhosts-1 apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceRemediation
metadata:
annotations:
compliance.openshift.io/ocp-version: '>=4.13.0'
compliance.openshift.io/xccdf-value-used: var-rekey-limit-size,var-rekey-limit-time,var-sshd-set-login-grace-time,var-sshd-disable-compression,sshd-idle-timeout-value,var-sshd-set-keepalive,var-sshd-priv-separation
creationTimestamp: "2025-09-29T19:21:59Z"
generation: 2
labels:
compliance.openshift.io/scan-name: upstream-rhcos4-high-master
compliance.openshift.io/suite: rhcos4-high
name: upstream-rhcos4-high-master-sshd-disable-rhosts-1
namespace: openshift-compliance
spec:
apply: true
current:
object:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata: {}
spec:
config:
ignition:
version: 3.1.0
storage:
files:
- contents:
source: data:,IgnoreRhosts%20yes
mode: 384
overwrite: true
path: /etc/ssh/sshd_config.d/00-complianceascode-IgnoreRhosts.conf
outdated: {}
type: Configuration
status:
applicationState: Applied |
@yuumasato: The following tests failed, say
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. |
Description:
Rationale:
sshd_lineinfile
template. These rules will still fail on OCP 4.12.Include
directive from the staticsshd_config
.Review Hints:
sshd_config
file in el8 based nodes