Skip to content
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

OCPBUGS-18331: Include sshd config directories in remediation template #11551

Merged

Conversation

rhmdnd
Copy link
Collaborator

@rhmdnd rhmdnd commented Feb 6, 2024

The generic sshd configuration file we were using to generate
sshd remediations for OpenShift didn't include the sshd_config.d/
directory. This can be a problem for some clusters and configuration
that spread their sshd configuration across those directories, instead
of assuming all configuration will be in a single sshd configuration
file.

This could lead to cases where applying remediations for sshd hardening
breaks ssh in unexpected ways (e.g., like not being able to ssh into the
clusters because the ssh keys are not longer accessible if they're under
sshd_config.d).

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 6, 2024

Adding @BhargaviGudi for review.

Copy link

github-actions bot commented Feb 6, 2024

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 6, 2024

/test

Copy link

openshift-ci bot commented Feb 6, 2024

@rhmdnd: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test 4.13-images
  • /test 4.14-images
  • /test 4.15-images
  • /test 4.16-images
  • /test e2e-aws-ocp4-cis
  • /test e2e-aws-ocp4-cis-node
  • /test e2e-aws-ocp4-e8
  • /test e2e-aws-ocp4-high
  • /test e2e-aws-ocp4-high-node
  • /test e2e-aws-ocp4-moderate
  • /test e2e-aws-ocp4-moderate-node
  • /test e2e-aws-ocp4-pci-dss
  • /test e2e-aws-ocp4-pci-dss-node
  • /test e2e-aws-ocp4-stig
  • /test e2e-aws-ocp4-stig-node
  • /test e2e-aws-rhcos4-e8
  • /test e2e-aws-rhcos4-high
  • /test e2e-aws-rhcos4-moderate
  • /test e2e-aws-rhcos4-stig
  • /test images

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-ComplianceAsCode-content-master-4.13-images
  • pull-ci-ComplianceAsCode-content-master-4.14-images
  • pull-ci-ComplianceAsCode-content-master-4.15-images
  • pull-ci-ComplianceAsCode-content-master-4.16-images
  • pull-ci-ComplianceAsCode-content-master-images

In response to this:

/test

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/test-infra repository.

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 6, 2024

/test e2e-aws-rhcos4-e8

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 7, 2024

Failures are unrelated to the change being made here and will be fixed separately.

@yuumasato yuumasato self-assigned this Feb 9, 2024
@marcusburghardt marcusburghardt added the OpenShift OpenShift product related. label Feb 12, 2024
The generic sshd configuration file we were using to generate
sshd remediations for OpenShift didn't include the sshd_config.d/
directory. This can be a problem for some clusters and configuration
that spread their sshd configuration across those directories, instead
of assuming all configuration will be in a single sshd configuration
file.

This could lead to cases where applying remediations for sshd hardening
breaks ssh in unexpected ways (e.g., like not being able to ssh into the
clusters because the ssh keys are not longer accessible if they're under
sshd_config.d).
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 13, 2024

/test

Copy link

openshift-ci bot commented Feb 13, 2024

