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 1296288 - tmpfiles: don't follow symlinks when adjusting ACLs, fille attributes…
Summary: tmpfiles: don't follow symlinks when adjusting ACLs, fille attributes…
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: Branislav Blaškovič
URL:
Whiteboard:
Depends On:
Blocks: 1203710 1289485 1313485 1559762 1559765
TreeView+ depends on / blocked
 
Reported: 2016-01-06 19:42 UTC by Robert Scheck
Modified: 2019-12-16 05:15 UTC (History)
7 users (show)

Fixed In Version: systemd-219-21.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1559762 (view as bug list)
Environment:
Last Closed: 2016-11-04 00:50:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2216 0 normal SHIPPED_LIVE systemd bug fix and enhancement update 2016-11-03 13:24:51 UTC

Description Robert Scheck 2016-01-06 19:42:47 UTC
Description of problem:
systemd-tmpfiles doesn't create symlinks with correct ownership but always
with root, example:

/usr/lib/tmpfiles.d/mimedefang.conf contains the line:

L+ /var/spool/MIMEDefang/.razor/razor-agent.log - defang defang - /dev/null

The result however is, that /var/spool/MIMEDefang/.razor/razor-agent.log is
owned by root:root rather defang:defang. So it feels like the needed "chown 
--no-dereference defang:defang" is not performed by systemd-tmpfiles, which
I believe is a bug (because I was unable in the documentation of systemd to
find a pointer which says that different ownership is not allowed).

Version-Release number of selected component (if applicable):
systemd-219-19.el7
mimedefang-2.78-5.el7

Actual results:
L+ /var/spool/MIMEDefang/.razor/razor-agent.log - defang defang - /dev/null
leads to root:root owned symlink.

Expected results:
L+ /var/spool/MIMEDefang/.razor/razor-agent.log - defang defang - /dev/null
should lead to defang:defang owned symlink.

Comment 1 Robert Scheck 2016-01-06 19:45:44 UTC
Cross-filed case 01562812 on the Red Hat customer portal.

Comment 3 Lukáš Nykrýn 2016-01-07 16:16:44 UTC
Why so you want to change the owner of the symlink? Even normal chown follows the symlinks and does not change the permission of it.

This behavior is expected:
https://github.com/systemd/systemd/blob/master/src/tmpfiles/tmpfiles.c#L626

Comment 4 Lukáš Nykrýn 2016-01-07 16:21:58 UTC
In systemd in rhal we don't have that check, so we might end chowning the target.

So we should backport https://github.com/systemd/systemd/commit/48b8aaa82724bc2d8440470f414fb0d2416f29c7

Comment 5 Robert Scheck 2016-01-07 17:16:22 UTC
If I'm able to specify permissions for L+, my personal expectation is that
these permissions are applied to the symlink, not to the target. And given
the second commit, it doesn't seem to be really that much expected (for the
target). But what sense does it make to be able to specific access mode and 
ownership for a symlink, if it does not get applied at all (second commit)?

Comment 6 Robert Scheck 2016-01-07 17:39:08 UTC
From what I can see, Z follows symlinks (even the documentation at
http://www.freedesktop.org/software/systemd/man/tmpfiles.d.html says
different). Having:

Z /var/spool/MIMEDefang 0750 defang defang - -
d /var/spool/MIMEDefang/.razor 0750 defang defang - -
L+ /var/spool/MIMEDefang/.razor/razor-agent.log - - - - /dev/null

leads to /dev/null with permissions 750 defang:defang. If I disable
the first line, /dev/null has correct permissions again. This needs
IMHO either to be fixed or to be clarified in the documentation. The

L+ /var/spool/MIMEDefang/.razor/razor-agent.log - defang defang - /dev/null

line by itself does not chown the target but does also not chown the
symlink. If that is expected behaviour, at least the documentation
should mention that setting owner/group for L+ doesn't do anything...

