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

update rule sles-15-040250 #10492

Merged

Conversation

svet-se
Copy link
Contributor

@svet-se svet-se commented Apr 25, 2023

Description:

  • Update rule file_permissions_sshd_private_key

Rationale:

  • Accoring DISA recommendations Version 1, Release 9 from 26 January 2023 about SLE 15 STIG - "SLES-15-040250 - Updated text to reflect revised SSH key permissions guidance from vendor."

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Apr 25, 2023
@openshift-ci
Copy link

openshift-ci bot commented Apr 25, 2023

Hi @svet-se. 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

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

@github-actions
Copy link

github-actions bot commented Apr 25, 2023

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

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key' differs.
--- xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key
+++ xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key
@@ -4,7 +4,9 @@
 for keyfile in /etc/ssh/*_key; do
 test -f "$keyfile" || continue
 if test root:root = "$(stat -c "%U:%G" "$keyfile")"; then
+ 
 chmod u-xs,g-xwrs,o-xwrt "$keyfile"
+ 
 elif test root:ssh_keys = "$(stat -c "%U:%G" "$keyfile")"; then
 chmod u-xs,g-xws,o-xwrt "$keyfile"
 else

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key' differs.
--- xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key
+++ xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key
@@ -1,6 +1,6 @@
 - name: Find root:root-owned keys
- command: find -H /etc/ssh/ -maxdepth 1 -user root -regex ".*_key$" -type f -group
- root -perm /u+xs,g+xwrs,o+xwrt
+ ansible.builtin.command: find -H /etc/ssh/ -maxdepth 1 -user root -regex ".*_key$"
+ -type f -group root -perm /u+xs,g+xwrs,o+xwrt
 register: root_owned_keys
 changed_when: false
 failed_when: false
@@ -24,7 +24,7 @@
 - no_reboot_needed
 
 - name: Set permissions for root:root-owned keys
- file:
+ ansible.builtin.file:
 path: '{{ item }}'
 mode: u-xs,g-xwrs,o-xwrt
 state: file
@@ -49,8 +49,8 @@
 - no_reboot_needed
 
 - name: Find root:ssh_keys-owned keys
- command: find -H /etc/ssh/ -maxdepth 1 -user root -regex ".*_key$" -type f -group
- ssh_keys -perm /u+xs,g+xws,o+xwrt
+ ansible.builtin.command: find -H /etc/ssh/ -maxdepth 1 -user root -regex ".*_key$"
+ -type f -group ssh_keys -perm /u+xs,g+xws,o+xwrt
 register: dedicated_group_owned_keys
 changed_when: false
 failed_when: false
@@ -74,7 +74,7 @@
 - no_reboot_needed
 
 - name: Set permissions for root:ssh_keys-owned keys
- file:
+ ansible.builtin.file:
 path: '{{ item }}'
 mode: u-xs,g-xws,o-xwrt
 state: file

@svet-se svet-se force-pushed the update-rule-sles-15-040250 branch 2 times, most recently from 23985a9 to d917240 Compare April 26, 2023 06:43
@marcusburghardt
Copy link
Member

@svet-se could you rebase this PR with the current master, please? This should solve the failed CI tests.

@marcusburghardt marcusburghardt added the STIG STIG Benchmark related. label Apr 26, 2023
@svet-se
Copy link
Contributor Author

svet-se commented Apr 26, 2023

hey @marcusburghardt

Thanks for the advice, I've rebased to master.

Have a nice day!

@marcusburghardt marcusburghardt added the SLES SUSE Linux Enterprise Server product related. label Apr 27, 2023
@marcusburghardt marcusburghardt added this to the 0.1.68 milestone Apr 27, 2023
@svet-se svet-se force-pushed the update-rule-sles-15-040250 branch from c60d1b4 to 7618409 Compare May 9, 2023 15:09
@codeclimate
Copy link

codeclimate bot commented May 9, 2023

Code Climate has analyzed commit 7618409 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 52.4% (0.0% change).

View more on Code Climate.

@marcusburghardt marcusburghardt self-assigned this May 10, 2023
@marcusburghardt marcusburghardt merged commit 7165330 into ComplianceAsCode:master May 10, 2023
@svet-se svet-se deleted the update-rule-sles-15-040250 branch May 10, 2023 13:57
@ggbecker
Copy link
Member

ggbecker commented May 23, 2023

I see Automatus tests were not applicable:

Run tests/test_rule_in_container.sh --no-remove-machine-only --dontclean --logdir logs_bash --remediate-using bash --name ssg_test_suite --datastream $DATASTREAM file_permissions_sshd_private_key
Setting console output to log level INFO
INFO - The base image option has been specified, choosing Podman-based test environment.
INFO - Logging into logs_bash/test_suite.log
INFO - xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key
WARNING - Script unfixable.fail.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable
WARNING - Script altcorrect_permissions.pass.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable
WARNING - Script multiple_keys.fail.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable
WARNING - Script lenient_permissions.fail.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable
WARNING - Script supercompliance.pass.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable
WARNING - Script altlenient_permissions.fail.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable
WARNING - Script correct_permissions.pass.sh using profile (all) notapplicable
WARNING - Rule xccdf_org.ssgproject.content_rule_file_permissions_sshd_private_key evaluation resulted in notapplicable

This PR is what most likely is causing:

#10594
#10592

Because now we don't override machine platform anymore.

https://github.com/ComplianceAsCode/content/pull/10453/files

Update1: I think it's the new rules introduced in: #10552 that are causing the issue.

@jan-cerny jan-cerny added the Update Rule Issues or pull requests related to Rules updates. label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. SLES SUSE Linux Enterprise Server product related. STIG STIG Benchmark related. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants