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 1977676 - SELinux prevents the hostapd from binding to DHCP port
Summary: SELinux prevents the hostapd from binding to DHCP port
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: beta
: 8.5
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
: 1976910 (view as bug list)
Depends On:
Blocks: 1979968
TreeView+ depends on / blocked
 
Reported: 2021-06-30 09:14 UTC by Filip Pokryvka
Modified: 2021-11-10 08:38 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.14.3-75.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 1979968 (view as bug list)
Environment:
Last Closed: 2021-11-09 19:43:34 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4420 0 None None None 2021-11-09 19:44:02 UTC

Description Filip Pokryvka 2021-06-30 09:14:50 UTC
Description of problem:
NetworkManager-ci configures hostapd and the tests started to fail since RHEL8.5 (tests worked before).

Denied audit messages:
type=AVC msg=audit(1625040334.828:154): avc:  denied  { name_bind } for  pid=3772 comm="hostapd" src=67 scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:object_r:dhcpd_port_t:s0 tclass=udp_socket permissive=0
type=AVC msg=audit(1625040402.016:190): avc:  denied  { name_bind } for  pid=4370 comm="hostapd" src=67 scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:object_r:dhcpd_port_t:s0 tclass=udp_socket permissive=0
type=AVC msg=audit(1625040575.909:204): avc:  denied  { name_bind } for  pid=4652 comm="hostapd" src=67 scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:object_r:dhcpd_port_t:s0 tclass=udp_socket permissive=1
type=AVC msg=audit(1625040575.909:204): avc:  denied  { net_bind_service } for  pid=4652 comm="hostapd" capability=10  scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:system_r:hostapd_t:s0 tclass=capability permissive=1


Version-Release number of selected component (if applicable):
selinux-policy-3.14.3-67.el8.noarch

How reproducible:
always

Steps to Reproduce:
1. clone NetworkManager-ci repo from https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/
2. checkout this commit: b7b0f9f1c3ba42f15fd7c6f31cb504ec0dd5347e
3. bash prepare/hostapd_wired.sh tmp/8021x/certs/

Actual results:
hostapd fails to start (selinux)

Expected results:
hostapd should start

Additional info:
step 2 is required because we compiled custom selinux module as workaround.

Comment 1 Milos Malik 2021-06-30 17:55:12 UTC
There is only 1 SELinux denial in enforcing mode:
----
type=PROCTITLE msg=audit(06/30/2021 13:52:15.468:343) : proctitle=/usr/sbin/hostapd -ddd /etc/hostapd/wired.conf 
type=SOCKADDR msg=audit(06/30/2021 13:52:15.468:343) : saddr={ saddr_fam=inet laddr=0.0.0.0 lport=67 } 
type=SYSCALL msg=audit(06/30/2021 13:52:15.468:343) : arch=x86_64 syscall=bind success=no exit=EACCES(Permission denied) a0=0x5 a1=0x7fffba09d9c0 a2=0x10 a3=0x7fffba09d9f0 items=0 ppid=1 pid=6343 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=hostapd exe=/usr/sbin/hostapd subj=system_u:system_r:hostapd_t:s0 key=(null) 
type=AVC msg=audit(06/30/2021 13:52:15.468:343) : avc:  denied  { name_bind } for  pid=6343 comm=hostapd src=67 scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:object_r:dhcpd_port_t:s0 tclass=udp_socket permissive=0 
----

Here are SELinux denials caught in permissive mode:
----
type=PROCTITLE msg=audit(06/30/2021 13:52:56.525:356) : proctitle=/usr/sbin/hostapd -ddd /etc/hostapd/wired.conf 
type=SOCKADDR msg=audit(06/30/2021 13:52:56.525:356) : saddr={ saddr_fam=inet laddr=0.0.0.0 lport=67 } 
type=SYSCALL msg=audit(06/30/2021 13:52:56.525:356) : arch=x86_64 syscall=bind success=yes exit=0 a0=0x5 a1=0x7fffde3a3090 a2=0x10 a3=0x7fffde3a30c0 items=0 ppid=1 pid=6516 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=hostapd exe=/usr/sbin/hostapd subj=system_u:system_r:hostapd_t:s0 key=(null) 
type=AVC msg=audit(06/30/2021 13:52:56.525:356) : avc:  denied  { net_bind_service } for  pid=6516 comm=hostapd capability=net_bind_service  scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:system_r:hostapd_t:s0 tclass=capability permissive=1 
type=AVC msg=audit(06/30/2021 13:52:56.525:356) : avc:  denied  { name_bind } for  pid=6516 comm=hostapd src=67 scontext=system_u:system_r:hostapd_t:s0 tcontext=system_u:object_r:dhcpd_port_t:s0 tclass=udp_socket permissive=1 
----

# rpm -qa hostapd\*
hostapd-2.9-5.el8.x86_64
#

Comment 2 Filip Pokryvka 2021-07-01 07:09:43 UTC
*** Bug 1976910 has been marked as a duplicate of this bug. ***

Comment 6 Zdenek Pytela 2021-07-28 15:46:20 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/812

Comment 7 Zdenek Pytela 2021-07-28 20:12:57 UTC
Commit to backport:

commit 636f4944a991a6d1de6b929b57049058cd6746c5 (HEAD -> rawhide, upstream/rawhide)
Author: Zdenek Pytela <zpytela>
Date:   Wed Jul 28 17:45:07 2021 +0200

    Allow hostapd bind UDP sockets to the dhcpd port

Comment 18 errata-xmlrpc 2021-11-09 19:43:34 UTC
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 (selinux-policy bug fix and enhancement update), 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-2021:4420


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