-
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
mount_option_remote_systems: make rule not applicable if mounts not found #11761
mount_option_remote_systems: make rule not applicable if mounts not found #11761
Conversation
…for mount_option_remote_filesystems the check will be performed on a rule level instead
🤖 A k8s content image for this PR is available at: Click here to see how to deploy itIf you alread have Compliance Operator deployed: Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and: |
This datastream diff is auto generated by the check Click here to see the full diffOVAL for rule 'xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems' differs.
--- oval:ssg-mount_option_krb_sec_remote_filesystems:def:1
+++ oval:ssg-mount_option_krb_sec_remote_filesystems:def:1
@@ -1,3 +1,2 @@
-criteria XOR
-criterion oval:ssg-test_no_nfs_defined_etc_fstab_sec_krb5_krb5i_krb5p:tst:1
+criteria OR
criterion oval:ssg-test_nfs_sec_krb5_krb5i_krb5p_etc_fstab:tst:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -E "[[:space:]](nfs|nfs4)[[:space:]]" /etc/fstab; }; then
vfstype_points=()
readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}')
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems
@@ -4,7 +4,9 @@
check_mode: false
changed_when: false
failed_when: false
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
tags:
- NIST-800-53-AC-17(a)
- NIST-800-53-CM-6(a)
@@ -29,6 +31,7 @@
opts: '{{ item | regex_search(''OPTIONS="([^"]+)"'',''\1'') | first }},sec=krb5:krb5i:krb5p'
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
- (points_register.stdout | length > 0) and '\\x09' not in item
with_items: '{{ points_register.stdout_lines }}'
tags:
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems'
--- xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_krb_sec_remote_filesystems
@@ -1 +1 @@
-
+oval:ssg-nfs_mount_defined:def:1
OVAL for rule 'xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems' differs.
--- oval:ssg-mount_option_nodev_remote_filesystems:def:1
+++ oval:ssg-mount_option_nodev_remote_filesystems:def:1
@@ -1,3 +1,2 @@
-criteria XOR
-criterion oval:ssg-test_no_nfs_defined_etc_fstab_nodev:tst:1
+criteria OR
criterion oval:ssg-test_nfs_nodev_etc_fstab:tst:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -E "[[:space:]](nfs|nfs4)[[:space:]]" /etc/fstab; }; then
vfstype_points=()
readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}')
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems
@@ -4,7 +4,9 @@
check_mode: false
changed_when: false
failed_when: false
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
tags:
- CCE-84052-0
- DISA-STIG-RHEL-08-010640
@@ -26,6 +28,7 @@
opts: '{{ item | regex_search(''OPTIONS="([^"]+)"'',''\1'') | first }},nodev'
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
- (points_register.stdout | length > 0) and '\\x09' not in item
with_items: '{{ points_register.stdout_lines }}'
tags:
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems'
--- xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_nodev_remote_filesystems
@@ -1 +1 @@
-
+oval:ssg-nfs_mount_defined:def:1
OVAL for rule 'xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems' differs.
--- oval:ssg-mount_option_noexec_remote_filesystems:def:1
+++ oval:ssg-mount_option_noexec_remote_filesystems:def:1
@@ -1,3 +1,2 @@
-criteria XOR
-criterion oval:ssg-test_no_nfs_defined_etc_fstab_noexec:tst:1
+criteria OR
criterion oval:ssg-test_nfs_noexec_etc_fstab:tst:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -E "[[:space:]](nfs|nfs4)[[:space:]]" /etc/fstab; }; then
vfstype_points=()
readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}')
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems
@@ -4,7 +4,9 @@
check_mode: false
changed_when: false
failed_when: false
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
tags:
- CCE-84050-4
- DISA-STIG-RHEL-08-010630
@@ -28,6 +30,7 @@
opts: '{{ item | regex_search(''OPTIONS="([^"]+)"'',''\1'') | first }},noexec'
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
- (points_register.stdout | length > 0) and '\\x09' not in item
with_items: '{{ points_register.stdout_lines }}'
tags:
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems'
--- xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_noexec_remote_filesystems
@@ -1 +1 @@
-
+oval:ssg-nfs_mount_defined:def:1
OVAL for rule 'xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems' differs.
--- oval:ssg-mount_option_nosuid_remote_filesystems:def:1
+++ oval:ssg-mount_option_nosuid_remote_filesystems:def:1
@@ -1,3 +1,2 @@
-criteria XOR
-criterion oval:ssg-test_no_nfs_defined_etc_fstab_nosuid:tst:1
+criteria OR
criterion oval:ssg-test_nfs_nosuid_etc_fstab:tst:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -E "[[:space:]](nfs|nfs4)[[:space:]]" /etc/fstab; }; then
vfstype_points=()
readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}')
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems' differs.
--- xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems
@@ -4,7 +4,9 @@
check_mode: false
changed_when: false
failed_when: false
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
tags:
- CCE-84053-8
- DISA-STIG-RHEL-08-010650
@@ -27,6 +29,7 @@
opts: '{{ item | regex_search(''OPTIONS="([^"]+)"'',''\1'') | first }},nosuid'
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - ansible_mounts|selectattr("fstype", "in", ["nfs", "nfs4"])|list|length > 0
- (points_register.stdout | length > 0) and '\\x09' not in item
with_items: '{{ points_register.stdout_lines }}'
tags:
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems'
--- xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems
+++ xccdf_org.ssgproject.content_rule_mount_option_nosuid_remote_filesystems
@@ -1 +1 @@
-
+oval:ssg-nfs_mount_defined:def:1 |
Code Climate has analyzed commit 94ca4bb 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 59.3% (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.
I have run a scan with the rule mount_option_nodev_remote_filesystems on a system with no NFS mount and the rule has been evaluated as notapplicable.
Description:
Rationale:
Fixes: #11705 #11707
Review Hints: