Hide Forgot
Description of problem: First remediate the rhel7 base image: # atomic scan --remediate --scan_type configuration_compliance --scanner_args profile=xccdf_org.ssgproject.content_profile_stig-rhel7-disa registry.access.stage.redhat.com/rhel7:latest [...] Successfully built remediated image 08ec9b3c2929 from 738c5a2d67834010f86019fe17d6c8d0ff20e4f9aef4d141c09eaeaebecc9e90. Now scan the remediated image using atomic scan and oscap-docker and check the result of the "Verify and Correct File Permissions with RPM" rule: # atomic scan --scan_type configuration_compliance --scanner_args profile=xccdf_org.ssgproject.content_profile_stig-rhel7-disa 08ec9b3c2929 &>atomic.log # grep "Verify and Correct File Permissions with RPM" atomic.log -A2 Verify and Correct File Permissions with RPM Severity: Important XCCDF result: fail # oscap-docker image 08ec9b3c2929 xccdf eval --rule xccdf_org.ssgproject.content_rule_rpm_verify_permissions --profile xccdf_org.ssgproject.content_profile_stig-rhel7-disa ssg-rhel7-ds.xml (NOTE: ssg-rhel7-ds.xml is a datastream file from the openscap-docker image and is from scap-security-guide-0.1.36-7.el7.noarch) Title Verify and Correct File Permissions with RPM Rule xccdf_org.ssgproject.content_rule_rpm_verify_permissions Ident CCE-27209-6 Result pass The results are the same when also scanning original (non-remediated) image. In case of oscap-docker (so oscap-chroot) it looks like the probe itself is looking on the host FS instead of the image one: # chmod 0777 / # oscap-docker image 08ec9b3c2929 xccdf eval --rule xccdf_org.ssgproject.content_rule_rpm_verify_permissions --profile xccdf_org.ssgproject.content_profile_stig-rhel7-disa ssg-rhel7-ds.xml Title Verify and Correct File Permissions with RPM Rule xccdf_org.ssgproject.content_rule_rpm_verify_permissions Ident CCE-27209-6 Result fail Version-Release number of selected component (if applicable): openscap-docker-7.5.0-3 openscap-1.2.16-6.el7 scap-security-guide-0.1.36-7.el7 How reproducible: always
The original description is only a consequence of the issue. Each of the probes rpminfo, rpmverify and rpmverifyfile use their own chroot mode and utilize the rpm file iterator library. When a probe does initialization it calls rpmfiNew() function which should set chroot directory for file iterations. Unfortunately this is not supported in the rpm file iterator library itself. This means that all the file iterations are performed on the host system instead of the chroot-ed directory. The consequence is that scanning in offline mode does not work for all the rules which utilize these probes for checking RPM package files in chroot-ed directories. Therefore, all the "RPM.*verify" rules are not working correctly when scanning VM or container filesystems and report incorrect results. Version-Release number of selected component (if applicable): openscap-docker-7.5.0-3 openscap-1.2.16-6.el7
Confirmed rules which are affected by this: * Verify and Correct File Permissions with RPM (xccdf_org.ssgproject.content_rule_rpm_verify_permissions) * Verify and Correct Ownership with RPM (xccdf_org.ssgproject.content_rule_rpm_verify_ownership) * Verify File Hashes with RPM (xccdf_org.ssgproject.content_rule_rpm_verify_hashes)
We need to revert the following commit: https://github.com/OpenSCAP/openscap/commit/f540c055e9bda6b6168746df2017ee7e2b871323
Upstream fix posted: https://github.com/OpenSCAP/openscap/pull/1002 Because the fix is extensive for the purposes of the zstream fix we will revert back to using chroot for textfilecontent probe. Therefore only the first commit of the posted upstream fix will be used.
(In reply to Martin Preisler from comment #9) > Upstream fix posted: https://github.com/OpenSCAP/openscap/pull/1002 > > Because the fix is extensive for the purposes of the zstream fix we will > revert back to using chroot for textfilecontent probe. Therefore only the > first commit of the posted upstream fix will be used. I got confused and this is a related fix but not a fix to this BZ. This BZ still needs an upstream fix posted.
Created attachment 1423654 [details] patch to use chroot for rpm probes
Since the upstream code is a bit different I have created a slightly different patch for upstream to make sure this is fixed in future upstream versions of the project. See https://github.com/OpenSCAP/openscap/pull/1013
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3302