Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
I had some challenges reproducing this later when trying and found that this can only currently be reproduced in 8.0, either by installing 8.0 and not updating to 8.1 or by switching to the 8.0 track.
Updates included in 8.1 appear to have resolved the specifically reported issue.
On an 8.0 fresh install:
[root@localhost ~]# rpm -qa selinux\* | sort
selinux-policy-3.14.1-61.el8.noarch
selinux-policy-targeted-3.14.1-61.el8.noarch
[root@localhost ~]# ls -Z `which nft`
system_u:object_r:bin_t:s0 /usr/sbin/nft
[root@localhost ~]# matchpathcon `which nft`
/usr/sbin/nft system_u:object_r:bin_t:s0
On a host updated to 8.1:
[root@r8-test1 ~]# rpm -qa selinux\* | sort
selinux-policy-3.14.3-20.el8.noarch
selinux-policy-targeted-3.14.3-20.el8.noarch
[root@r8-test1 ~]# ls -Z `which nft`
system_u:object_r:iptables_exec_t:s0 /usr/sbin/nft
[root@r8-test1 ~]# matchpathcon `which nft`
/usr/sbin/nft system_u:object_r:iptables_exec_t:s0
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2020:1773
Description of problem: Attempting to use fail2ban with it's nftables actions results in a failure as a result of selinux blocking access to netfilter socket. Version-Release number of selected component (if applicable): How reproducible: Always when using the nftables action Steps to Reproduce: 1. Install fail2ban from epel 2. Configure it to use banaction = nftables-multiport 3. Start the service Actual results: Fail2ban fails to add it's initial set and rule. e.g. 2019-10-29 08:17:15,115 fail2ban.utils [709]: #39-Lev. 7f37701a8d20 -- exec: nft add set inet filter f2b-sshd \{ type ipv4_addr\; \} nft insert rule inet filter input tcp dport \{ ssh \} ip saddr @f2b-sshd reject 2019-10-29 08:17:15,115 fail2ban.utils [709]: ERROR 7f37701a8d20 -- stderr: 'netlink.c:62: Unable to initialize Netlink socket: Permission denied' 2019-10-29 08:17:15,116 fail2ban.utils [709]: ERROR 7f37701a8d20 -- stderr: 'netlink.c:62: Unable to initialize Netlink socket: Permission denied' 2019-10-29 08:17:15,116 fail2ban.utils [709]: ERROR 7f37701a8d20 -- returned 3 Expected results: Fail2ban is able to create rules/sets using nftables the same way that it can with iptables and firewall-cmd. Additional info: SELinux Enforcing audit log: type=AVC msg=audit(1572312631.453:443): avc: denied { create } for pid=6442 comm="nft" scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:system_r:fail2ban_t:s0 tclass=netlink_netfilter_socket permissive=0 type=SYSCALL msg=audit(1572312631.453:443): arch=c000003e syscall=41 success=no exit=-13 a0=10 a1=3 a2=c a3=560750d5e010 items=0 ppid=6441 pid=6442 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="nft" exe="/usr/sbin/nft" subj=system_u:system_r:fail2ban_t:s0 key=(null)ARCH=x86_64 SYSCALL=socket AUID="unset" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" type=AVC msg=audit(1572312631.455:444): avc: denied { create } for pid=6441 comm="nft" scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:system_r:fail2ban_t:s0 tclass=netlink_netfilter_socket permissive=0 type=SYSCALL msg=audit(1572312631.455:444): arch=c000003e syscall=41 success=no exit=-13 a0=10 a1=3 a2=c a3=55ec973b5010 items=0 ppid=6435 pid=6441 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="nft" exe="/usr/sbin/nft" subj=system_u:system_r:fail2ban_t:s0 key=(null)ARCH=x86_64 SYSCALL=socket AUID="unset" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" SELinux Permissive audit log: type=AVC msg=audit(1572312672.597:463): avc: denied { setopt } for pid=6480 comm="nft" scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:system_r:fail2ban_t:s0 tclass=netlink_netfilter_socket permissive=1 type=SYSCALL msg=audit(1572312672.597:463): arch=c000003e syscall=54 success=yes exit=0 a0=3 a1=1 a2=20 a3=7ffd9825074c items=0 ppid=6479 pid=6480 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="nft" exe="/usr/sbin/nft" subj=system_u:system_r:fail2ban_t:s0 key=(null)ARCH=x86_64 SYSCALL=setsockopt AUID="unset" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" Audit2allow generated rule from audit log: #============= fail2ban_t ============== allow fail2ban_t self:netlink_netfilter_socket { create setopt };