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 1803116 - oscap-ssh fails to retrieve the result files when --sudo is used
Summary: oscap-ssh fails to retrieve the result files when --sudo is used
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: openscap
Version: 8.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: Jan Černý
QA Contact: Matus Marhefka
Jan Fiala
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-14 14:14 UTC by Renaud Métrich
Modified: 2023-09-07 21:52 UTC (History)
5 users (show)

Fixed In Version: openscap-1.3.2-7.el8
Doc Type: Bug Fix
Doc Text:
.The `oscap-ssh` utility now works correctly when scanning a remote system with --sudo When performing a Security Content Automation Protocol (SCAP) scan of a remote system using the `oscap-ssh` tool with the `--sudo` option, the `oscap` tool on the remote system saves scan result files and report files into a temporary directory as the `root` user. Previously, if the `umask` settings on the remote machine were changed, `oscap-ssh` might have been prevented access to these files. This update fixes the issue, and as a result, `oscap` saves the files as the target user, and `oscap-ssh` accesses the files normally.
Clone Of:
Environment:
Last Closed: 2020-11-04 02:29:43 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github OpenSCAP openscap pull 1481 0 None closed Fixed oscap-ssh failing to retrieve the result files when executing with --sudo 2020-12-18 14:41:44 UTC
Red Hat Knowledge Base (Solution) 4831831 0 None None None 2020-02-17 08:08:01 UTC
Red Hat Product Errata RHBA-2020:4623 0 None None None 2020-11-04 02:29:57 UTC

Description Renaud Métrich 2020-02-14 14:14:11 UTC
This bug was initially created as a copy of Bug #1803114

I am copying this bug because: 

Also applies

Description of problem:

Depending on the umask configuration of the target system, "sudo oscap"
may create the result files in temporary directory with 600 permissions,
which makes retrieving the log (as the regular user that ssh'ed to the
system) impossible:

$ oscap-ssh --sudo user@system 22 xccdf eval ...
[...]
oscap exit code: 0
Copying back requested files...
scp: /tmp/tmp.0kfbPWEy6u/report.html: Permission denied
Failed to copy the HTML report back to local machine!


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

All openscap packages, including Upstream


How reproducible:

Always


Steps to Reproduce:
1. Set a default umask in /etc/sudoers:

Defaults	umask = 0077

2. Run oscap-ssh

$ oscap-ssh --sudo rmetrich@vm-rhel7 22 xccdf eval --rule xccdf_org.ssgproject.content_rule_ensure_gpgcheck_globally_activated --profile xccdf_org.ssgproject.content_profile_pci-dss --report report.html /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml

Actual results:

Failure to retrieve the result

Expected results:

Result being retrieved.

Additional info:

Issue applies Upstream. See PR https://github.com/OpenSCAP/openscap/pull/1481

Comment 1 Jan Černý 2020-02-20 09:21:28 UTC
Fixed upstream in https://github.com/OpenSCAP/openscap/pull/1485/files

Comment 15 Jan Fiala 2020-07-27 07:32:33 UTC
Thanks Matus. I checked the doc text and now it looks good to me.

Comment 19 errata-xmlrpc 2020-11-04 02:29:43 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-2020:4623


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