Comment 7 Jan Synacek 2016-01-13 07:37:11 UTC
(In reply to Robert Scheck from comment #6)
> line by itself does not chown the target but does also not chown the
> symlink. If that is expected behaviour, at least the documentation
> should mention that setting owner/group for L+ doesn't do anything...

Quoting symlink(2):

The  permissions of a symbolic link are irrelevant; the ownership is ignored when following the link, but is checked when removal or renaming of the link is requested and the link is in a directory with the sticky bit (S_ISVTX) set.


But, as you mention, it would be nice to emphasize this behavior in the man pages, as it might not be obvious.

Comment 8 Jan Synacek 2016-01-13 13:44:12 UTC
In addition to the patch in comment 4, we should also backport https://github.com/systemd/systemd/commit/0aaa263f1651cab2ae1a02ae64cbf523b21fb6e1.

Comment 9 Robert Scheck 2016-01-13 13:46:58 UTC
By the way, given comment #7 regarding that the ownership might matter, it
IMHO should be possible to set a different ownership via systemd-tmpfiles.

Comment 10 Lukáš Nykrýn 2016-01-13 14:01:18 UTC
Create a symlink in /tmp and allow a specific user or group to remove it. 
To be honest I can't imagine a real use-case for that.

Comment 12 Robert Scheck 2016-03-22 11:10:01 UTC
Given I got a reminder via the support ticket: What exactly will be fixed/
changed using this RHBZ? Per comment #10, my original request won't happen
I guess?

Comment 14 Lukáš Nykrýn 2016-03-23 12:54:59 UTC
https://github.com/lnykryn/systemd-rhel/pull/14

Comment 15 Lukáš Nykrýn 2016-04-04 06:33:12 UTC
Pushed to staging -> post

Comment 17 Branislav Blaškovič 2016-09-01 10:46:59 UTC
NEW VERSION:

:: [   LOG    ] :: Package versions:
:: [   LOG    ] ::   systemd-219-27.el7.x86_64
:: [   PASS   ] :: Creating tmp directory (Expected 0, got 0)
:: [   PASS   ] :: Command 'pushd /tmp/tmp.JwI6Bkx2nJ' (Expected 0, got 0)
:: [   PASS   ] :: Command 'useradd foo' (Expected 0, got 0)
:: [   PASS   ] :: Command 'groupadd bar' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 0s
:: [   LOG    ] :: Assertions: 5 good, 0 bad
:: [   PASS   ] :: RESULT: Setup

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: bug 1296288
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'systemd-tmpfiles --create' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ls -l  /run/hello2/' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/tmp.1m3e8oXcb5' should contain 'root.*root.* hello2.test$'
:: [   PASS   ] :: File '/var/tmp/tmp.1m3e8oXcb5' should contain 'root.*root.* hello2.link -> /run/hello2/hello2.test$'
:: [   LOG    ] :: Duration: 0s
:: [   LOG    ] :: Assertions: 4 good, 0 bad
:: [   PASS   ] :: RESULT: bug 1296288


OLD VERSION:
:: [   LOG    ] :: Package versions:
:: [   LOG    ] ::   systemd-219-19.el7.x86_64
:: [   PASS   ] :: Creating tmp directory (Expected 0, got 0)
:: [   PASS   ] :: Command 'pushd /tmp/tmp.3mOpnl39DI' (Expected 0, got 0)
:: [   PASS   ] :: Command 'useradd foo' (Expected 0, got 0)
:: [   PASS   ] :: Command 'groupadd bar' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 1s
:: [   LOG    ] :: Assertions: 5 good, 0 bad
:: [   PASS   ] :: RESULT: Setup

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: bug 1296288
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'systemd-tmpfiles --create' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ls -l  /run/hello2/' (Expected 0, got 0)
:: [   FAIL   ] :: File '/var/tmp/tmp.0cFDE8bNiY' should contain 'root.*root.* hello2.test$'
:: [   PASS   ] :: File '/var/tmp/tmp.0cFDE8bNiY' should contain 'root.*root.* hello2.link -> /run/hello2/hello2.test$'
:: [   LOG    ] :: Duration: 1s
:: [   LOG    ] :: Assertions: 3 good, 1 bad
:: [   FAIL   ] :: RESULT: bug 1296288


Verified...

Comment 19 errata-xmlrpc 2016-11-04 00:50:14 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://rhn.redhat.com/errata/RHBA-2016-2216.html


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