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.
Bug 1777562 - Update to fail2ban 0.10.4 requires adaption of SELinux policy
Summary: Update to fail2ban 0.10.4 requires adaption of SELinux policy
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.7
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Zdenek Pytela
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-27 20:17 UTC by Robert Scheck
Modified: 2023-12-15 17:00 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-10 17:20:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Robert Scheck 2019-11-27 20:17:06 UTC
Description of problem:
After updating fail2ban from 0.9.7 to 0.10.4 (from EPEL), some AVC denied messages are raised (below copy & paste might origin from different systems, but each message occured on each system):

type=AVC msg=audit(1574695222.87:338081): avc:  denied  { read } for  pid=51600 comm="fail2ban-server" name="disable" dev="sysfs" ino=4296 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=0
type=SYSCALL msg=audit(1574695222.87:338081): arch=x86_64 syscall=open success=no exit=EACCES a0=7f394c5f7110 a1=80000 a2=1b6 a3=24 items=0 ppid=1 pid=51600 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

type=AVC msg=audit(1574729848.51:345109): avc:  denied  { open } for  pid=60026 comm="fail2ban-server" path="/sys/module/ipv6/parameters/disable" dev="sysfs" ino=4296 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=0
type=SYSCALL msg=audit(1574729848.51:345109): arch=x86_64 syscall=open success=no exit=EACCES a0=7f993bbf0110 a1=80000 a2=1b6 a3=24 items=0 ppid=1 pid=60026 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

type=AVC msg=audit(1574840369.454:471274): avc:  denied  { search } for  pid=51600 comm="fail2ban-server" name="net" dev="proc" ino=332 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=dir permissive=0
type=SYSCALL msg=audit(1574840369.454:471274): arch=x86_64 syscall=open success=no exit=EACCES a0=7f394c5f7138 a1=80000 a2=1b6 a3=24 items=0 ppid=1 pid=51600 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

type=AVC msg=audit(1574840369.453:471273): avc:  denied  { getattr } for  pid=51600 comm="fail2ban-server" path="/sys/module/ipv6/parameters/disable" dev="sysfs" ino=4296 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=0
type=SYSCALL msg=audit(1574840369.453:471273): arch=x86_64 syscall=fstat success=no exit=EACCES a0=9 a1=7f395b242e30 a2=7f395b242e30 a3=0 items=0 ppid=1 pid=51600 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

type=AVC msg=audit(1574885547.891:508939): avc:  denied  { read } for  pid=41351 comm="fail2ban-server" name="disable_ipv6" dev="proc" ino=362 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file permissive=0
type=SYSCALL msg=audit(1574885547.891:508939): arch=x86_64 syscall=open success=no exit=EACCES a0=7fa6d05f7138 a1=80000 a2=1b6 a3=24 items=0 ppid=1 pid=41351 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

type=AVC msg=audit(1574885623.670:509015): avc:  denied  { open } for  pid=41535 comm="fail2ban-server" path="/proc/sys/net/ipv6/conf/all/disable_ipv6" dev="proc" ino=362 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file permissive=0
type=SYSCALL msg=audit(1574885623.670:509015): arch=x86_64 syscall=open success=no exit=EACCES a0=7fce681ad138 a1=80000 a2=1b6 a3=24 items=0 ppid=1 pid=41535 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

type=AVC msg=audit(1574885664.477:509068): avc:  denied  { getattr } for  pid=41672 comm="fail2ban-server" path="/proc/sys/net/ipv6/conf/all/disable_ipv6" dev="proc" ino=362 scontext=system_u:system_r:fail2ban_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file permissive=0
type=SYSCALL msg=audit(1574885664.477:509068): arch=x86_64 syscall=fstat success=no exit=EACCES a0=12 a1=7ffff1a8abc0 a2=7ffff1a8abc0 a3=0 items=0 ppid=1 pid=41672 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=fail2ban-server exe=/usr/bin/python2.7 subj=system_u:system_r:fail2ban_t:s0 key=(null)

Given /sys/module/ipv6/parameters/disable was tried to access, I found this is likely due to socket_ipv6_is_supported() which belongs to systemd code. This again seems to belong to libnss_myhostname.so.2, which is referenced in /etc/nsswitch.conf, which seems to be called during some "getent host" operation or similar (as per bug #1444824). As the new fail2ban version introduces IPv6 support, there seems to be a good chance for an overlap - and as conclusion some allow rules for the SELinux policy.

Version-Release number of selected component (if applicable):
fail2ban-server-0.10.4-1.el7.noarch
selinux-policy-targeted-3.13.1-252.el7.1.noarch

How reproducible:
Everytime, update from fail2ban 0.9.7 to 0.10.4 (from EPEL)

Actual results:
Update to fail2ban 0.10.4 requires adaption of SELinux policy

Expected results:
Adapted SELinux policy :)

Additional info:
The following allow rules seem to do the trick here:

allow fail2ban_t sysfs_t:file { getattr open read };
allow fail2ban_t sysctl_net_t:dir { search };
allow fail2ban_t sysctl_net_t:file { getattr open read };

Comment 2 Robert Scheck 2019-11-27 20:28:25 UTC
Cross-filed ticket 02529186 at the Red Hat customer portal.

Comment 3 Orion Poplawski 2019-11-29 22:46:29 UTC
Lukas - perhaps time to move the SELinux config into the fail2ban package?  There are a number of other fail2ban SELinux issues on EL.

Comment 4 Orion Poplawski 2019-11-30 02:25:28 UTC
I guess one complication - the standard SELinux requires uses rich dependencies which is not supported on EL7:

Requires: (%{name}-selinux if selinux-policy-%{selinuxtype})

so I'm not sure what would be the best way to proceed.

Comment 5 Orion Poplawski 2019-11-30 02:36:29 UTC
This moves the current policy into the fail2ban package: https://src.fedoraproject.org/rpms/fail2ban/pull-request/2

Comment 6 Lukas Vrabec 2019-12-02 12:28:04 UTC
Hi Orion, 

Thank you very much for the PR. Let's deliver this in Fedora and RHEL-8. For RHEL-7 let's keep it in selinux-policy. 

Thanks,
Lukas.

Comment 8 Lukas Vrabec 2019-12-09 14:30:19 UTC
This issue was not selected to be included in Red Hat Enterprise Linux 7 because it is seen either as low or moderate impact to a small number of use-cases. Current minor release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise, we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.

Comment 14 Orion Poplawski 2020-02-27 03:06:56 UTC
Lukas - do you have a suggestion for the way forward here on EL7?  The SELinux IndependentPolicy guidelines use conditional dependencies that do not work in EL7.

Comment 15 Lukas Vrabec 2020-02-27 22:18:29 UTC
@Vito, 

Do we have a way to deliver fail2ban policy in EL7?

Comment 16 prasun.gera 2020-04-02 19:06:58 UTC
I am seeing these denials too along with other SELinux issues on RHEL 7. If there is an overall decision to update the selinux-policy package in RHEL 7, I would appreciate it. For instance, this is another bug that is affected by selinux-policy (https://bugzilla.redhat.com/show_bug.cgi?id=1657549).

Comment 17 Vit Mojzis 2020-06-04 16:10:38 UTC
(In reply to Lukas Vrabec from comment #15)
> @Vito, 
> 
> Do we have a way to deliver fail2ban policy in EL7?

You can use unconditional "Requires: selinux-policy-targeted". It's not ideal (the policy and the whole selinux userspace would be pulled as a dependency even into containers or other systems that do not use SELinux), but it works (it was the preferred method before conditional "requires" became available).


Note You need to log in before you can comment on or make changes to this bug.