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

Align sshd_use_approved_macs_ordered_stig with Ubuntu STIG #11853

Merged
merged 6 commits into from
May 10, 2024

Conversation

mpurg
Copy link
Contributor

@mpurg mpurg commented Apr 18, 2024

Description:

  • Modify sshd_use_approved_macs_ordered_stig rule to better align with Ubuntu STIG (UBTU-20-010043, UBTU-22-255055)
  • Switch to using sshd_approved_macs variable
  • Switch to checking the whole set of algorithms instead of just a subset
  • Extend OVAL check to allow distributed configs

Rationale:

  • Checking just for a subset does not meet the requirement of having the algorithms in the exact same order (as specified in the STIG), because it is possible to specify only the last algorithm, which is effectively the same as specifying them in the wrong order

@mpurg mpurg requested a review from a team as a code owner April 18, 2024 14:01
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Apr 18, 2024
Copy link

openshift-ci bot commented Apr 18, 2024

Hi @mpurg. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

Copy link

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

rhel7 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Apr 18, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:11853
This image was built from commit: 9f849e5

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:11853

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:11853 make deploy-local

@dodys dodys self-assigned this Apr 18, 2024
@dodys dodys added Ubuntu Ubuntu product related. ok-to-test Used by openshift-ci bot. and removed needs-ok-to-test Used by openshift-ci bot. labels Apr 18, 2024
<def-group>
<definition class="compliance" id="{{{ rule_id }}}" version="1">
{{{ oval_metadata("Limit the Message Authentication Codes (MACs) to those which are FIPS-approved.") }}}
<criteria comment="sshd is configured correctly or is not installed" operator="OR">
Copy link
Contributor

Choose a reason for hiding this comment

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

the "approved" rules should have a requirement on FIPS. See the shared OVAL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, thanks. I added the requirement and rebased to master.
The tests currently fail on Ubuntu 22.04 since the OS is not yet listed in installed_OS_is_FIPS_certified.
If added to the list, all tests pass.

@dodys
Copy link
Contributor

dodys commented Apr 30, 2024

@marcusburghardt @Mab879 @teacup-on-rockingchair do you think it would be worth to make the ubuntu.xml oval the default instead of the current shared.xml, as it seems this is allowing partial matches, and iirc disa is pretty strict on having all the approved algorithms in a specific order, that way a partial match shouldn't be allowed.

@dodys
Copy link
Contributor

dodys commented May 7, 2024

@marcusburghardt @Mab879 @teacup-on-rockingchair do you think it would be worth to make the ubuntu.xml oval the default instead of the current shared.xml, as it seems this is allowing partial matches, and iirc disa is pretty strict on having all the approved algorithms in a specific order, that way a partial match shouldn't be allowed.

@marcusburghardt @Mab879 @teacup-on-rockingchair tagging you again to bring attention to this

@marcusburghardt marcusburghardt requested a review from a team May 7, 2024 07:09
@mpurg mpurg force-pushed the ubuntu_2204_stig_255055 branch 2 times, most recently from 80b90d6 to 63f543d Compare May 9, 2024 09:56
@mpurg mpurg marked this pull request as draft May 9, 2024 10:02
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label May 9, 2024
@mpurg mpurg force-pushed the ubuntu_2204_stig_255055 branch from 63f543d to a5116bb Compare May 9, 2024 12:55
@mpurg mpurg marked this pull request as ready for review May 9, 2024 14:30
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label May 9, 2024
mpurg added 3 commits May 9, 2024 16:51
The OVAL now also allows distributed configs and uses
the variable `sshd_approved_macs` instead of hardcoded values.

The implementation is based on the template `sshd_lineinfile`,
modified to allow external variables as values and checking for
FIPS compliant OS.
The remediation now uses the bash_sshd_remediation macro and the
sshd_approved_macs variable.
…stig

The remediation now uses the ansible_sshd_set macro and the
sshd_approved_macs variable.
@mpurg mpurg force-pushed the ubuntu_2204_stig_255055 branch from a5116bb to 9f849e5 Compare May 9, 2024 14:51
Copy link

codeclimate bot commented May 9, 2024

Code Climate has analyzed commit 9f849e5 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 59.4% (0.0% change).

View more on Code Climate.

@dodys
Copy link
Contributor

dodys commented May 10, 2024

because of the lack of reply, I will merge this as is, and my comment could be done in a separate PR if other vendors are interested.

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!

@dodys dodys merged commit 4c4badb into ComplianceAsCode:master May 10, 2024
110 of 113 checks passed
@Mab879 Mab879 added this to the 0.1.74 milestone May 10, 2024
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Used by openshift-ci bot. Ubuntu Ubuntu 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.

3 participants