Bug 1119002

Summary: SELinux is preventing /usr/bin/python2.7 from 'search' accesses on the directory .
Product: [Fedora] Fedora Reporter: Alick Zhao <alick9188>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:63aa0ceb1f4e49daa871290250a95cc73fc160b971ba673a17388d6d33a76150
Fixed In Version: selinux-policy-3.12.1-179.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-26 15:59:59 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 Alick Zhao 2014-07-13 02:41:32 UTC
Description of problem:
The alert pop up when I try to start fail2ban.service

$ sudo systemctl status fail2ban.service 
fail2ban.service - Fail2ban Service
   Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled)
   Active: failed (Result: start-limit) since 日 2014-07-13 10:38:13 CST; 6s ago
  Process: 1989 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)

7月 13 10:38:13 neon systemd[1]: fail2ban.service holdoff time over, scheduling restart.
7月 13 10:38:13 neon systemd[1]: Stopping Fail2ban Service...
7月 13 10:38:13 neon systemd[1]: Starting Fail2ban Service...
7月 13 10:38:13 neon systemd[1]: fail2ban.service start request repeated too quickly, refusing to start.
7月 13 10:38:13 neon systemd[1]: Failed to start Fail2ban Service.
7月 13 10:38:13 neon systemd[1]: Unit fail2ban.service entered failed state.
SELinux is preventing /usr/bin/python2.7 from 'search' accesses on the directory .

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

If 您确定应默认允许 python2.7 search 访问  directory。
Then 您应该将这个情况作为 bug 报告。
您可以生成本地策略模块允许这个访问。
Do
请执行以下命令此时允许这个访问:
# grep fail2ban-client /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:fail2ban_client_t:s0
Target Context                system_u:object_r:auditd_log_t:s0
Target Objects                 [ dir ]
Source                        fail2ban-client
Source Path                   /usr/bin/python2.7
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           python-2.7.5-13.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-176.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.14.9-200.fc20.x86_64 #1 SMP Thu
                              Jun 26 21:40:51 UTC 2014 x86_64 x86_64
Alert Count                   5
First Seen                    2014-07-13 10:38:10 CST
Last Seen                     2014-07-13 10:38:13 CST
Local ID                      047eb022-b860-45e2-ba30-ba6364f0b956

Raw Audit Messages
type=AVC msg=audit(1405219093.315:129882): avc:  denied  { search } for  pid=1989 comm="fail2ban-client" name="audit" dev="dm-0" ino=1720722 scontext=system_u:system_r:fail2ban_client_t:s0 tcontext=system_u:object_r:auditd_log_t:s0 tclass=dir


type=SYSCALL msg=audit(1405219093.315:129882): arch=x86_64 syscall=lstat success=no exit=EACCES a0=22ffbd0 a1=7fff59b3c070 a2=7fff59b3c070 a3=0 items=0 ppid=1 pid=1989 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-client exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_client_t:s0 key=(null)

Hash: fail2ban-client,fail2ban_client_t,auditd_log_t,dir,search

Additional info:
reporter:       libreport-2.2.2
hashmarkername: setroubleshoot
kernel:         3.14.9-200.fc20.x86_64
type:           libreport

Comment 1 Alick Zhao 2014-07-13 02:54:55 UTC
This happens if I want to enable the selinux-ssh jail. Otherwise fail2ban starts fine.

Comment 2 Miroslav Grepl 2014-07-16 10:53:20 UTC
https://github.com/selinux-policy/selinux-policy/commit/85d78da6d435a725b45e42fb051b5acd1d5b00d1

commit 2a860963fcc040f3a8fcf4d20863fc2d13b10703
Author: Miroslav Grepl <mgrepl>
Date:   Wed Jul 16 12:51:43 2014 +0200

    Dontaudit search audit logs for fail2ban

Comment 3 Fedora Update System 2014-07-24 08:47:41 UTC
selinux-policy-3.12.1-179.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-179.fc20

Comment 4 Fedora Update System 2014-07-25 10:06:34 UTC
Package selinux-policy-3.12.1-179.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-179.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-8830/selinux-policy-3.12.1-179.fc20
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2014-07-26 15:59:59 UTC
selinux-policy-3.12.1-179.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.