Bug 495267

Summary: SELinux blocks failtoban
Product: [Fedora] Fedora Reporter: Mike <somedamfool>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: dwalsh, frankly3d, jkubin, mgrepl, mmcallis
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-11 12:29:31 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 Mike 2009-04-11 00:09:22 UTC
Description of problem: SELinux interfering with failtoban


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


How reproducible:With failtoban enabled SELinux generates an error every 5-10 seconds. I had over 9600 errors in about 24 hours.

Summary: SELinux is preventing gam_server (fail2ban_t) "read" to ./rpm (rpm_var_lib_t).

Detailed Description:

SELinux denied access requested by gam_server. It is not expected that this
access is required by gam_server and this access may signal an intrusion
attempt. It is also possible that the specific version or configuration of the
application is causing it to require additional access.

Allowing Access:

Sometimes labeling problems can cause SELinux denials. You could try to restore
the default system file context for ./rpm,

restorecon -v './rpm'

If this does not work, there is currently no automatic way to allow this access.
Instead, you can generate a local policy module to allow this access - see FAQ
(http://fedora.redhat.com/docs/selinux-faq-fc5/#id2961385) Or you can disable
SELinux protection altogether. Disabling SELinux protection is not recommended.
Please file a bug report (http://bugzilla.redhat.com/bugzilla/enter_bug.cgi)
against this package.

Additional Information:

Source Context                system_u:system_r:fail2ban_t:s0
Target Context                system_u:object_r:rpm_var_lib_t:s0
Target Objects                ./rpm [ dir ]
Source                        gam_server
Source Path                   /usr/libexec/gam_server
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           gamin-0.1.9-6.fc10
Target RPM Packages           
Policy RPM                    selinux-policy-3.5.13-54.fc10
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   catchall_file
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain
                              2.6.27.21-170.2.56.fc10.i686 #1 SMP Mon Mar 23
                              23:37:54 EDT 2009 i686 athlon
Alert Count                   23
First Seen                    Thu 09 Apr 2009 08:50:08 PM EDT
Last Seen                     Thu 09 Apr 2009 08:51:36 PM EDT
Local ID                      75ebce71-d082-46a6-8ee8-5850f5344683
Line Numbers                  

Raw Audit Messages            

node=localhost.localdomain type=AVC msg=audit(1239324696.103:6737): avc:  denied  { read } for  pid=2329 comm="gam_server" name="rpm" dev=dm-0 ino=2654211 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:rpm_var_lib_t:s0 tclass=dir

node=localhost.localdomain type=SYSCALL msg=audit(1239324696.103:6737): arch=40000003 syscall=292 success=no exit=-13 a0=3 a1=8d81340 a2=1002fc6 a3=acb140 items=0 ppid=1 pid=2329 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="gam_server" exe="/usr/libexec/gam_server" subj=system_u:system_r:fail2ban_t:s0 key=(null)


Steps to Reproduce:
1.Run failtoban
2.Run SELinux
3.
  
Actual results:
I tried the suggested restorecon -v './rpm' with these results: restorecon:  stat error on ./rpm:  No such file or directory

Expected results:


Additional info:

Comment 1 Murray McAllister 2009-04-11 00:44:24 UTC
This looks like an selinux-policy issue. Changing components.

You could try "restorecon -R -v /var" as the root user or with sudo...

Comment 2 Frank Murphy 2009-04-11 11:45:33 UTC
(In reply to comment #1)
> This looks like an selinux-policy issue. Changing components.
> 
> You could try "restorecon -R -v /var" as the root user or with sudo...  

This is a problem with fail2ban and gam, disable gam

as per:
https://bugzilla.redhat.com/show_bug.cgi?id=483510

Comment 3 Daniel Walsh 2009-04-11 12:29:31 UTC

*** This bug has been marked as a duplicate of bug 483510 ***

Comment 4 Mike 2009-04-12 20:55:58 UTC
I changed the line in failtoban from backend = auto to backend = polling as suggested in bug report #483510. I have had failtoban running for 6 hours now and haven't had one SELinux warning. Problem solved.
Mike