Bug 1496243

Summary: /usr/lib/tmpfiles.d/svnserve.conf fights with RPM package over mode of /run/svnserve
Product: Red Hat Enterprise Linux 7 Reporter: James Ralston <ralston>
Component: subversionAssignee: Joe Orton <jorton>
Status: CLOSED ERRATA QA Contact: Leos Pol <lpol>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subversion-1.7.14-13.el7 Doc Type: Bug Fix
Doc Text:
Cause: The /run/svnserve directory was packaged with different permissions to those specified in the tmpfiles configuration. Consequence: Consequently, "rpm --verify subversion" would fail after each boot. Fix: The permissions of /run/svserve have been changed to 0700, to match the tmpfiles configuration. Result: As a result, "rpm --verify subversion" should now succeed after each boot.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 17:31:32 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:
Attachments:
Description Flags
change subversion.spec file to package /run/svnserve as mode 0700 none

Description James Ralston 2017-09-26 18:39:57 UTC
Description of problem:

The subversion RPM package packages the /run/svnserve directory as user root, group root, mode 0755:

$ rpm -qlv subversion | grep /run/svnserve
drwxr-xr-x    2 root    root                        0 Aug  9 09:35 /run/svnserv

Because on RHEL7 the /run directory is tmpfs and therefore /run/svnserve will disappear at every reboot, the subversion package contributes a /usr/lib/tmpfiles.d/svnserve.conf file that contains:

$ cat /usr/lib/tmpfiles.d/svnserve.conf
D /run/svnserve 0700 root root -

Therefore, systemd-tmpfiles creates /run/svnserve with a mode that disagrees with the RPM package:

$ rpm --verify subversion
.M.......    /run/svnserve

Thus, the Subversion packaging is broken, and should be corrected.

This might not seem like a big deal, but on hosts that are required to comply with the United States Government Defense Information Systems Agency (DISA) Security Technical Implementation Guides (STIGs), when a package's on-disk contents differs in owners, groups, or file modes from what the package database asserts is correct, that is a Category I finding (the most severe finding).

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

subversion-1.7.14-11.el7_4.x86_64

How reproducible:

Running the following commands will demonstrate the problem:

$ yum erase subversion
$ rm -rf /run/svnserve
$ yum install subversion
$ rpm --verify subversion; echo EOF
EOF
$ systemd-tmpfiles --create
$ rpm --verify subversion; echo EOF
.M.......    /run/svnserve
EOF

Actual results:

After systemd-tmpfiles --create runs, it changes the permissions of the /run/svnserve directory to disagree with the subversion RPM package, which rpm --verify will then flag.

Expected results:

systemd-tmpfiles --create should create /run/svnserve with attributes (owner, group, mode) that match the RPM package.

Additional info:

I think the correct thing to do here is to modify the subversion RPM package's SPEC file to package /run/svnserve mode 0700, instead of changing /usr/lib/tmpfiles.d/svnserve.conf to create /run/svnserve as mode 0755.

Because systemd-tmpfiles is already enforcing mode 0700, this would represent no change to the installed subversion package; it would merely align the RPM packaging with the state of the installed package.

Comment 2 Joe Orton 2017-09-26 19:16:57 UTC
Thanks for the report James.  This was fixed in Fedora already, and will be simple to merge.  If this affecting you in production, please file a support request so we can prioritise appropriately.

Comment 3 James Ralston 2017-09-26 19:37:01 UTC
Created attachment 1331224 [details]
change subversion.spec file to package /run/svnserve as mode 0700

Here's literally a one-line patch to the subversion.spec file to package /run/svnserve as mode 0700.

Comment 4 James Ralston 2017-09-26 19:50:50 UTC
(In reply to Joe Orton from comment #2)
> Thanks for the report James.  This was fixed in Fedora already, and will be
> simple to merge.  If this affecting you in production, please file a support
> request so we can prioritise appropriately.

Thanks; I filed a support request for escalation of this BZ.

Since Fedora also chose to resolve the inconsistency to mode 0700, we'll roll our own subversion package for our RHEL7 hosts with my patch until the official fix appears for RHEL7. (Hopefully that doesn't have to wait for 7.5)

Comment 8 Leos Pol 2018-01-23 15:08:49 UTC
$ rpm -q subversion
subversion-1.7.14-11.el7_4.x86_64
$ reboot
$ rpm -V subversion
.M.......    /run/svnserve
$ stat /run/svnserve
  File: ‘/run/svnserve’
  Size: 40        	Blocks: 0          IO Block: 4096   directory
Device: 14h/20d	Inode: 12860       Links: 2
Access: (0700/drwx------)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:svnserve_var_run_t:s0
Access: 2018-01-23 10:04:04.277000000 -0500
Modify: 2018-01-23 10:04:04.277000000 -0500
Change: 2018-01-23 10:04:04.277000000 -0500
 Birth: -

$ rpm -q subversion
subversion-1.7.14-14.el7.x86_64
$ reboot
$ rpm -V subversion
$ stat /run/svnserve
  File: ‘/run/svnserve’
  Size: 40        	Blocks: 0          IO Block: 4096   directory
Device: 14h/20d	Inode: 12817       Links: 2
Access: (0700/drwx------)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:svnserve_var_run_t:s0
Access: 2018-01-23 10:04:05.189000000 -0500
Modify: 2018-01-23 10:04:05.189000000 -0500
Change: 2018-01-23 10:04:05.189000000 -0500
 Birth: -

Comment 11 errata-xmlrpc 2018-04-10 17:31:32 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/RHEA-2018:0938