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

Add remediation and OVAL for UBTU-20-010297 #11098

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

dexterle
Copy link
Contributor

@dexterle dexterle commented Sep 8, 2023

Description:

  • Fix UBTU-20-010297
  • Add Ubuntu2004 Ansible and Bash remediation
  • Add Ubuntu2004 OVAL Definition

Rationale:

Review Hints:

Build the product:

./build_product ubuntu2004

To test these changes with Ansible:

ansible-playbook build/ansible/ubuntu2004-playbook-stig.yml --tags "DISA-STIG-UBTU-20-010297"

To test changes with bash, run the remediation sections: xccdf_org.ssgproject.content_rule_audit_rules_privileged_commands_kmod

Checkout Manual STIG OVAL definitions, and use software like DISA STIG Viewer to view definitions.

git checkout dexterle:add-manual-stig-ubtu-20-v1r9

This STIG can be tested with the latest Ubuntu 2004 Benchmark SCAP. For reference, please review the latest artifacts: https://public.cyber.mil/stigs/downloads/

This commit will add shell and ansible remediations for kmod. Additionally, adds in OVAL definition.
@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Used by openshift-ci bot. needs-ok-to-test Used by openshift-ci bot. labels Sep 8, 2023
@openshift-ci
Copy link

openshift-ci bot commented Sep 8, 2023

Hi @dexterle. 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.

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

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

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

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@Mab879 Mab879 added Ubuntu Ubuntu product related. STIG STIG Benchmark related. labels Sep 8, 2023
@marcusburghardt
Copy link
Member

@dexterle , I saw you opened 41 draft PRs. We definitely appreciate your collaboration in the project, but 41 draft PRs without proper description is making the PRs queue a little messy and consequently hard to review.

Please, take a time and organize your existing PRs:

  • Update the description of all PRs respecting the Project Style Guides.
  • I saw many PRs are really simple but they are still set as Draft. Please, make it clear if you plan to change the draft PRs. Otherwise, move it to "Ready for Review"
    • We usually don't actively review Draft PRs and likely they are closed after some time without interaction.

I also invite you to join the Project room in Gitter:

@dexterle dexterle marked this pull request as ready for review September 11, 2023 17:09
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 11, 2023
@dexterle
Copy link
Contributor Author

dexterle commented Sep 11, 2023

@dexterle , I saw you opened 41 draft PRs. We definitely appreciate your collaboration in the project, but 41 draft PRs without proper description is making the PRs queue a little messy and consequently hard to review.

Please, take a time and organize your existing PRs:

  • Update the description of all PRs respecting the Project Style Guides.

  • I saw many PRs are really simple but they are still set as Draft. Please, make it clear if you plan to change the draft PRs. Otherwise, move it to "Ready for Review"

    • We usually don't actively review Draft PRs and likely they are closed after some time without interaction.

I also invite you to join the Project room in Gitter:

@marcusburghardt , apologies for the delay on the PR updates, and thank you for your patience. I have modified all of the Ubuntu profile upgrade STIG PRs with proper descriptions and moved to "Ready for Review". I have also joined the project room in Glitter, and will spend time rebasing and testing.

@marcusburghardt
Copy link
Member

@dexterle , I saw you opened 41 draft PRs. We definitely appreciate your collaboration in the project, but 41 draft PRs without proper description is making the PRs queue a little messy and consequently hard to review.
Please, take a time and organize your existing PRs:

  • Update the description of all PRs respecting the Project Style Guides.

  • I saw many PRs are really simple but they are still set as Draft. Please, make it clear if you plan to change the draft PRs. Otherwise, move it to "Ready for Review"

    • We usually don't actively review Draft PRs and likely they are closed after some time without interaction.

I also invite you to join the Project room in Gitter:

@marcusburghardt , apologies for the delay on the PR updates, and thank you for your patience. I have modified all of the Ubuntu profile upgrade STIG PRs with proper descriptions and moved to "Ready for Review". I have also joined the project room in Glitter, and will spend time rebasing and testing.

Great @dexterle. You do not need to apologize. You are getting used to the project and everything is fine. Most maintainers are on Gitter. You can also contact us there when you need any help.

Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

Perhaps it is time to simplify this rule. Currently the OVAL and remediation are named to satisfy only specific products but the rule is be valid for many other products. Ideally, this rule should use the audit_rules_privileged_commands template, like other similar rules. If there is any particularity where the template is not suitable, we should unify the files using the shared name. What do you think @ComplianceAsCode/suse-maintainers , @ComplianceAsCode/ubuntu-maintainers , @ComplianceAsCode/oracle-maintainers ?

@dodys dodys self-assigned this Sep 12, 2023
@dodys
Copy link
Contributor

dodys commented Sep 12, 2023

Perhaps it is time to simplify this rule. Currently the OVAL and remediation are named to satisfy only specific products but the rule is be valid for many other products. Ideally, this rule should use the audit_rules_privileged_commands template, like other similar rules. If there is any particularity where the template is not suitable, we should unify the files using the shared name. What do you think @ComplianceAsCode/suse-maintainers , @ComplianceAsCode/ubuntu-maintainers , @ComplianceAsCode/oracle-maintainers ?

