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 1702488 - python-twisted-core expected file permissions in package don't match final runtime permissions
Summary: python-twisted-core expected file permissions in package don't match final ru...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-twisted-core
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Lumír Balhar
QA Contact: Dita Stehlikova
URL:
Whiteboard:
Depends On:
Blocks: 1716961
TreeView+ depends on / blocked
 
Reported: 2019-04-23 22:23 UTC by Ryan Mullett
Modified: 2023-09-07 19:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Different file permissions in RPM and runtime for /usr/lib64/python2.7/site-packages/twisted/plugins/dropin.cache Consequence: STIG audit might fail Fix: Fixed permissions in RPM Result: Problem fixed
Clone Of:
Environment:
Last Closed: 2020-03-31 19:47:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1065 0 None None None 2020-03-31 19:47:09 UTC

Description Ryan Mullett 2019-04-23 22:23:38 UTC
Description of problem:
File permissions from the rpm do not match the runtime permissions on several files. This results in mode failures on rpm -Va. Most noticed on systems in which DISA STIG is being performed and file permissions should not be less than the rpm provides or it is considered a finding during an audit. Important for government users and contractors who will be performing DISA STIG. 

Version-Release number of selected component (if applicable):
python-twisted-core-12.2.0-4.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. # yum install python-twisted-core
2. # rpm -V python-twisted-core (or scan with openscap using DISA STIG, which will perform an rpm -Va)

Actual results:
The following files have permissions that are more permissive than the rpm provides:

/usr/lib64/python2.7/site-packages/twisted/plugins/dropin.cache

Expected results:
The file permissions provided via rpm should match the final runtime permissions (or they should be less restrictive on the rpm than the runtime permissions, which would not result in a finding).

Additional info:
The following output shows what it "should be" according to the rpm, as well as what it "actually is" after the package has been installed. This could be resolved by using the proper permissions in the spec file, so that rpm -Va will not flag on these files, or the actual source files could have permissions changed to match what they are after installation. 

From rpm: python-twisted-core-12.2.0-4.el7.x86_64
/usr/lib64/python2.7/site-packages/twisted/plugins/dropin.cache
SHOULD BE:  644
ACTUALLY IS:  755

Comment 2 Lumír Balhar 2019-06-03 09:39:02 UTC
The file /usr/lib64/python2.7/site-packages/twisted/plugins/dropin.cache is in RPM created by touch and has permissions 644 but the same file is regenerated in %post section with 755 permissions. That's the reason why there are different permissions set in RPM package and after its installation.

Assuming that the permissions are set correctly by the script in %post section (because it uses Twisted internals), I've created a patch to change permissions to the same level for the empty file after it's created in %install phase.

This bug can be easily fixed for RHEL 7.8.

https://src.osci.redhat.com/fork/lbalhar/rpms/python-twisted-core/c/3936407f993cca5099c25298fb60b222c4d30816?branch=rhel-7.7

Comment 3 Lumír Balhar 2019-06-03 09:41:04 UTC
Scratch build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=21959000

I did a test with reproducer after an upgrade and also fresh install and both look good.

Comment 7 Honza Horak 2019-08-13 14:47:37 UTC
Just from curiosity, the file permissions can be also set in the %files section:

-%ghost %{python_sitearch}/twisted/plugins/dropin.cache
+%attr(0755,root,root) %ghost %{python_sitearch}/twisted/plugins/dropin.cache

Not sure whether there is a real difference in the result, when done it in %install section.

Anyway, it would be better to have a comment in the spec why the special permissions are needed.

Comment 8 Lumír Balhar 2019-08-13 19:02:03 UTC
(In reply to Honza Horak from comment #7)
> Just from curiosity, the file permissions can be also set in the %files
> section:
> 
> -%ghost %{python_sitearch}/twisted/plugins/dropin.cache
> +%attr(0755,root,root) %ghost %{python_sitearch}/twisted/plugins/dropin.cache
> 
> Not sure whether there is a real difference in the result, when done it in
> %install section.

I didn't know about this. %attr solution might look cleaner but the classic chmod solution is also pretty common.

> Anyway, it would be better to have a comment in the spec why the special
> permissions are needed.

The comment is there. Do you think it might seem incomplete? https://src.osci.redhat.com/rpms/python-twisted-core/blob/rhel-7.8/f/python-twisted-core.spec#_91

I don't think that any kind of special test is needed here because the problem was discovered by `rpm -V`. It might make sense to check all RPMs with that command? Lukáši, what do you mean about it?

Comment 11 errata-xmlrpc 2020-03-31 19:47:06 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://access.redhat.com/errata/RHBA-2020:1065


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