Bug 486755

Summary: Selinux policy problem with mod_dav_svn
Product: [Fedora] Fedora Reporter: Roman Kisilenko <rkisilenko>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: dwalsh, jorton, mgrepl, thexman, vanmeeuwen+fedora, vchepkov
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-11-18 11:29:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roman Kisilenko 2009-02-21 20:24:19 UTC
Description of problem:
It is impossible to commit to repository via mod_dav_svn with enforcing selinux enabled on server.

Version-Release number of selected component (if applicable): 
mod_dav_svn.x86_64 - 1.5.4-3
subversion.x86_64 - 1.5.4-3
selinux-policy.noarch - 3.5.13-45.fc10
selinux-policy-targeted.noarch - 3.5.13-45.fc10

How reproducible:
Always

Steps to Reproduce:
1. Configure mod_dav_svn and repository in accordance with procedure documented in /etc/httpd/conf.d/subversion.conf
2. Try to commit anything to the repository
  
Actual results:
Console output:
svn: Can't open file '/var/www/svn/repo/db/txn-current-lock': Permission denied
In /var/log/messages on the server:
Feb 21 23:02:22 svn kernel: type=1400 audit(1235246542.491:11): avc:  denied  { write } for  pid=2714 comm="httpd" name="txn-current-lock" dev=dm-0 ino=172076 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=file

Expected results:
Successful commit

Additional info: I'm not sure, but as far as I remember there were no such an issue 2-4 weeks ago, so it is probably was introduced by some latest updates. Please excuse me if this issue should have been filled against selinux component and not subversion.

Comment 1 thexman 2009-03-05 22:43:09 UTC
As workaround solution I am doing following:
1) before commit execute "echo 0 >/selinux/enforce" from root shell
2) commit svn changes
3) after commit execute "echo 1 >/selinux/enforce" from root shell.

Comment 2 Joe Orton 2009-03-09 16:53:00 UTC
This is content which httpd processes are expected to have write access to -

From reading the httpd_selinux man page, I'm not sure whether content which httpd itself writes to should be labelled:

   httpd_sys_content_rw_t

or whether that is purely for CGI scripts etc.

Comment 3 Daniel Walsh 2009-03-09 21:48:37 UTC
chcon -R -t http_sys_content_rw_t /var/www/svn/repo/db

Should fix

or you can set the boolean

setsebool -P httpd_unified 1

Which will set tell SELinux to treat all apache content the same.

Is 
/var/www/svn/repo/db

The standard directory for svn data?

Comment 4 Joe Orton 2009-03-10 08:24:35 UTC
Thanks Dan - maybe that could be clarified in httpd_selinux(8), which only talks about httpd_sys_content_rw_t making a different for "httpd_sys_script_exec_t scripts".

People are free to put SVN repositories wherever they like, /var/www/svn is just a directory used in the example config.  There's no standard here really.

Comment 5 Daniel Walsh 2009-03-10 13:38:35 UTC
Well that is what we want, to setup the default labeling correctly.

Are there any other directories under /var/www/svn that need write access?

I will update the man page in rawhide.

Comment 6 Joe Orton 2009-03-10 13:55:58 UTC
Well, the whole of /var/www/svn would need to be writable by httpd.  I can update the example config to mention the labelling.

Comment 7 Daniel Walsh 2009-03-10 20:56:23 UTC
Any reason not to add this to the spec file then we could get it labeled automatically?


Miroslav can you add

/var/www/svn(/.*)?		gen_context(system_u:object_r:httpd_sys_content_rw_t,s0)

Comment 8 Joe Orton 2009-03-11 08:23:35 UTC
Do you mean, to package the /var/www/svn directory?  Yeah, we could do that.

Comment 9 Daniel Walsh 2009-03-11 15:21:39 UTC
That way when rpm creates it, it will get labeled 
httpd_sys_content_rw_t automagically.

Comment 10 Miroslav Grepl 2009-03-16 17:43:16 UTC
Fixed in selinux-policy-3.5.13-49.fc10

Comment 11 Vadym Chepkov 2009-05-25 18:35:42 UTC
I would like to raise my concerns.
not everything under /var/www/svn needs to be writable by server, furthermore, it can be rather dangerous if now you allow web server to create/modify repository hooks under /var/www/svn/hooks.

Comment 12 Roman Kisilenko 2009-05-25 19:09:58 UTC
Hello,

If you decide to alter default selinux policy to stop marking /var/www/svn/hooks(/.*) as httpd_sys_content_rw_t could you please do the same for /var/www/svn/conf(/.*). It also does not need to be writable by apache.

Thank you,
Roman

Comment 13 Daniel Walsh 2009-05-26 13:25:52 UTC
/var/www/svn(/.*)?			gen_context(system_u:object_r:httpd_sys_script_rw_t,s0)
/var/www/svn/hooks(/.*)?		gen_context(system_u:object_r:httpd_sys_content_t,s0)
/var/www/svn/conf(/.*)?			gen_context(system_u:object_r:httpd_sys_content_t,s0)


Miroslav can you add these.

Comment 14 Vadym Chepkov 2009-05-26 15:59:40 UTC
Hooks should have httpd_sys_script_exec_t context, imho.

Comment 15 Daniel Walsh 2009-05-26 19:12:21 UTC
Ok if they are cgi scripts sounds correct

Comment 16 Miroslav Grepl 2009-06-03 08:49:51 UTC
Fixed in selinux-policy-3.5.13-62.fc10

Comment 17 Bug Zapper 2009-11-18 11:11:16 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping