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 1480741 - selinux policy lacks svnserve_log_t, which breaks svnserve logging
Summary: selinux policy lacks svnserve_log_t, which breaks svnserve logging
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-11 19:19 UTC by James Ralston
Modified: 2021-06-10 12:48 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.13.1-175.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 12:38:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3169071 0 None None None 2017-08-31 17:08:07 UTC
Red Hat Product Errata RHBA-2018:0763 0 None None None 2018-04-10 12:40:51 UTC

Description James Ralston 2017-08-11 19:19:22 UTC
Description of problem:

SELinux blocks attempts to have svnserve log to /var/log/svnserve/svnserve.log, because there is no svnserve_log_t type (or rules to apply that label to the filesystem), and the targeted policy does not permit svnserve to write to files with the generic var_log_t type.

For now, I have worked around this issue with:

$ semanage fcontext -a -t svnserve_var_run_t '/var/log/svnserve(/.*)?'
$ restorecon -FRv /var/log

But this is a kluge, and only works because svnserve_t is permitted to write to svnserve_var_run_t. There should be a separate svnserve_log_t file context for '/var/log/svnserve(/.*)?', and svnserve_t should be able to write to it.

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

selinux-policy-targeted-3.13.1-102.el7_3.4.noarch

How reproducible:

Add "--log-file /var/log/svnserve/svnserve.log" to OPTIONS in /etc/sysconfig/svnserve and restart svnserve.

Actual results:

svnserve will fail to start, emitting the following error:

svnserve: svn: E000013: Can't open file '/var/log/svnserve/svnserve.log': Permission denied

Expected results:

svnserve should start, opening the log file.

Comment 2 Milos Malik 2017-08-14 09:26:23 UTC
You're right, James.

# rpm -qa selinux\*
selinux-policy-targeted-3.13.1-166.el7.noarch
selinux-policy-3.13.1-166.el7.noarch
selinux-policy-mls-3.13.1-166.el7.noarch
selinux-policy-devel-3.13.1-166.el7.noarch
# matchpathcon /var/log/svnserve
/var/log/svnserve	system_u:object_r:var_log_t:s0
# sesearch -s svnserve_t -t var_log_t -T

#

Comment 3 Milos Malik 2017-08-14 16:34:45 UTC
Following SELinux denial appears in enforcing mode when the /var/log/svnserve directory exists:
----
type=PROCTITLE msg=audit(08/14/2017 18:24:57.205:251) : proctitle=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid -r /var/svn --log-file /var/log/svnserve/svnserve.log 
type=PATH msg=audit(08/14/2017 18:24:57.205:251) : item=0 name=/var/log/svnserve/ inode=625659 dev=fd:02 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:var_log_t:s0 nametype=PARENT 
type=CWD msg=audit(08/14/2017 18:24:57.205:251) : cwd=/ 
type=SYSCALL msg=audit(08/14/2017 18:24:57.205:251) : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x55aa1fb37698 a1=O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC a2=0666 a3=0x7ffd56f870d0 items=1 ppid=1 pid=12287 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=svnserve exe=/usr/bin/svnserve subj=system_u:system_r:svnserve_t:s0 key=(null) 
type=AVC msg=audit(08/14/2017 18:24:57.205:251) : avc:  denied  { write } for  pid=12287 comm=svnserve name=svnserve dev="vda2" ino=625659 scontext=system_u:system_r:svnserve_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=dir permissive=0 
----

Following SELinux denials appear in permissive mode:
----
type=PROCTITLE msg=audit(08/14/2017 18:31:52.759:301) : proctitle=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid -r /var/svn --log-file /var/log/svnserve/svnserve.log 
type=PATH msg=audit(08/14/2017 18:31:52.759:301) : item=1 name=/var/log/svnserve/svnserve.log inode=630343 dev=fd:02 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_log_t:s0 nametype=CREATE 
type=PATH msg=audit(08/14/2017 18:31:52.759:301) : item=0 name=/var/log/svnserve/ inode=625659 dev=fd:02 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:var_log_t:s0 nametype=PARENT 
type=CWD msg=audit(08/14/2017 18:31:52.759:301) : cwd=/ 
type=SYSCALL msg=audit(08/14/2017 18:31:52.759:301) : arch=x86_64 syscall=open success=yes exit=3 a0=0x55c395898698 a1=O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC a2=0666 a3=0x7ffe3965e890 items=2 ppid=1 pid=18182 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=svnserve exe=/usr/bin/svnserve subj=system_u:system_r:svnserve_t:s0 key=(null) 
type=AVC msg=audit(08/14/2017 18:31:52.759:301) : avc:  denied  { open } for  pid=18182 comm=svnserve path=/var/log/svnserve/svnserve.log dev="vda2" ino=630343 scontext=system_u:system_r:svnserve_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=1 
type=AVC msg=audit(08/14/2017 18:31:52.759:301) : avc:  denied  { create } for  pid=18182 comm=svnserve name=svnserve.log scontext=system_u:system_r:svnserve_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=1 
type=AVC msg=audit(08/14/2017 18:31:52.759:301) : avc:  denied  { add_name } for  pid=18182 comm=svnserve name=svnserve.log scontext=system_u:system_r:svnserve_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=dir permissive=1 
type=AVC msg=audit(08/14/2017 18:31:52.759:301) : avc:  denied  { write } for  pid=18182 comm=svnserve name=svnserve dev="vda2" ino=625659 scontext=system_u:system_r:svnserve_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=dir permissive=1 
----

Comment 8 errata-xmlrpc 2018-04-10 12:38:21 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-2018:0763


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