@rhmdnd: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test 4.13-e2e-aws-ocp4-cis
  • /test 4.13-e2e-aws-ocp4-cis-node
  • /test 4.13-e2e-aws-ocp4-e8
  • /test 4.13-e2e-aws-ocp4-high
  • /test 4.13-e2e-aws-ocp4-high-node
  • /test 4.13-e2e-aws-ocp4-moderate
  • /test 4.13-e2e-aws-ocp4-moderate-node
  • /test 4.13-e2e-aws-ocp4-pci-dss
  • /test 4.13-e2e-aws-ocp4-pci-dss-node
  • /test 4.13-e2e-aws-ocp4-stig
  • /test 4.13-e2e-aws-ocp4-stig-node
  • /test 4.13-e2e-aws-rhcos4-e8
  • /test 4.13-e2e-aws-rhcos4-high
  • /test 4.13-e2e-aws-rhcos4-moderate
  • /test 4.13-e2e-aws-rhcos4-stig
  • /test 4.13-images
  • /test 4.14-images
  • /test 4.15-e2e-aws-ocp4-cis
  • /test 4.15-e2e-aws-ocp4-cis-node
  • /test 4.15-e2e-aws-ocp4-e8
  • /test 4.15-e2e-aws-ocp4-high
  • /test 4.15-e2e-aws-ocp4-high-node
  • /test 4.15-e2e-aws-ocp4-moderate
  • /test 4.15-e2e-aws-ocp4-moderate-node
  • /test 4.15-e2e-aws-ocp4-pci-dss
  • /test 4.15-e2e-aws-ocp4-pci-dss-node
  • /test 4.15-e2e-aws-ocp4-stig
  • /test 4.15-e2e-aws-ocp4-stig-node
  • /test 4.15-e2e-aws-rhcos4-e8
  • /test 4.15-e2e-aws-rhcos4-high
  • /test 4.15-e2e-aws-rhcos4-moderate
  • /test 4.15-e2e-aws-rhcos4-stig
  • /test 4.15-images
  • /test 4.16-e2e-aws-ocp4-cis
  • /test 4.16-e2e-aws-ocp4-cis-node
  • /test 4.16-e2e-aws-ocp4-e8
  • /test 4.16-e2e-aws-ocp4-high
  • /test 4.16-e2e-aws-ocp4-high-node
  • /test 4.16-e2e-aws-ocp4-moderate
  • /test 4.16-e2e-aws-ocp4-moderate-node
  • /test 4.16-e2e-aws-ocp4-pci-dss
  • /test 4.16-e2e-aws-ocp4-pci-dss-node
  • /test 4.16-e2e-aws-ocp4-stig
  • /test 4.16-e2e-aws-ocp4-stig-node
  • /test 4.16-e2e-aws-rhcos4-e8
  • /test 4.16-e2e-aws-rhcos4-high
  • /test 4.16-e2e-aws-rhcos4-moderate
  • /test 4.16-e2e-aws-rhcos4-stig
  • /test 4.16-images
  • /test e2e-aws-ocp4-cis
  • /test e2e-aws-ocp4-cis-node
  • /test e2e-aws-ocp4-e8
  • /test e2e-aws-ocp4-high
  • /test e2e-aws-ocp4-high-node
  • /test e2e-aws-ocp4-moderate
  • /test e2e-aws-ocp4-moderate-node
  • /test e2e-aws-ocp4-pci-dss
  • /test e2e-aws-ocp4-pci-dss-node
  • /test e2e-aws-ocp4-stig
  • /test e2e-aws-ocp4-stig-node
  • /test e2e-aws-rhcos4-e8
  • /test e2e-aws-rhcos4-high
  • /test e2e-aws-rhcos4-moderate
  • /test e2e-aws-rhcos4-stig
  • /test images

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-ComplianceAsCode-content-master-4.13-images
  • pull-ci-ComplianceAsCode-content-master-4.14-images
  • pull-ci-ComplianceAsCode-content-master-4.15-images
  • pull-ci-ComplianceAsCode-content-master-4.16-images
  • pull-ci-ComplianceAsCode-content-master-images

In response to this:

/test

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/test-infra repository.

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 13, 2024

/test 4.13-e2e-aws-rhcos4-e8
/test 4.15-e2e-aws-rhcos4-e8
/test 4.16-e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-e8

Copy link

codeclimate bot commented Feb 13, 2024

Code Climate has analyzed commit 7b8f481 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 58.3% (0.0% change).

View more on Code Climate.

@xiaojiey
Copy link
Collaborator

/hold for test

@openshift-ci openshift-ci bot added the do-not-merge/hold Used by openshift-ci-robot bot. label Feb 20, 2024
@BhargaviGudi
Copy link
Collaborator

Verification passed with 4.12.49 + compliance operator + code from PR #11551

  1. Install CO
  2. Create ssb with upstream-rhcos4-e8
$ oc compliance bind -S default-auto-apply -N test profile/upstream-rhcos4-e8
Creating ScanSettingBinding test
$ oc get suite -w
NAME   PHASE       RESULT
test   LAUNCHING   NOT-AVAILABLE
test   LAUNCHING   NOT-AVAILABLE
test   RUNNING     NOT-AVAILABLE
test   RUNNING     NOT-AVAILABLE
test   AGGREGATING   NOT-AVAILABLE
test   AGGREGATING   NOT-AVAILABLE
test   DONE          NON-COMPLIANT
test   DONE          NON-COMPLIANT
$ oc get suite
NAME   PHASE   RESULT
test   DONE    NON-COMPLIANT
$ oc get scan
NAME                        PHASE   RESULT
upstream-rhcos4-e8-master   DONE    NON-COMPLIANT
upstream-rhcos4-e8-worker   DONE    NON-COMPLIANT
  1. Verify whether MachineConfig resources are having line Include /etc/ssh/ssh_config.d/*.config
#	$OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

Include /etc/ssh/sshd_config.d/*.conf
...

@BhargaviGudi
Copy link
Collaborator

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Used by openshift-ci-robot bot. label Feb 26, 2024
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Feb 28, 2024

@yuumasato @Vincent056 should be ready for another review.

Copy link
Contributor

@Vincent056 Vincent056 left a comment

Choose a reason for hiding this comment

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

/lgtm

@yuumasato
Copy link
Member

@BhargaviGudi @xiaojiey Hi, just wanted to double check whether you were able to ssh into the cluster.
I was not able to do that, XD.

@xiaojiey
Copy link
Collaborator

xiaojiey commented Mar 1, 2024

@BhargaviGudi @xiaojiey Hi, just wanted to double check whether you were able to ssh into the cluster. I was not able to do that, XD.

Yes, I can. Notify you on the detailed step I used for ssh to the node.

@xiaojiey
Copy link
Collaborator

xiaojiey commented Mar 4, 2024

/lgtm

@yuumasato yuumasato merged commit fa8991a into ComplianceAsCode:master Mar 4, 2024
46 of 47 checks passed
@yuumasato yuumasato added this to the 0.1.73 milestone Mar 4, 2024
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants