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 2126882 - openscap errors when OVAL object component in a variable doesn't collect any data
Summary: openscap errors when OVAL object component in a variable doesn't collect any ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: openscap
Version: 8.7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Černý
QA Contact: Matus Marhefka
URL:
Whiteboard:
Depends On:
Blocks: 2089955 2126883 2171824
TreeView+ depends on / blocked
 
Reported: 2022-09-14 16:18 UTC by Matus Marhefka
Modified: 2023-05-16 10:08 UTC (History)
4 users (show)

Fixed In Version: openscap-1.3.7-1.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2126883 2171824 (view as bug list)
Environment:
Last Closed: 2023-05-16 08:41:34 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
easy reproducer (1.49 KB, application/gzip)
2023-01-11 08:36 UTC, Jan Černý
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-133977 0 None None None 2022-09-14 16:33:15 UTC
Red Hat Product Errata RHBA-2023:2892 0 None None None 2023-05-16 08:41:45 UTC

Description Matus Marhefka 2022-09-14 16:18:14 UTC
Description of problem:
openscap prints error when evaluating oval:ssg-file_permissions_sshd_private_key:def:1 OVAL definition and openssh-server RPM is not installed on the filesystem (no ssh_keys in /etc/group).

Version-Release number of selected component (if applicable):
openscap-1.3.6-4.el8
scap-security-guide-0.1.63-4.el8.noarch


How reproducible:
always


Steps to Reproduce:
Create a minimal chroot filesystem:
# mkdir -p /chroot_dir/var/lib/rpm
# rpm --root /chroot_dir --initdb
# dnf -y --disablerepo=* --enablerepo=rhel --enablerepo=rhel-AppStream --installroot=/chroot_dir install redhat-release filesystem yum rpm bash coreutils util-linux

# oscap-chroot /chroot_dir oval eval --id oval:ssg-file_permissions_sshd_private_key:def:1 /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
E: oscap:     Failed to convert OVAL state to SEXP, id: oval:ssg-filter_ssh_key_owner_ssh_keys:ste:1.
Definition oval:ssg-file_permissions_sshd_private_key:def:1: true
Evaluation done.

In case openssh-server RPM is installed into the chroot directory the error does not occur as there is ssh_keys in /etc/group:
# grep ssh_keys /chroot_dir/etc/group
ssh_keys:x:996:


Actual results:
Error is printed by openscap when evaluating oval:ssg-file_permissions_sshd_private_key:def:1 OVAL definition and openssh-server RPM is not installed on the filesystem (no ssh_keys in /etc/group).


Expected results:
No error


Additional info:

Comment 1 Jan Černý 2022-09-15 08:52:30 UTC
Successfully reproduced on RHEL 8.

In verbose mode, we can see: Referenced variable has no values (oval:ssg-group_gid:var:1).

Analysis:
- We need to create a minimal reproducer OVAL that doesn't require the chroot to trigger the problem.
- The key is that the state references a variable in on of the state entities and this variable is empty because the underlying object does not exist.

Comment 2 Jan Černý 2023-01-11 08:36:57 UTC
Created attachment 1937258 [details]
easy reproducer

I have created a minimal reproducer and I have attached the reproducer as an attachment.

This reproducer doesn't depend on presence of ssh package and doesn't require using any chroot and doesn't require installing anything. It consists of a simple OVAL file and a short bash script that creates a directory with 2 files in /tmp. Then, it runs the `oscap oval eval` with that OVAL file.

The main point of the reproducer OVAL is to showcase the situation that triggers the error message "Failed to convert OVAL state to SEXP". The OVAL has been inspired by OVAL for the rule file_permissions_sshd_private_key from scap-security-guide, however it's simpler.

The OVAL construction that triggers the error is the following: We have an OVAL <object>, this object contains a <filter> that is specified by a <state>. This <state> in one of its child elements references a <local_variable>. This <local_variable> references a second <object>. The error happens if the second <object> describes an entity that doesn't exist on the system.

Therefore, this bug is generic and it's a bug in processing of any <filter> elements that reference variables.

Comment 3 Jan Černý 2023-01-11 13:34:44 UTC
a draft PR has been opened in upstream: https://github.com/OpenSCAP/openscap/pull/1916

Comment 4 Jan Černý 2023-01-23 15:10:13 UTC
a fix has been merged to upstream https://github.com/OpenSCAP/openscap/pull/1916

Comment 14 errata-xmlrpc 2023-05-16 08:41:34 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-2023:2892


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