Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1727458

Summary: SELinux is preventing executing svnserve's hooks
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: high    
Version: 7.6CC: bwelterl, fperalta, lvrabec, mmalik, plautrba, ssekidde, vmojzis, zpytela
Target Milestone: rcKeywords: AutoVerified, Reopened
Target Release: 7.8   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1729955 2004843 (view as bug list) Environment:
Last Closed: 2020-03-31 19:11:00 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:
Bug Depends On:    
Bug Blocks: 2004843    

Description Renaud Métrich 2019-07-06 14:52:43 UTC
Description of problem:

Since RHEL7 "svnserve" service is confined ("svnserve_t").
The svnserve data (repository content and hooks) have context "svnserve_content_t".

Due to confinement, executing repositories hooks fails due to "svnserve_t" not being allowed to execute "svnserve_content_t".



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

selinux-policy-3.14.1-61.el8_0.1.noarch
(all policies since RHEL7.0)


How reproducible:

Always


Steps to Reproduce:
1. Install subversion and configure the svnserve service

# yum -y install subversion
# mkdir /var/svn && cd !$
# svnadmin create my-repo
# sed -i "s/# anon-access = read/anon-access = write/" my-repo/conf/svnserve.conf

2. Create pre-commit hook

# cat > my-repo/hooks/pre-commit << EOF
#!/bin/bash
id -Z > /tmp/pre-commit
EOF
# chmod +x my-repo/hooks/pre-commit

3. Start svnserve

# restorecon -Fr /var/svn
# systemctl start svnserve

4. Checkout a repo

# cd /root
# svn co svn://localhost/my-repo
# cd my-repo
# touch file && svn add file && svn commit -m test

Actual results:

svn: E165001: Commit failed (details follow):
svn: E165001: Commit blocked by pre-commit hook (exit code 255) with no output.


AVCs (running permissive):

#============= svnserve_t ==============

#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files'
allow svnserve_t bin_t:file map;
allow svnserve_t bin_t:file { execute execute_no_trans };
allow svnserve_t passwd_file_t:file { getattr open read };

#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files'
allow svnserve_t shell_exec_t:file map;
allow svnserve_t shell_exec_t:file execute;
allow svnserve_t sssd_var_lib_t:sock_file write;
allow svnserve_t svnserve_content_t:file { execute execute_no_trans };


Expected results:

Success


Additional info:

Allowing this is definitely not the right solution. Indeed, hooks can execute arbitrary code (send mail, connect to some HTTP server, etc), so probably some sort of transition to "unconfined_t" is necessary.

Comment 2 Renaud Métrich 2019-07-06 14:55:08 UTC
AVC was for RHEL8, sorry.

On RHEL7, I get this:

#============= svnserve_t ==============

#!!!! WARNING: 'bin_t' is a base type.
allow svnserve_t bin_t:file { execute execute_no_trans };
allow svnserve_t passwd_file_t:file { getattr open read };
allow svnserve_t proc_t:file { getattr open read };
allow svnserve_t random_device_t:chr_file getattr;

#!!!! WARNING: 'shell_exec_t' is a base type.
allow svnserve_t shell_exec_t:file execute;
allow svnserve_t svnserve_content_t:file { execute execute_no_trans };

Comment 7 Milos Malik 2019-07-15 11:54:52 UTC
Is there a RHEL-8 of this bug? If not then we should file it, because similar SELinux denials appear on RHEL-8.

Comment 8 Renaud Métrich 2019-07-15 11:58:03 UTC
Hi Milos,

Yes, happens on RHEL8 also, didn't have time creating the BZ :-(

Comment 14 RHEL Program Management 2019-07-22 10:12:21 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

Comment 34 errata-xmlrpc 2020-03-31 19:11:00 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:1007