Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 592762 - SELinux prevented httpd (/usr/bin/perl5.10.1) write access to BackupPC.
Summary: SELinux prevented httpd (/usr/bin/perl5.10.1) write access to BackupPC.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: BackupPC
Version: 13
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Johan Cwiklinski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:b14e92bf96f...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-05-16 18:37 UTC by Richard Shaw
Modified: 2010-06-08 21:41 UTC (History)
3 users (show)

Fixed In Version: BackupPC-3.1.0-6.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-06-03 18:06:37 UTC


Attachments (Terms of Use)

Description Richard Shaw 2010-05-16 18:37:23 UTC
Summary:

SELinux prevented httpd (/usr/bin/perl5.10.1) write access to BackupPC.

Detailed Description:

SELinux prevented httpd write access to BackupPC. httpd scripts are not allowed
to write to content without explicit labeling of all files. If BackupPC is
writable content. it needs to be labeled httpd_sys_content_rw_t or if all you
need is append you can label it httpd_sys_content_ra_t. Please refer to 'man
httpd_selinux' for more information on setting up httpd and selinux.

Allowing Access:

You can alter the file context by executing chcon -R -t httpd_sys_content_rw_t
'BackupPC' You must also change the default file context files on the system in
order to preserve them even on a full relabel. "semanage fcontext -a -t
httpd_sys_content_rw_t 'BackupPC'"

Fix Command:

chcon -R -t httpd_sys_content_rw_t 'BackupPC'

Additional Information:

Source Context                unconfined_u:system_r:httpd_t:s0
Target Context                system_u:object_r:httpd_sys_content_t:s0
Target Objects                BackupPC [ dir ]
Source                        perl5.10.1
Source Path                   /usr/bin/perl5.10.1
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           perl-5.10.1-112.fc13
Target RPM Packages           
Policy RPM                    selinux-policy-3.7.19-10.fc13
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   httpd_write_content
Host Name                     (removed)
Platform                      Linux (removed) 2.6.33.3-85.fc13.x86_64
                              #1 SMP Thu May 6 18:09:49 UTC 2010 x86_64 x86_64
Alert Count                   2
First Seen                    Sun 16 May 2010 01:36:37 PM CDT
Last Seen                     Sun 16 May 2010 01:36:37 PM CDT
Local ID                      4350639a-52a1-4c1d-9d37-ffa1368d1779
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1274034997.532:34306): avc:  denied  { write } for  pid=16903 comm="perl5.10.1" name="BackupPC" dev=dm-0 ino=532127 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=dir

node=(removed) type=SYSCALL msg=audit(1274034997.532:34306): arch=c000003e syscall=2 success=no exit=-13 a0=2be3600 a1=241 a2=1b6 a3=3a42d1d770 items=0 ppid=14029 pid=16903 auid=500 uid=48 gid=489 euid=489 suid=489 fsuid=489 egid=489 sgid=489 fsgid=489 tty=(none) ses=1 comm="perl5.10.1" exe="/usr/bin/perl5.10.1" subj=unconfined_u:system_r:httpd_t:s0 key=(null)



Hash String generated from  httpd_write_content,perl5.10.1,httpd_t,httpd_sys_content_t,dir,write
audit2allow suggests:

#============= httpd_t ==============
#!!!! This avc can be allowed using the boolean 'httpd_unified'

allow httpd_t httpd_sys_content_t:dir write;

Comment 1 Daniel Walsh 2010-05-17 13:01:30 UTC
Not sure of the path to the BackupPC directory.  From looking at the policy that BackupPC ships, they expect apache to only write to the /etc/BackupPC/pc directory?  Do you think it is trying to write to a different directory?

Turning on the httpd_unified boolean will allow apache to write to all its content.

Comment 2 Richard Shaw 2010-05-17 13:25:48 UTC
I was trying to change some of the main BackupPC settings through the admin web page. It needed access to /etc/BackupPC/config.pl to write the changes.

Comment 3 Daniel Walsh 2010-05-17 13:50:34 UTC
chcon -t httpd_sys_content_rw_t /etc/BackupPC/config.pl

Should fix

Comment 4 Richard Shaw 2010-05-17 15:31:47 UTC
Hmm.. Nogo. It looks like it creates a new file first instead of modifying the existing. Error message below:

TextFileWrite: Failed to write /etc/BackupPC//config.pl.new

Comment 5 Johan Cwiklinski 2010-05-17 16:21:44 UTC
Try to set the context on the whole directory :
chcon -R -t httpd_sys_content_rw_t /etc/BackupPC

Comment 6 Johan Cwiklinski 2010-05-17 16:23:19 UTC
As I never try to change main config file from the we interface, I never get these issue.
Anyways ; that will prevent writing to the config.pl and HOSTS file ; I'll push a fix soon.

Comment 7 Richard Shaw 2010-05-17 16:43:29 UTC
That did the trick.

Comment 8 Fedora Update System 2010-05-17 19:23:09 UTC
BackupPC-3.1.0-13.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/BackupPC-3.1.0-13.fc12

Comment 9 Fedora Update System 2010-05-17 19:23:14 UTC
BackupPC-3.1.0-6.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/BackupPC-3.1.0-6.el5

Comment 10 Fedora Update System 2010-05-17 19:23:18 UTC
BackupPC-3.1.0-14.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/BackupPC-3.1.0-14.fc13

Comment 11 Fedora Update System 2010-05-18 21:56:57 UTC
BackupPC-3.1.0-14.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update BackupPC'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/BackupPC-3.1.0-14.fc13

Comment 12 Fedora Update System 2010-05-18 22:00:00 UTC
BackupPC-3.1.0-13.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update BackupPC'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/BackupPC-3.1.0-13.fc12

Comment 13 Fedora Update System 2010-05-19 02:39:52 UTC
BackupPC-3.1.0-6.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update BackupPC'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/BackupPC-3.1.0-6.el5

Comment 14 Fedora Update System 2010-06-03 18:06:30 UTC
BackupPC-3.1.0-13.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2010-06-03 18:14:35 UTC
BackupPC-3.1.0-14.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2010-06-08 21:41:47 UTC
BackupPC-3.1.0-6.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.


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