Bug 592762 - SELinux prevented httpd (/usr/bin/perl5.10.1) write access to BackupPC.
SELinux prevented httpd (/usr/bin/perl5.10.1) write access to BackupPC.
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: BackupPC (Show other bugs)
13
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Johan Cwiklinski
Fedora Extras Quality Assurance
setroubleshoot_trace_hash:b14e92bf96f...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-16 14:37 EDT by Richard Shaw
Modified: 2010-06-08 17:41 EDT (History)
3 users (show)

See Also:
Fixed In Version: BackupPC-3.1.0-6.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-06-03 14:06:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard Shaw 2010-05-16 14:37:23 EDT
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 09:01:30 EDT
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 09:25:48 EDT
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 09:50:34 EDT
chcon -t httpd_sys_content_rw_t /etc/BackupPC/config.pl

Should fix
Comment 4 Richard Shaw 2010-05-17 11:31:47 EDT
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 12:21:44 EDT
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 12:23:19 EDT
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 12:43:29 EDT
That did the trick.
Comment 8 Fedora Update System 2010-05-17 15:23:09 EDT
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 15:23:14 EDT
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 15:23:18 EDT
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 17:56:57 EDT
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 18:00:00 EDT
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-18 22:39:52 EDT
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 14:06:30 EDT
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 14:14:35 EDT
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 17:41:47 EDT
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.