-
Notifications
You must be signed in to change notification settings - Fork 685
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
package_pam_pwquality_installed: depend on pam being installed #10306
package_pam_pwquality_installed: depend on pam being installed #10306
Conversation
package_pam_pwquality_installed only makes sense if pam is installed, so it should express that with "platform: package[pam]" as other rules (such as accounts_password_pam_unix_remember) already do. Signed-off-by: Craig Andrews <candrews@integralblue.com>
Hi @candrews. 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 Once the patch is verified, the new status will be reflected by the 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. |
This datastream diff is auto generated by the check Click here to see the full diffbash remediation for rule 'xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed' differs.
--- xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed
+++ xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed
@@ -1,4 +1,10 @@
+# Remediation is applicable only in certain platforms
+if rpm --quiet -q pam; then
if ! rpm -q --quiet "libpwquality" ; then
yum install -y "libpwquality"
fi
+
+else
+ >&2 echo 'Remediation is not applicable, nothing was done'
+fi
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed' differs.
--- xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed
+++ xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed
@@ -1,7 +1,6 @@
-- name: Ensure libpwquality is installed
- package:
- name: libpwquality
- state: present
+- name: Gather the package facts
+ package_facts:
+ manager: auto
tags:
- enable_strategy
- low_complexity
@@ -9,3 +8,16 @@
- medium_severity
- no_reboot_needed
- package_pam_pwquality_installed
+
+- name: Ensure libpwquality is installed
+ package:
+ name: libpwquality
+ state: present
+ when: '"pam" in ansible_facts.packages'
+ tags:
+ - enable_strategy
+ - low_complexity
+ - low_disruption
+ - medium_severity
+ - no_reboot_needed
+ - package_pam_pwquality_installed
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed'
--- xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed
+++ xccdf_org.ssgproject.content_rule_package_pam_pwquality_installed
@@ -1 +1 @@
-
+cpe:/a:pam: |
Code Climate has analyzed commit 8278be2 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 51.7% (0.0% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Description:
package_pam_pwquality_installed: depend on pam being installed
Rationale:
package_pam_pwquality_installed only makes sense if pam is installed, so it should express that with "platform: package[pam]" as other rules (such as accounts_password_pam_unix_remember) already do.
Review Hints:
With this change applied,
oscap-podman ubuntu:20.04 xccdf eval --report report.html --profile xccdf_org.ssgproject.content_profile_stig /usr/share/xml/scap/ssg/content/ssg-ubuntu2004-ds.xml
should yield a report indicating that the "Install pam_pwquality Package" rule is "Not Applicable"