Bug 872345 - AWStats SELinux module lacks tunable for PurgeLogFile=1 setup
Summary: AWStats SELinux module lacks tunable for PurgeLogFile=1 setup
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 872542
TreeView+ depends on / blocked
 
Reported: 2012-11-01 20:24 UTC by Dmitry S. Makovey
Modified: 2013-01-07 04:00 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
: 872542 (view as bug list)
Environment:
Last Closed: 2013-01-07 04:00:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Dmitry S. Makovey 2012-11-01 20:24:08 UTC
Description of problem:

Currently if SELinux enabled on Fedora 16+ or RHEL6 and awstats installed (via EPEL for RHEL) - enabling "PurgeLogFile=1" option creates SELinux denials.

Version-Release number of selected component (if applicable):

RHEL:
awstats-7.0-2.el6.noarch
selinux-policy-3.7.19-155.el6_3.4.noarch
selinux-policy-targeted-3.7.19-155.el6_3.4.noarch

F16:
awstats-7.0-6.fc16.noarch
selinux-policy-3.10.0-91.fc16.noarch
selinux-policy-targeted-3.10.0-91.fc16.noarch

How reproducible:

always

Steps to Reproduce:
1. install Fedora/RHEL+EPEL
2. enable SELinux
3. install awstats
4. configure awstats to purge httpd log files:
PurgeLogFile=1
  
Actual results:

type=AVC msg=audit(1349467262.084:790): avc:  denied  { write } for  pid=7413 comm="awstats.pl" name="moodle22-access_log" dev=dm-6 ino=39 scontext=system_u:system_r:awstats_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:httpd_log_t:s0 tclass=file

and un-purged files.

Expected results:

files processed by awstats and logfiles purged after processing.

Additional info:

I have "fixed" it locally by building additional SELinux policy module:

module awstats-httpd-logs 1.1;

require {
        type httpd_log_t;
        type awstats_t;
        class file write;
}

#============= awstats_t ==============
allow awstats_t httpd_log_t:file write;

however I believe it should be part of base awstats module with a tunable boolean switching on/off behavior with default to "off".

Comment 1 Petr Lautrbach 2012-11-16 17:16:20 UTC
The awstats itself shouldn't provide any SELinux module. However, some SELinux boolean, which would allow awstats to purge logs, might be usable.

Comment 2 Miroslav Grepl 2012-11-19 11:29:03 UTC
Yeap. Also we don't want to allow it by default.

How about

"awstats_purge_apache_log" 

boolean as you suggest.

Comment 3 Dmitry S. Makovey 2012-11-19 15:31:00 UTC
sounds great (and logical) to me :)

Comment 4 Miroslav Grepl 2012-11-26 15:30:51 UTC
Added.

commit 29865a1bb8feeaafd0875821684d593c1b12a7d0
Author: Miroslav Grepl <mgrepl>
Date:   Mon Nov 26 16:29:33 2012 +0100

    Add awstats_purge_apache_log boolean

Comment 5 Fedora Update System 2012-12-17 18:41:22 UTC
selinux-policy-3.10.0-165.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-165.fc17

Comment 6 Fedora Update System 2012-12-18 02:36:58 UTC
Package selinux-policy-3.10.0-165.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-165.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-20544/selinux-policy-3.10.0-165.fc17
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-01-05 06:40:31 UTC
Package selinux-policy-3.10.0-166.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-166.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-20544/selinux-policy-3.10.0-166.fc17
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2013-01-07 04:00:22 UTC
selinux-policy-3.10.0-166.fc17 has been pushed to the Fedora 17 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.