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 2048571 - oscap can't write to temp files when run as sudo
Summary: oscap can't write to temp files when run as sudo
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: openscap
Version: 9.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 9.0
Assignee: Jan Černý
QA Contact: Matus Marhefka
URL:
Whiteboard:
Depends On:
Blocks: 2047740
TreeView+ depends on / blocked
 
Reported: 2022-01-31 14:25 UTC by Matěj Týč
Modified: 2022-05-17 13:23 UTC (History)
2 users (show)

Fixed In Version: openscap-1.3.6-3.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 13:04:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-110417 0 None None None 2022-01-31 14:27:32 UTC
Red Hat Product Errata RHBA-2022:2449 0 None None None 2022-05-17 13:04:40 UTC

Description Matěj Týč 2022-01-31 14:25:09 UTC
Description of problem:

When oscap is executed with sudo, it can't write reports or ARFs or results if those files already exist and that have been created as temporary files.

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

openscap-1.3.5-13.el9.x86_64

How reproducible:


Steps to Reproduce:
1. run mktemp as a sudo-capable user
2. run a trivial scan, e.g. sudo oscap xccdf eval --report <filename of the newly-created tempfile> /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml
3. watch for OpenSCAP Error: Could not open output file '<tempfile filename>' [/builddir/build/BUILD/openscap-1.3.5/src/source/xslt.c:92]

Actual results:

The temp file remains empty

Expected results:

Temp file is wrote to. Those temp files are technically writable, sudo echo 1234 > tempfile works, of course.

Additional info:

The issue can be reproduced on RHEL9, but not on RHEL8.

Comment 1 Jan Černý 2022-02-01 16:24:35 UTC
Hi, try to set sudo sysctl fs.protected_regular=0. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/MXFHTD6SDBFTLHOFNGWZ3IJIL5D547YV/ could be relevant.

Comment 2 Jan Černý 2022-02-02 15:34:07 UTC
You can continue the discussion also in the upstream PR https://github.com/OpenSCAP/openscap/pull/1845

Comment 4 Jan Černý 2022-02-07 08:03:50 UTC
The pull request https://github.com/OpenSCAP/openscap/pull/1846 has been merged into upstream.

Comment 21 errata-xmlrpc 2022-05-17 13:04:37 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 (new packages: openscap), 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:2449


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