Skip to content

Remove untestable missing.pass.sh scenario for file_permissions_sshd_private_key - #15040

Merged
Mab879 merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:fix-missing-pass-remediation-none
Aug 25, 2026
Merged

Remove untestable missing.pass.sh scenario for file_permissions_sshd_private_key#15040
Mab879 merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:fix-missing-pass-remediation-none

Conversation

@ggbecker

@ggbecker ggbecker commented Aug 24, 2026

Copy link
Copy Markdown
Member

Description

Removes the missing.pass.sh test scenario for file_permissions_sshd_private_key.

Rationale

The scenario was included accidentally in #15015 and cannot be validated by Automatus on any backend:

  • Every Automatus backend (libvirt and container) scans the target over SSH via oscap-ssh.
  • The scenario's rm -f /etc/ssh/* deletes the SSH host keys that transport depends on.
  • Modern OpenSSH re-execs a fresh sshd per connection and reloads host keys from disk, so the scan connection is reset (kex_exchange_identification: read: Connection reset by peer) before the rule can be evaluated.

It also carried a # remediation = none directive, which is invalid for a .pass.sh test and was flagged by the test-scenario linter:

FAIL file_permissions_sshd_private_key/missing.pass
(remediation=none doesn't make sense for a .pass.sh test)

The behavior the scenario aimed to cover — when no key files are present there are no offending keys, so the check passes — is already guaranteed by the OVAL check_existence="none_exist" semantics and needs no runtime scenario.

Verification

Reproduced the SSH-transport failure on a rhel9 libvirt VM (initial scan reset before evaluation) and confirmed that even surgical *_key-only removal breaks new SSH connections, since sshd is the classic sshd.service (not socket-activated) yet OpenSSH still reloads host keys on each re-exec.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Aug 24, 2026
@openshift-ci

openshift-ci Bot commented Aug 24, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ggbecker ggbecker added this to the 0.1.83 milestone Aug 24, 2026
The missing.pass.sh scenario for file_permissions_sshd_private_key was
included accidentally in PR ComplianceAsCode#15015. It cannot be validated by Automatus:
every backend (libvirt and container) scans the target over SSH via
oscap-ssh, but the scenario's 'rm -f /etc/ssh/*' deletes the SSH host
keys that transport depends on. Modern OpenSSH re-execs a fresh sshd per
connection and reloads the host keys from disk, so the scan connection is
reset (kex_exchange_identification: Connection reset by peer) before the
rule can be evaluated.

It also carried a '# remediation = none' directive, which is invalid for
a .pass.sh test and was flagged by the test-scenario linter.

The behavior it aimed to cover - no key files present means no offending
keys, so the check passes - is already guaranteed by the OVAL
check_existence="none_exist" semantics and needs no runtime scenario.
@ggbecker
ggbecker force-pushed the fix-missing-pass-remediation-none branch from 263aa7a to c7b51f9 Compare August 24, 2026 22:44
@ggbecker ggbecker changed the title Fix invalid remediation=none directive on missing.pass.sh Remove untestable missing.pass.sh scenario for file_permissions_sshd_private_key Aug 24, 2026
@ggbecker
ggbecker marked this pull request as ready for review August 24, 2026 22:46
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Aug 24, 2026
@ggbecker ggbecker added do-not-merge/work-in-progress Used by openshift-ci bot. backported-into-stabilization PRs which were cherry-picked during stabilization process. labels Aug 24, 2026
@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

@ggbecker: 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-platform-compliance c7b51f9 link true /test e2e-aws-openshift-platform-compliance

Full PR test history. Your PR dashboard.

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

@Mab879
Mab879 merged commit d7ad56f into ComplianceAsCode:master Aug 25, 2026
70 of 74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported-into-stabilization PRs which were cherry-picked during stabilization process. do-not-merge/work-in-progress Used by openshift-ci bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants