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 tests for file_groupownership_sshd_private_key #12896

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

Mab879
Copy link
Member

@Mab879 Mab879 commented Jan 24, 2025

Description:

Make the tests in file_groupownership_sshd_private_key select the correct group for owning ssh keys based on the OS.

Rationale:

Fixes #12893

@Mab879 Mab879 added the bugfix Fixes to reported bugs. label Jan 24, 2025
@Mab879 Mab879 added this to the 0.1.76 milestone Jan 24, 2025
Copy link

codeclimate bot commented Jan 24, 2025

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

View more on Code Climate.

@jan-cerny jan-cerny self-assigned this Jan 27, 2025
Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

I have executed the test scenario and I have seen that the correct_groupowner.pass.sh started to pass.

jcerny@fedora:~/work/git/scap-security-guide (pr/12896)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel10 file_groupownership_sshd_private_key
Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/jcerny/work/git/scap-security-guide/logs/rule-custom-2025-01-27-0949-1/test_suite.log
INFO - xccdf_org.ssgproject.content_rule_file_groupownership_sshd_private_key
INFO - Script incorrect_groupowner.fail.sh using profile (all) OK
INFO - Script correct_groupowner.pass.sh using profile (all) OK
INFO - Script multiple_keys.fail.sh using profile (all) OK
jcerny@fedora:~/work/git/scap-security-guide (pr/12896)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel10 --remediate-using ansible file_groupownership_sshd_private_key
Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/jcerny/work/git/scap-security-guide/logs/rule-custom-2025-01-27-0951/test_suite.log
INFO - xccdf_org.ssgproject.content_rule_file_groupownership_sshd_private_key
INFO - Script incorrect_groupowner.fail.sh using profile (all) OK
INFO - Script correct_groupowner.pass.sh using profile (all) OK
INFO - Script multiple_keys.fail.sh using profile (all) OK

Also I have checked the prescripts log to see what group is used in chgrp and I have seen this:

  9 ##### file_groupownership_sshd_private_key / correct_groupowner.pass.sh #####
 10 ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.124.175 cd /root/ssgts/file_groupownership_sshd_private_key; SHARED=/root/        ssgts/shared bash -x correct_groupowner.pass.sh
 11 STDERR: Warning: Permanently added '192.168.124.175' (ED25519) to the list of known hosts.
 12 + grep -q root /etc/group
 13 ++ mktemp -p /etc/ssh/ XXXX_key
 14 + FAKE_KEY=/etc/ssh/UE5Y_key
 15 + chgrp root /etc/ssh/UE5Y_key

@jan-cerny jan-cerny merged commit 7f8944c into ComplianceAsCode:master Jan 27, 2025
108 of 109 checks passed
@Mab879 Mab879 deleted the fix_12893 branch January 27, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes to reported bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatus file_groupownership_sshd_private_key/correct_groupowner.pass fails on RHEL-10
2 participants