Bug 1258958

Summary: openscap-1.0.* does not seem to be able to produce the HTML report when evaluating OVAL document directly
Product: Red Hat Enterprise Linux 6 Reporter: Jan Lieskovsky <jlieskov>
Component: openscapAssignee: Šimon Lukašík <slukasik>
Status: CLOSED ERRATA QA Contact: Marek Haicman <mhaicman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: mhaicman, openscap-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openscap-1.2.7-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1303680 (view as bug list) Environment:
Last Closed: 2016-05-10 20:53:26 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: 1303680    

Description Jan Lieskovsky 2015-09-01 15:27:19 UTC
Description of problem:

From the oscap(8) manual page:
"..
OVAL OPERATIONS
       eval [options] INPUT_FILE
              Probe the system and evaluate all definitions from OVAL 
              Definition file. Print result of each definition to standard
              output. The  return code is 0 after a  successful evaluation.
              On error, value 1 is returned.

              INPUT_FILE can be either OVAL Definition File or SCAP Source
              Datastream, it depends on used options.

              Unless  --skip-valid  is  used, the INPUT_FILE is validated
              using XSD schemas (depending on document type of INPUT_FILE)
              and rejected if invalid.

              --id DEFINITION-ID
                     Evaluate ONLY specified OVAL Definition from OVAL
                     Definition File.

              --variables FILE
                     Provide external variables expected by OVAL Definition
                     File.

              --directives FILE
                     Use OVAL Directives content to specify desired results
                     content.

              --results FILE
                     Write OVAL Results into file.

              --report FILE
                     Create human readable (HTML) report from OVAL Results.

              --datastream-id ID
                     Uses a datastream with that particular ID from the given
                     datastream collection. If not given the first datastream
                     is used.  Only applies if you give source datastream in
                     place of an OVAL file.

              --oval-id ID
                     Takes  component ref with given ID from checks. This
                     allows to select a particular OVAL component even in
                     cases where there are 2 OVALs in one datastream.

              --skip-valid
                     Do not validate input/output files.
"

The above description suggests running oscap command like the following:

  oscap oval eval --report /tmp/report.html input_oval.xml

should generate HTML report document of the OVAL scan located in the /tmp directory.


Version-Release number of selected component (if applicable):
openscap-1.0.10-3.el6.x86_64


How reproducible:
Always

Steps to Reproduce:
1. [root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.7 (Santiago)
2. [root@localhost ~]# rpm -q openscap
openscap-1.0.10-3.el6.x86_64
3. [root@localhost ~]# wget -q https://www.redhat.com/security/data/oval/Red_Hat_Enterprise_Linux_6.xml
4. [root@localhost ~]# oscap oval eval --report /tmp/report.html Red_Hat_Enterprise_Linux_6.xml 
Definition oval:com.redhat.rhsa:def:20151700: false
..
Evaluation done.
[root@localhost ~]# 


Actual results:
HTML report of the OVAL scan is not created when requested just HTML file without intermediate XML results file:

[root@localhost ~]# file /tmp/report.html
/tmp/report.html: cannot open `/tmp/report.html' (No such file or directory)

Expected results:
HTML report file of the OVAL system scan file created also without specifying the intermediary XML results file.

Or manual page is updated to reflect this situation (that XML file with OVAL results need to be created first, and OVAL HTML report file can be created only subsequently from the results file).

Additional info:

Creating OVAL HTML report file from intermediary XML results file works fine:

[root@localhost ~]# oscap oval eval --results /tmp/results.xml Red_Hat_Enterprise_Linux_6.xml > /dev/null
[root@localhost ~]# echo $?
0
[root@localhost ~]# oscap oval generate report /tmp/results.xml > /tmp/report.html
[root@localhost ~]# echo $?
0
[root@localhost ~]# file /tmp/report.html 
/tmp/report.html: xHTML document text

Comment 1 Šimon Lukašík 2015-09-02 08:09:47 UTC
Thanks for report.

 - Not a regression.
 - Easy workaround: (use `--results /tmp/testresult.xccdf.xml` )
 - Recently fixed in upstream at https://github.com/OpenSCAP/openscap/commit/42895cc157905036b0c7e11772fa9e9cbabb3f30

Will not be fixed in 1.0.x line. Will be fixed if the rebase bug 1259037 gets approved.

Comment 3 Marek Haicman 2016-02-01 17:01:07 UTC
Verified fix in version openscap-1.2.8-1.el6

Comment 5 errata-xmlrpc 2016-05-10 20:53:26 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://rhn.redhat.com/errata/RHEA-2016-0806.html