Bug 1970529

Summary: oscap complains about missing resources even though they were downloaded locally
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: openscapAssignee: Jan Černý <jcerny>
Status: CLOSED ERRATA QA Contact: Matus Marhefka <mmarhefk>
Severity: low Docs Contact: Jan Fiala <jafiala>
Priority: low    
Version: 8.4CC: amusil, ekolesni, gfialova, jafiala, jcerny, mhaicman, mperina, pandrade
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openscap-1.3.5-10.el8 Doc Type: Enhancement
Doc Text:
.OpenSCAP can read local files OpenSCAP can now consume local files instead of remote SCAP source data stream components. Previously, you could not perform a complete evaluation of SCAP source data streams containing remote components on systems that have no internet access. On these systems, OpenSCAP could not evaluate some of the rules in these data streams because the remote components needed to be downloaded from the internet. With this update, you can download and copy the remote SCAP source data stream components to the target system before performing the OpenSCAP scan and provide them to OpenSCAP by using the `--local-files` option with the `oscap` command.
Story Points: ---
Clone Of:
: 2015518 (view as bug list) Environment:
Last Closed: 2022-05-10 13:50:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2015518, 2015802, 2030226, 2030596    

Description Renaud Métrich 2021-06-10 16:12:16 UTC
This bug was initially created as a copy of Bug #1970527

I am copying this bug because: 

Also applies, the difference being it doesn't complain bout using the local file anymore, but still the first warning is confusing:


With no local file:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
WARNING: Datastream component 'scap_org.open-scap_cref_security-data-oval-com.redhat.rhsa-RHEL8.xml' points out to the remote 'https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml'. Use '--fetch-remote-resources' option to download it.
WARNING: Skipping 'https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml' file which is referenced from datastream
WARNING: Skipping ./security-data-oval-com.redhat.rhsa-RHEL8.xml file which is referenced from XCCDF content
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

With local file:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
WARNING: Datastream component 'scap_org.open-scap_cref_security-data-oval-com.redhat.rhsa-RHEL8.xml' points out to the remote 'https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml'. Use '--fetch-remote-resources' option to download it.
WARNING: Skipping 'https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml' file which is referenced from datastream
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Description of problem:

When scanning offline systems, the resources have to be downloaded locally (explained in KCS https://access.redhat.com/solutions/5185891).
Unfortunately the scan continues to complain badly with the "WARNING: Skipping ..." messages, which is extremely confusing (hence the Severity High here).

I understand a message should pop up because there is no way to know the validity of the file, but the message should be different, something like "WARNING: Using local resource XXX.xml file, make sure the file is up-to-date".


Version-Release number of selected component (if applicable):

openscap-1.2.17-13.el7_9.x86_64 and later


How reproducible:

N/A

Comment 1 Jan Černý 2021-07-29 06:49:01 UTC
The fix has been promoted to a documented feature and it has been merged into upstrem, see https://github.com/OpenSCAP/openscap/pull/1769

Comment 2 Jan Černý 2021-08-05 10:41:14 UTC
Note for person who will fix the bug in RHEL: Please don't forget about https://github.com/OpenSCAP/openscap/pull/1786

Comment 3 Jan Černý 2021-08-05 11:24:34 UTC
I'm changing priority and severity to low because I think it's an user experience problem and it doesn't mean that the user isn't able to run the scan.

Comment 4 Paulo Andrade 2021-09-21 16:00:04 UTC
  Even after downloading the remote files, because openscap cannot
know if the files are up to date, the warning is still printed.

  There is a problem with ansible, because the messages are still
printed to stderr, and it treats it as an error. Workaround is to
use ansible with 'ignore_errors: true' what does not look ideal.

  Might need to clone and reassign this bug to use alternate options
https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html

Comment 6 Matus Marhefka 2021-10-26 15:51:56 UTC
@jcerny: What about updating https://github.com/OpenSCAP/openscap/blob/maint-1.3/src/DS/sds.c#L410 to not print only in the verbose mode, but rather print it as a warning to the user?

Comment 7 Jan Černý 2021-11-09 08:23:59 UTC
Ad Comment 6: https://github.com/OpenSCAP/openscap/pull/1826

Comment 15 Jan Černý 2021-11-29 10:24:06 UTC
*** Bug 2027259 has been marked as a duplicate of this bug. ***

Comment 23 errata-xmlrpc 2022-05-10 13:50:09 UTC
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 (openscap bug fix and enhancement update), 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-2022:1844