Skip to content

Fix not-applicable tests in template pam_account_password_faillock #13329

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

Merged
merged 1 commit into from
Apr 16, 2025

Conversation

mpurg
Copy link
Contributor

@mpurg mpurg commented Apr 15, 2025

Description:

Tests in template pam_account_password_faillock use the macro tests_init_faillock_vars to define individual test parameters and values based on the required state (correct, strict, lenient_high, lenient_low).

Two test scenarios, which should result in not-applicable, were not properly implemented and resulted in error:

  • lenient_high + no upper boundary
  • lenient_low + no lower boundary

This fix inserts an additional # platform = Not Applicable to the top of the test script for those cases.

Rationale:

Tests in this template use the macro `tests_init_faillock_vars`
to define individual test parameters and values based on the
required state (correct, strict, lenient_high, lenient_low).

Two test scenarios, which should be not-applicable, were not properly
implemented and resulted in error:
- lenient_high + no upper boundary
- lenient_low + no lower boundary

This fix inserts an additional `# platform = Not Applicable` to
the top of the test script for those cases.

Fixes issue ComplianceAsCode#13319
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Apr 15, 2025
Copy link

openshift-ci bot commented Apr 15, 2025

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

Copy link

codeclimate bot commented Apr 15, 2025

Code Climate has analyzed commit 991b8a0 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.

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 run test scenarios for rule accounts_passwords_pam_faillock_deny that uses this template on a RHEL 9 VM back end

jcerny@fedora:~/work/git/scap-security-guide (pr/13329)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel9 accounts_passwords_pam_faillock_deny
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-04-16-1036/test_suite.log
WARNING - Script 'ubuntu_empty_faillock_conf.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_wrong_value.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_correct_pamd.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_missing_pamd.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_stricter_pam_files.pass.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_commented_values.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_lenient_low_pam_files.fail.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_correct.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_lenient_low.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_lenient_high_pam_files.fail.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_correct_stricter.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_lenient_high.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_expected_pam_files.pass.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'pam_faillock_multiple_pam_unix_pam_files.fail.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_multiple_pam_unix.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
INFO - xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny
INFO - Script pam_faillock_disabled.fail.sh using profile (all) OK
INFO - Script pam_faillock_lenient_high_faillock_conf.fail.sh using profile (all) OK
INFO - Script conflicting_settings_authselect.fail.sh using profile (all) OK
INFO - Script pam_faillock_lenient_low_faillock_conf.fail.sh using profile (all) OK
INFO - Script pam_faillock_multiple_pam_unix_faillock_conf.fail.sh using profile (all) OK
INFO - Script pam_faillock_stricter_faillock_conf.pass.sh using profile (all) OK
INFO - Script pam_faillock_expected_faillock_conf.pass.sh using profile (all) OK
INFO - Script pam_faillock_conflicting_settings.fail.sh using profile (all) OK
INFO - Script pam_faillock_not_required_pam_files.fail.sh using profile (all) OK
jcerny@fedora:~/work/git/scap-security-guide (pr/13329)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel9 --remediate-using ansible accounts_passwords_pam_faillock_deny
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-04-16-1038/test_suite.log
WARNING - Script 'ubuntu_correct.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_lenient_high_pam_files.fail.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_wrong_value.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_multiple_pam_unix_pam_files.fail.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'pam_faillock_stricter_pam_files.pass.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_missing_pamd.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_correct_pamd.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'pam_faillock_expected_pam_files.pass.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'pam_faillock_lenient_low_pam_files.fail.sh' is not applicable on 'rhel9' target because its platform is 'Oracle Linux 7,multi_platform_fedora'
WARNING - Script 'ubuntu_correct_stricter.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_empty_faillock_conf.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_commented_values.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_multiple_pam_unix.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_lenient_low.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
WARNING - Script 'ubuntu_lenient_high.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_ubuntu'
INFO - xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny
INFO - Script conflicting_settings_authselect.fail.sh using profile (all) OK
INFO - Script pam_faillock_not_required_pam_files.fail.sh using profile (all) OK
INFO - Script pam_faillock_lenient_low_faillock_conf.fail.sh using profile (all) OK
INFO - Script pam_faillock_stricter_faillock_conf.pass.sh using profile (all) OK
INFO - Script pam_faillock_lenient_high_faillock_conf.fail.sh using profile (all) OK
INFO - Script pam_faillock_conflicting_settings.fail.sh using profile (all) OK
INFO - Script pam_faillock_multiple_pam_unix_faillock_conf.fail.sh using profile (all) OK
INFO - Script pam_faillock_expected_faillock_conf.pass.sh using profile (all) OK
INFO - Script pam_faillock_disabled.fail.sh using profile (all) OK

@jan-cerny jan-cerny added this to the 0.1.77 milestone Apr 16, 2025
@jan-cerny jan-cerny self-assigned this Apr 16, 2025
@jan-cerny jan-cerny merged commit 2582908 into ComplianceAsCode:master Apr 16, 2025
98 of 100 checks passed
@mpurg
Copy link
Contributor Author

mpurg commented Apr 16, 2025

@jan-cerny fyi, the accounts_passwords_pam_faillock_deny was not failing before this fix, since it defines both the upper and lower bounds.

I pasted results from the fixed accounts_passwords_pam_faillock_fail_interval tests: #13319 (comment)

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pam_account_password_faillock template tests: in some cases the test should not be created at all
2 participants