RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1387248 - oscap-docker incorrectly informs about incompliance of the assessed system
Summary: oscap-docker incorrectly informs about incompliance of the assessed system
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openscap
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Raphael Sanchez Prudencio
QA Contact: Matus Marhefka
Mirek Jahoda
URL:
Whiteboard:
Depends On:
Blocks: 1410409
TreeView+ depends on / blocked
 
Reported: 2016-10-20 12:46 UTC by Matus Marhefka
Modified: 2020-04-15 14:45 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
In a case of a successful scan of an incompliant system, the oscap-docker command-line utility incorrectly reported an error. With this update, oscap-docker correctly assesses incompliant systems and prints which rules did not pass the scan to the evaluation results.
Clone Of:
: 1410409 (view as bug list)
Environment:
Last Closed: 2017-08-01 08:45:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github OpenSCAP openscap issues 475 0 None None None 2016-10-20 12:53:41 UTC
Red Hat Product Errata RHBA-2017:2291 0 normal SHIPPED_LIVE openscap bug fix update 2017-08-01 12:38:59 UTC

Description Matus Marhefka 2016-10-20 12:46:43 UTC
Description of problem:
Compliance scan of a Docker image/container using oscap-docker reports incorrectly that there was an error even if scan was successful but incompliance of the assessed system was found.

==========
$ oscap-docker image rhel7 xccdf eval --profile standard /usr/share/xml/scap/ssg/content/ssg-rhel7-xccdf.xml
WARNING: Skipping http://www.redhat.com/security/data/oval/Red_Hat_Enterprise_Linux_7.xml file which is referenced from XCCDF content

Command: oscap xccdf eval --profile standard /usr/share/xml/scap/ssg/content/ssg-rhel7-xccdf.xml failed!

Error was:

Command '['oscap', 'xccdf', 'eval', '--profile', 'standard', '/usr/share/xml/scap/ssg/content/ssg-rhel7-xccdf.xml']' returned non-zero exit status 2
==========

It is an issue in oscap-docker script when processing exit status of oscap which is according to oscap(8) man page:
Normally, the exit status is 0 when operation finished successfully and 1 otherwise. In cases when oscap performs evaluation of the system it may return 2 indicating success of the operation but incompliance of the assessed system.

Also, in case of incompliance, oscap-docker should print the evaluation results to pinpoint which rules did not pass the scan.


Version-Release number of selected component (if applicable):
openscap-utils-1.2.10-2.el7
scap-security-guide-0.1.30-3.el7


How reproducible:
always


Steps to Reproduce:
1. Run:
$ oscap-docker image rhel7 xccdf eval --profile standard /usr/share/xml/scap/ssg/content/ssg-rhel7-xccdf.xml


Actual results:
oscap-docker reports incorrectly that there was an error even if scan was successful but incompliance of the assessed system was found.

Expected results:
oscap-docker reports that scan was successful but incompliance of the assessed system was found. It will also print the evaluation results to pinpoint which rules did not pass the scan.


Additional info:

Comment 1 Matus Marhefka 2016-10-20 12:48:46 UTC
Also reported upstream.

Comment 4 Shawn Wells 2016-11-21 16:29:33 UTC
Since this is a bug, will RHEL 7.3 errata be released (vs waiting for 7.4)?

Comment 10 Matus Marhefka 2017-04-26 12:26:55 UTC
VERIFIED as fixed for openscap-utils-1.2.14-1.el7

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test: Scan a docker image
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   PASS   ] :: Command 'oscap-docker image rhel7:7.2 xccdf eval --profile xccdf_test_profile_failing --report ./report.html --results-arf ./results_arf.xml --results ./results.xml /mnt/tests/CoreOS/openscap/Sanity/oscap-docker/simple-xccdf.xml > ./output.stdout 2> ./output.stderr' (Expected 0, got 0)
:: [   PASS   ] :: File ./results.xml should exist 
:: [   PASS   ] :: Command 'file -b './results.xml' | grep '^XML' --quiet' (Expected 0, got 0)
:: [   PASS   ] :: File ./results_arf.xml should exist 
:: [   PASS   ] :: Command 'file -b './results_arf.xml' | grep '^XML' --quiet' (Expected 0, got 0)
:: [   PASS   ] :: File ./report.html should exist 
:: [   PASS   ] :: Command 'grep -q '<!DOCTYPE[^>]*html[^>]*>' './report.html'' (Expected 0, got 0)
:: [   PASS   ] :: File './output.stderr' should not contain '.' 
:: [   PASS   ] :: File './output.stdout' should contain 'elpmaxe.www_rule_2' 
:: [   PASS   ] :: File './output.stdout' should contain '^Result.*fail$'

Comment 11 errata-xmlrpc 2017-08-01 08:45:48 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, 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-2017:2291


Note You need to log in before you can comment on or make changes to this bug.