Bug 2126883

Summary: openscap errors when OVAL object component in a variable doesn't collect any data
Product: Red Hat Enterprise Linux 9 Reporter: Matus Marhefka <mmarhefk>
Component: openscapAssignee: Jan Černý <jcerny>
Status: CLOSED ERRATA QA Contact: Matus Marhefka <mmarhefk>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: dapospis, ekolesni, jcerny, mhaicman, mmarhefk, qe-baseos-security
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openscap-1.3.7-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 2126882 Environment:
Last Closed: 2023-05-09 07:52:53 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: 2126882, 2171824    
Bug Blocks: 2091421    
Deadline: 2023-02-13   

Description Matus Marhefka 2022-09-14 16:24:02 UTC
+++ This bug was initially created as a clone of Bug #2126882 +++

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.el9
scap-security-guide-0.1.63-5.el9.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-rhel9-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 2 Jan Černý 2023-01-23 15:11:26 UTC
a fix has been merged to upstream https://github.com/OpenSCAP/openscap/pull/1916

Comment 10 errata-xmlrpc 2023-05-09 07:52:53 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:2391