Bug 1069640 - [fail2ban_t] SELinux is preventing /usr/sbin/ipset from create access on the netlink_socket
Summary: [fail2ban_t] SELinux is preventing /usr/sbin/ipset from create access on the ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-25 13:00 UTC by Juan Orti
Modified: 2014-03-21 09:25 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.12.1-135.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-21 09:25:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Juan Orti 2014-02-25 13:00:35 UTC
I'm trying to use fail2ban to ban IPs using ipset and firewall-cmd. This setup will probably arrive soon at fail2ban, see bug #1046816


SELinux is preventing /usr/sbin/ipset from create access on the netlink_socket .

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

If you believe that ipset should be allowed create access on the  netlink_socket 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 ipset /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:system_r:fail2ban_t:s0
Target Objects                 [ netlink_socket ]
Source                        ipset
Source Path                   /usr/sbin/ipset
Port                          <Unknown>
Host                          <removed>
Source RPM Packages           ipset-6.20.1-1.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-122.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     <removed>
Platform                      Linux <removed> 3.13.3-201.fc20.x86_64
                              #1 SMP Fri Feb 14 19:08:32 UTC 2014 x86_64 x86_64
Alert Count                   1
First Seen                    2014-02-25 13:43:14 CET
Last Seen                     2014-02-25 13:43:14 CET
Local ID                      553c5106-a2ad-44da-b332-f3f5e0f1318d

Raw Audit Messages
type=AVC msg=audit(1393332194.460:196700): avc:  denied  { create } for  pid=6705 comm="ipset" scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:system_r:fail2ban_t:s0 tclass=netlink_socket


type=SYSCALL msg=audit(1393332194.460:196700): arch=x86_64 syscall=socket success=no exit=EACCES a0=10 a1=3 a2=c a3=7fff73c440a0 items=0 ppid=6704 pid=6705 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=ipset exe=/usr/sbin/ipset subj=system_u:system_r:fail2ban_t:s0 key=(null)

Hash: ipset,fail2ban_t,fail2ban_t,netlink_socket,create

Comment 1 Juan Orti 2014-02-25 13:02:54 UTC
SELinux is preventing /usr/sbin/ipset from bind access on the netlink_socket .

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

If you believe that ipset should be allowed bind access on the  netlink_socket 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 ipset /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:system_r:fail2ban_t:s0
Target Objects                 [ netlink_socket ]
Source                        ipset
Source Path                   /usr/sbin/ipset
Port                          <Unknown>
Host                          <removed>
Source RPM Packages           ipset-6.20.1-1.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-122.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     <removed>
Platform                      Linux <removed> 3.13.3-201.fc20.x86_64
                              #1 SMP Fri Feb 14 19:08:32 UTC 2014 x86_64 x86_64
Alert Count                   1
First Seen                    2014-02-25 13:59:29 CET
Last Seen                     2014-02-25 13:59:29 CET
Local ID                      e32d3ec8-0f2a-4d22-967b-e187c5a7b95f

Raw Audit Messages
type=AVC msg=audit(1393333169.675:197126): avc:  denied  { bind } for  pid=7219 comm="ipset" scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:system_r:fail2ban_t:s0 tclass=netlink_socket


type=SYSCALL msg=audit(1393333169.675:197126): arch=x86_64 syscall=bind success=no exit=EACCES a0=3 a1=1df46f4 a2=c a3=7fff269f2370 items=0 ppid=6690 pid=7219 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=ipset exe=/usr/sbin/ipset subj=system_u:system_r:fail2ban_t:s0 key=(null)

Hash: ipset,fail2ban_t,fail2ban_t,netlink_socket,bind

Comment 2 Daniel Walsh 2014-02-26 17:53:32 UTC
If we label ipset as iptables_exec_t does this fix the problem?

chcon -t iptables_exec_t /usr/sbin/ipset

Comment 3 Miroslav Grepl 2014-02-27 10:26:01 UTC
Added to rawhide.

commit 579906616da011bb20f248507995a404c2664c42
Author: Miroslav Grepl <mgrepl>
Date:   Thu Feb 27 11:25:38 2014 +0100

    Add support for ipset

Comment 4 Juan Orti 2014-02-27 10:57:55 UTC
(In reply to Daniel Walsh from comment #2)
> If we label ipset as iptables_exec_t does this fix the problem?
> 
> chcon -t iptables_exec_t /usr/sbin/ipset

It works. Thank you.

Comment 5 Miroslav Grepl 2014-02-27 14:00:53 UTC
thank you for testing.

Comment 6 Fedora Update System 2014-03-12 07:19:40 UTC
selinux-policy-3.12.1-135.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-135.fc20

Comment 7 Fedora Update System 2014-03-13 05:10:52 UTC
Package selinux-policy-3.12.1-135.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-135.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-3813/selinux-policy-3.12.1-135.fc20
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2014-03-21 09:25:37 UTC
selinux-policy-3.12.1-135.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.