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 1057774 - fail2ban apache-auth filter prevented by SELINUX
Summary: fail2ban apache-auth filter prevented by SELINUX
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-24 19:51 UTC by Derek Atkins
Modified: 2014-02-12 14:44 UTC (History)
9 users (show)

Fixed In Version: selinux-policy-3.12.1-122.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-12 14:44:13 UTC


Attachments (Terms of Use)

Description Derek Atkins 2014-01-24 19:51:41 UTC
Description of problem:

fail2ban wants to look at /var/log/httpd but selinux prevents it.

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

fail2ban-0.9-0.3.git1f1a561.fc20.noarch

How reproducible:

100% if you have selinux turned on in enforcing mode

Steps to Reproduce:
1. turn on the apache-auth jail
2. try to start fail2ban with selinux in enforcing mode
3. fail2ban fails to start

Actual results:

Jan 24 13:11:07 code fail2ban-client: ERROR  No file(s) found for glob /var/log/httpd/*error_log
Jan 24 13:11:07 code fail2ban-client: ERROR  Failed during configuration: Have not found any log file for apache-auth jail

Jan 24 13:11:00 code setroubleshoot: SELinux is preventing /usr/bin/python2.7 from read access on the directory /var/log/httpd. For complete SELinux messages. run sealert -l ca28c547-d432-40b8-9771-fe2b278984bb
Jan 24 13:11:02 code setroubleshoot: SELinux is preventing /usr/bin/python2.7 from read access on the directory /var/log/httpd. For complete SELinux messages. run sealert -l ca28c547-d432-40b8-9771-fe2b278984bb


Expected results:

fail2ban should work, or there should be documentation on how to get fail2ban to access httpd logs.

Additional info:

Comment 1 Orion Poplawski 2014-01-28 00:02:00 UTC
fail2ban is going to want to read just about anything in /var/log - upstream is developing all kinds of filters on various logfiles.

Comment 2 Miroslav Grepl 2014-01-28 10:08:58 UTC
We have

allow fail2ban_t httpd_log_t : file { ioctl read getattr lock open } 

on F20. Could you attach raw AVC msg?

Comment 3 Derek Atkins 2014-01-28 13:10:03 UTC
Unfortunately, no.  Running "sealert" fails.  If I look at /var/log/audit/audit.log I see:

type=AVC msg=audit(1390585797.652:481): avc:  denied  { read } for  pid=603 comm
="fail2ban-client" name="httpd" dev="sda2" ino=172154 scontext=system_u:system_r
:fail2ban_client_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=dir

So if you have that "allow" it doesn't look like it's there.
I've got: selinux-policy-targeted-3.12.1-119.fc20.noarch

Comment 4 Orion Poplawski 2014-01-28 16:31:16 UTC
Hmm, perhaps fail2ban-client is now doing more checks at startup before starting the daemon.

Comment 5 Miroslav Grepl 2014-01-29 08:33:01 UTC
commit a3eaf0abf7dcbc9c1bdf41c34375f1f6268e1cd2
Author: Miroslav Grepl <mgrepl@redhat.com>
Date:   Wed Jan 29 09:32:37 2014 +0100

    ALlow also fail2ban-client to read apache logs

Comment 6 Fedora Update System 2014-01-29 10:37:34 UTC
selinux-policy-3.12.1-122.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/FEDORA-2014-1700/selinux-policy-3.12.1-122.fc20

Comment 7 Fedora Update System 2014-01-30 03:32:24 UTC
Package selinux-policy-3.12.1-122.fc20:
* should fix your issue,
* was pushed to the Fedora 20 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.12.1-122.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-1700/selinux-policy-3.12.1-122.fc20
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2014-02-12 14:44:13 UTC
selinux-policy-3.12.1-122.fc20 has been pushed to the Fedora 20 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.