Bug 746127

Summary: SELinux is preventing fail2ban from using shorewall for actions
Product: [Fedora] Fedora Reporter: Paul Collins <paul.collins.iii>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: Axel.Thimm, dominick.grift, dwalsh, jonathan.underwood, mgrepl, paul.collins.iii
Target Milestone: ---Keywords: SELinux
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:bce6a8d686842156f15f1eab4db856712da9968b0b1d9c6d52fda435880d5d00
Fixed In Version: selinux-policy-3.9.16-48.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-04 02:37:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Collins 2011-10-14 00:56:25 UTC
SELinux is preventing /bin/bash from 'getattr' accesses on the file /sbin/shorewall.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that bash should be allowed getattr access on the shorewall file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep sh /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:fail2ban_t:s0
Target Context                system_u:object_r:shorewall_exec_t:s0
Target Objects                /sbin/shorewall [ file ]
Source                        sh
Source Path                   /bin/bash
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           bash-4.2.10-4.fc15
Target RPM Packages           shorewall-4.4.23.3-1.fc15
Policy RPM                    selinux-policy-3.9.16-39.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.40.6-0.fc15.x86_64 #1 SMP Tue
                              Oct 4 00:39:50 UTC 2011 x86_64 x86_64
Alert Count                   18
First Seen                    Tue 11 Oct 2011 12:14:56 PM PDT
Last Seen                     Thu 13 Oct 2011 05:33:03 PM PDT
Local ID                      5abde676-7810-4891-8266-8546320593a9

Raw Audit Messages
type=AVC msg=audit(1318552383.104:1108): avc:  denied  { getattr } for  pid=14734 comm="sh" path="/sbin/shorewall" dev=dm-0 ino=22256 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:shorewall_exec_t:s0 tclass=file


type=SYSCALL msg=audit(1318552383.104:1108): arch=x86_64 syscall=stat success=no exit=EACCES a0=22ff860 a1=7fff6c8ce8f0 a2=7fff6c8ce8f0 a3=fffffffffffffff0 items=0 ppid=1534 pid=14734 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=sh exe=/bin/bash subj=system_u:system_r:fail2ban_t:s0 key=(null)

Hash: sh,fail2ban_t,shorewall_exec_t,file,getattr

audit2allow

#============= fail2ban_t ==============
allow fail2ban_t shorewall_exec_t:file getattr;

audit2allow -R

#============= fail2ban_t ==============
allow fail2ban_t shorewall_exec_t:file getattr;

Comment 1 Miroslav Grepl 2011-10-14 07:47:18 UTC
Does fail2ban want to execute shorewall?

Comment 2 Paul Collins 2011-10-14 21:51:53 UTC
As far as I understand yes. It wants to be able to do a "shorewall drop [IP]" when it detects a violation. 

Note that this is not the default config as the fail2ban rpm config likes to do things directly in IPTables, but since I have shorewall installed I configured it to use shorewall to do the drops.

Comment 3 Miroslav Grepl 2011-10-18 07:01:12 UTC
Make sense.

Fixed in selinux-policy-3.9.16-44.fc15

Comment 4 Fedora Update System 2011-11-16 16:19:01 UTC
selinux-policy-3.9.16-48.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-48.fc15

Comment 5 Fedora Update System 2011-11-17 23:37:22 UTC
Package selinux-policy-3.9.16-48.fc15:
* should fix your issue,
* was pushed to the Fedora 15 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.9.16-48.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-16023/selinux-policy-3.9.16-48.fc15
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2011-12-04 02:37:19 UTC
selinux-policy-3.9.16-48.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.