Bug 486755 - Selinux policy problem with mod_dav_svn
Selinux policy problem with mod_dav_svn
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-02-21 15:24 EST by Roman Kisilenko
Modified: 2009-11-18 06:29 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-11-18 06:29:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Roman Kisilenko 2009-02-21 15:24:19 EST
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:

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 17:43:09 EST
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 12:53:00 EDT
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:


or whether that is purely for CGI scripts etc.
Comment 3 Daniel Walsh 2009-03-09 17:48:37 EDT
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.


The standard directory for svn data?
Comment 4 Joe Orton 2009-03-10 04:24:35 EDT
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 09:38:35 EDT
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 09:55:58 EDT
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 16:56:23 EDT
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 04:23:35 EDT
Do you mean, to package the /var/www/svn directory?  Yeah, we could do that.
Comment 9 Daniel Walsh 2009-03-11 11:21:39 EDT
That way when rpm creates it, it will get labeled 
httpd_sys_content_rw_t automagically.
Comment 10 Miroslav Grepl 2009-03-16 13:43:16 EDT
Fixed in selinux-policy-3.5.13-49.fc10
Comment 11 Vadym Chepkov 2009-05-25 14:35:42 EDT
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 15:09:58 EDT

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,
Comment 13 Daniel Walsh 2009-05-26 09:25:52 EDT
/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 11:59:40 EDT
Hooks should have httpd_sys_script_exec_t context, imho.
Comment 15 Daniel Walsh 2009-05-26 15:12:21 EDT
Ok if they are cgi scripts sounds correct
Comment 16 Miroslav Grepl 2009-06-03 04:49:51 EDT
Fixed in selinux-policy-3.5.13-62.fc10
Comment 17 Bug Zapper 2009-11-18 06:11:16 EST
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: 

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