sounds good to me
on this one specifically we (Ubuntu) could share the same remediation and oval as SUSE as the template itself doesn't match our case

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.

please check our comments above

@dodys dodys added ok-to-test Used by openshift-ci bot. and removed needs-ok-to-test Used by openshift-ci bot. labels Sep 12, 2023
@freddieRv
Copy link
Contributor

Perhaps it is time to simplify this rule. Currently the OVAL and remediation are named to satisfy only specific products but the rule is be valid for many other products. Ideally, this rule should use the audit_rules_privileged_commands template, like other similar rules.

This sounds good 👍🏻

If there is any particularity where the template is not suitable, we should unify the files using the shared name.

Looking at OL7 and OL8 STIGs, the template works for OL7. However for OL8 DISA is using a different syntax for the rules.
This is correctly shown only on the rule's yaml, but not on OVAL/Ansible/Bash:

{{%- if product in ["ol7", "rhel7", "rhel8", "rhel9"] %}}
    {{%- set kmod_audit="-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=" ~ uid_min ~ " -F auid!=unset -F key=privileged" %}}
{{%- elif product in ["ubuntu2004", "ubuntu2204"] %}}
    {{%- set kmod_audit="-w /bin/kmod -p x -k modules" %}}
{{%- else %}}
    {{%- set kmod_audit="-w /usr/bin/kmod -p x -k modules" %}}
{{%- endif %}}

This is true for a number of audit rules. If other products are in a similar position we could modify the template to accommodate both syntaxes.

@teacup-on-rockingchair
Copy link
Contributor

Perhaps it is time to simplify this rule. Currently the OVAL and remediation are named to satisfy only specific products but the rule is be valid for many other products. Ideally, this rule should use the audit_rules_privileged_commands template, like other similar rules. If there is any particularity where the template is not suitable, we should unify the files using the shared name. What do you think @ComplianceAsCode/suse-maintainers , @ComplianceAsCode/ubuntu-maintainers , @ComplianceAsCode/oracle-maintainers ?

sounds good to me on this one specifically we (Ubuntu) could share the same remediation and oval as SUSE as the template itself doesn't match our case

Completely agree 👍 , let's start with shared and platform restriction there and we can add platforms as we go :)

@github-actions
Copy link

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
OVAL for rule 'xccdf_org.ssgproject.content_rule_audit_rules_privileged_commands_kmod' differs.
--- oval:ssg-audit_rules_privileged_commands_kmod:def:1
+++ oval:ssg-audit_rules_privileged_commands_kmod:def:1
@@ -1,7 +1,7 @@
 criteria OR
 criteria AND
 extend_definition oval:ssg-audit_rules_augenrules:def:1
-criterion oval:ssg-test_audit_rules_privileged_commands_kmod_augenrules:tst:1
+criterion oval:ssg-test_kmod_augenrules:tst:1
 criteria AND
 extend_definition oval:ssg-audit_rules_auditctl:def:1
-criterion oval:ssg-test_audit_rules_privileged_commands_kmod_auditctl:tst:1
+criterion oval:ssg-test_kmod_auditctl:tst:1

New datastream is missing bash remediation for rule 'xccdf_org.ssgproject.content_rule_audit_rules_privileged_commands_kmod'.
New datastream is missing ansible remediation for rule 'xccdf_org.ssgproject.content_rule_audit_rules_privileged_commands_kmod'.

This commit will remove specific remediations for sle15 and sle12 to adopt shared remediations. This is necessary for the following OS's because the supplied template within rule.yml is not applicable.
@dexterle dexterle force-pushed the fix-rule-ubtu-20-010297 branch from 479094d to b28df48 Compare September 28, 2023 15:39
@codeclimate
Copy link

codeclimate bot commented Sep 28, 2023

Code Climate has analyzed commit b28df48 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 56.9%.

View more on Code Climate.

@dodys dodys requested a review from a team October 3, 2023 08:57
@dodys
Copy link
Contributor

dodys commented Oct 3, 2023

@teacup-on-rockingchair could you check if this looks ok from SUSE's perspective? There are some failing tests.

@teacup-on-rockingchair
Copy link
Contributor

@teacup-on-rockingchair could you check if this looks ok from SUSE's perspective? There are some failing tests.

Those seem to fail for two reasons:

  • first missing package requirement in the auditclt related tests, I will add them in a separate file
  • missing some patches in the testing infrastructure to recognize SLE platform, this is fixed with rebase

After that I got result 'not applicable' on those since they seem to be only machine environment relevant :)

Copy link
Contributor

@teacup-on-rockingchair teacup-on-rockingchair left a comment

Choose a reason for hiding this comment

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

👍 nice stuff

teacup-on-rockingchair added a commit to teacup-on-rockingchair/content that referenced this pull request Oct 6, 2023
Thanks to @dodys for the initial feedback on this in the context of ComplianceAsCode#11098
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.

that also lgtm, thanks!

@dodys dodys merged commit 818d4a1 into ComplianceAsCode:master Oct 6, 2023
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Oct 11, 2023
@Mab879 Mab879 modified the milestones: 0.1.71, 0.1.70 Oct 11, 2023
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. STIG STIG Benchmark related. 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.

6 participants