Description of problem: SELinux is preventing access to the file "/var/log/BackupPC/UserEmailInfo.pl" for httpd. I got this alert after accessing the BackupPC status in Firefox. Version-Release number of selected component (if applicable): selinux-policy-3.6.12-62.fc11 How reproducible: First time this has happened. Steps to Reproduce: 1. Open BackupPC status on host during active backup. 2. 3. Actual results: Selinux denial Expected results: No denial alert. Additional info: Summary: SELinux is preventing the perl5.10.0 from using potentially mislabeled files /var/log/BackupPC/UserEmailInfo.pl (var_log_t). Detailed Description: SELinux has denied the perl5.10.0 access to potentially mislabeled files /var/log/BackupPC/UserEmailInfo.pl. This means that SELinux will not allow httpd to use these files. Many third party apps install html files in directories that SELinux policy cannot predict. These directories have to be labeled with a file context which httpd can access. Allowing Access: If you want to change the file context of /var/log/BackupPC/UserEmailInfo.pl so that the httpd daemon can access it, you need to execute it using chcon -t httpd_sys_content_t '/var/log/BackupPC/UserEmailInfo.pl'. You can look at the httpd_selinux man page for additional information. Additional Information: Source Context system_u:system_r:httpd_t:s0 Target Context system_u:object_r:var_log_t:s0 Target Objects /var/log/BackupPC/UserEmailInfo.pl [ file ] Source perl5.10.0 Source Path /usr/bin/perl5.10.0 Port <Unknown> Host hobbes.localdomain Source RPM Packages perl-5.10.0-69.fc11 Target RPM Packages Policy RPM selinux-policy-3.6.12-62.fc11 Selinux Enabled True Policy Type targeted MLS Enabled True Enforcing Mode Enforcing Plugin Name httpd_bad_labels Host Name hobbes.localdomain Platform Linux hobbes.localdomain 2.6.29.5-191.fc11.x86_64 #1 SMP Tue Jun 16 23:23:21 EDT 2009 x86_64 x86_64 Alert Count 1 First Seen Wed 15 Jul 2009 08:07:21 PM CDT Last Seen Wed 15 Jul 2009 08:07:21 PM CDT Local ID 12271f50-8744-48b7-81cf-bc8859e92fb2 Line Numbers Raw Audit Messages node=hobbes.localdomain type=AVC msg=audit(1247706441.387:43097): avc: denied { read } for pid=19513 comm="perl5.10.0" name="UserEmailInfo.pl" dev=dm-0 ino=117818 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file node=hobbes.localdomain type=SYSCALL msg=audit(1247706441.387:43097): arch=c000003e syscall=2 success=no exit=-13 a0=1747048 a1=0 a2=1b6 a3=7ff9f06198d0 items=0 ppid=2105 pid=19513 auid=4294967295 uid=48 gid=48 euid=494 suid=494 fsuid=494 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="perl5.10.0" exe="/usr/bin/perl5.10.0" subj=system_u:system_r:httpd_t:s0 key=(null)
Why is a perl script in a log directory? You can change the context on this file to bin_t and it will work but the location of this file has got to change. chcon -t bin_t /var/log/BackupPC/UserEmailInfo.pl If you installed this from a package, what package?
I'm not at home right now so I can't give you the exact package but I installed the official Fedora package...
Is there some additional info I can provide? I also noticed the following files in /var/log/BackupPC: -r--r--r--. 1 backuppc backuppc 4 2009-08-11 21:58 BackupPC.pid srwxr-x---. 1 backuppc backuppc 0 2009-08-11 21:58 BackupPC.sock -rw-r-----. 1 backuppc backuppc 0 2009-06-17 22:20 LOCK -rw-r-----. 1 backuppc backuppc 2309 2009-08-21 22:00 LOG -rw-r-----. 1 backuppc backuppc 636 2009-08-21 01:00 LOG.0.z -rw-r-----. 1 backuppc backuppc 639 2009-08-11 01:00 LOG.10.z -rw-r-----. 1 backuppc backuppc 637 2009-08-10 01:00 LOG.11.z -rw-r-----. 1 backuppc backuppc 639 2009-08-09 01:00 LOG.12.z -rw-r-----. 1 backuppc backuppc 741 2009-08-08 01:00 LOG.13.z -rw-r-----. 1 backuppc backuppc 640 2009-08-20 01:00 LOG.1.z -rw-r-----. 1 backuppc backuppc 638 2009-08-19 01:00 LOG.2.z -rw-r-----. 1 backuppc backuppc 634 2009-08-18 01:00 LOG.3.z -rw-r-----. 1 backuppc backuppc 635 2009-08-17 01:00 LOG.4.z -rw-r-----. 1 backuppc backuppc 639 2009-08-16 01:00 LOG.5.z -rw-r-----. 1 backuppc backuppc 654 2009-08-15 01:00 LOG.6.z -rw-r-----. 1 backuppc backuppc 639 2009-08-14 01:00 LOG.7.z -rw-r-----. 1 backuppc backuppc 642 2009-08-13 01:00 LOG.8.z -rw-r-----. 1 backuppc backuppc 724 2009-08-12 01:00 LOG.9.z -rw-r-----. 1 backuppc backuppc 12464 2009-08-21 22:00 status.pl -rw-r-----. 1 backuppc backuppc 12464 2009-08-21 21:00 status.pl.old -rw-r-----. 1 backuppc backuppc 196 2009-08-21 01:00 UserEmailInfo.pl
Why does apache want to look at this file? Does it want to execute it?
You can label this directory httpd_sys_content_t and apache will be able to read it. But this will cause other problems. Or you can add a rule to allow apache to read the content using audit2allow. But that will allow apache to read /var/log/messages.
(In reply to comment #4) > Why does apache want to look at this file? Does it want to execute it? I don't have all the answers but I assume apache wants access to the files because the BackupPC interface is completely web driven. I assumed the fault was with why BackupPC wants those files in the /var/log directory.
BackupPC's web interface gives user possibility of reading several logs files, including UserEmailInfo.pl (it is indeed a simple log file). That's why these should be labelled 'httpd_sys_content_t', you should use : # semanage fcontext -a -t httpd_sys_content_t /var/log/BackupPC/UserEmailInfo.pl
The BackupPC.fc file should look like /etc/BackupPC(/.*)? gen_context(system_u:object_r:httpd_sys_content_t,s0) /etc/BackupPC/pc(/.*)? gen_context(system_u:object_r:httpd_sys_content_rw_t,s0) /var/log/BackupPC(/.*)? gen_context(system_u:object_r:httpd_sys_content_t,s0) Which will set the default labeling for the directory and all subdirs to the correct label. Then Restorecon will label the files correctly.
I've missed the regular expression in the .fc file embedded in the package :/ Thanks Daniel for the correct rules, I'll do some tests and push an update very soon.
*** Bug 456387 has been marked as a duplicate of this bug. ***
BackupPC-3.1.0-6.fc11 has been submitted as an update for Fedora 11. http://admin.fedoraproject.org/updates/BackupPC-3.1.0-6.fc11
BackupPC-3.1.0-5.fc10 has been submitted as an update for Fedora 10. http://admin.fedoraproject.org/updates/BackupPC-3.1.0-5.fc10
BackupPC-3.1.0-5.fc10 has been pushed to the Fedora 10 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/F10/FEDORA-2009-9800
BackupPC-3.1.0-6.fc11 has been pushed to the Fedora 11 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/F11/FEDORA-2009-9893
BackupPC-3.1.0-6.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report.
BackupPC-3.1.0-5.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.