Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

yu410621
Copy link
Contributor

Description:

The current accounts_tmout OVAL definition is flawed, as it incorrectly passes on systems where TMOUT is set to 0.

This occurs because the existing check only validates an upper bound (e.g., less than or equal to 600), a condition that TMOUT=0 satisfies. However, a value of 0 disables the timeout feature in most shells, which contradicts the rule's intent.

This PR corrects the logic by adding a lower-bound check to ensure the TMOUT value is greater than or equal to 1. The top-level now combines both the existing upper-bound and new lower-bound checks with AND logic, ensuring TMOUT=0 is correctly reported as non-compliant.

The definition's version has been incremented from 3 to 4 to reflect this logical change.

Copy link

openshift-ci bot commented Jun 11, 2025

Hi @yu410621. 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-sigs/prow repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Jun 11, 2025
@jan-cerny jan-cerny self-assigned this Jun 11, 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.

@yu410621 This is a great discovery! Thank you for your PR. Can you add a test scenario covering this situation?

@yu410621
Copy link
Contributor Author

Hi @jan-cerny , I've added the requested test cases and updated the rule documentation. Thanks for the feedback!

Copy link

Code Climate has analyzed commit a9d86f1 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 added this to the 0.1.78 milestone Jun 11, 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.

jcerny@fedora:~/work/git/scap-security-guide (pr/13564)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel9 accounts_tmout
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-06-11-1522/test_suite.log
WARNING - Script 'multiline.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
INFO - xccdf_org.ssgproject.content_rule_accounts_tmout
INFO - Script comment_profile_d.fail.sh using profile (all) OK
INFO - Script line_not_there.fail.sh using profile (all) OK
INFO - Script wrong_value_profile.fail.sh using profile (all) OK
INFO - Script wrong_value_profile_d.fail.sh using profile (all) OK
INFO - Script comment_profile.fail.sh using profile (all) OK
INFO - Script conflicting_values_diff_file.fail.sh using profile (all) OK
INFO - Script conflicting_values_same_file.fail.sh using profile (all) OK
INFO - Script correct_value_profile.pass.sh using profile (all) OK
INFO - Script correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script correct_value_profile_declare.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_diff_files.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script supercompliance_profile.pass.sh using profile (all) OK
INFO - Script supercompliance_profile_d.pass.sh using profile (all) OK
INFO - Script tmout_is_zero_profile.fail.sh using profile (all) OK
INFO - Script tmout_is_zero_profile_d.fail.sh using profile (all) OK
jcerny@fedora:~/work/git/scap-security-guide (pr/13564)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel9 --remediate-using ansible accounts_tmout
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-06-11-1529/test_suite.log
WARNING - Script 'multiline.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
INFO - xccdf_org.ssgproject.content_rule_accounts_tmout
INFO - Script comment_profile_d.fail.sh using profile (all) OK
INFO - Script line_not_there.fail.sh using profile (all) OK
INFO - Script wrong_value_profile.fail.sh using profile (all) OK
INFO - Script wrong_value_profile_d.fail.sh using profile (all) OK
INFO - Script comment_profile.fail.sh using profile (all) OK
INFO - Script conflicting_values_diff_file.fail.sh using profile (all) OK
INFO - Script conflicting_values_same_file.fail.sh using profile (all) OK
INFO - Script correct_value_profile.pass.sh using profile (all) OK
INFO - Script correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script correct_value_profile_declare.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_diff_files.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script supercompliance_profile.pass.sh using profile (all) OK
INFO - Script supercompliance_profile_d.pass.sh using profile (all) OK
INFO - Script tmout_is_zero_profile.fail.sh using profile (all) OK
INFO - Script tmout_is_zero_profile_d.fail.sh using profile (all) OK

@jan-cerny jan-cerny merged commit 8761e66 into ComplianceAsCode:master Jun 11, 2025
120 of 122 checks passed
@jan-cerny jan-cerny added OVAL OVAL update. Related to the systems assessments. Update Rule Issues or pull requests related to Rules updates. labels Jun 11, 2025
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. OVAL OVAL update. Related to the systems assessments. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants