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 1950714 - SELinux is preventing /usr/sbin/named from 'name_bind' accesses on the udp_socket port 61000.
Summary: SELinux is preventing /usr/sbin/named from 'name_bind' accesses on the udp_so...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: bind
Version: 8.3
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: Petr Menšík
QA Contact: Petr Sklenar
URL:
Whiteboard:
Depends On:
Blocks: 2013595 2013597 2144069
TreeView+ depends on / blocked
 
Reported: 2021-04-18 05:05 UTC by Peter Tselios
Modified: 2023-01-02 13:01 UTC (History)
7 users (show)

Fixed In Version: bind-9.11.26-8.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2013595 2013597 (view as bug list)
Environment:
Last Closed: 2022-05-10 15:29:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2022:2092 0 None None None 2022-05-10 15:29:57 UTC

Description Peter Tselios 2021-04-18 05:05:19 UTC
Description of problem:

This is a duplicate issue of the https://bugzilla.redhat.com/show_bug.cgi?id=1272835. However, this time is on a RHEL 8.3 server. 

Journal is full of those messages:
=======
SELinux is preventing /usr/sbin/named from name_bind access on the udp_socket port 61000. For complete SELinux messages >
AnalyzeThread.run(): Set alarm timeout to 10
SELinux is preventing /usr/sbin/named from name_bind access on the udp_socket port 61000.

*****  Plugin catchall_boolean (89.3 confidence) suggests   ******************

If you want to allow nis to enabled
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.

Do
setsebool -P nis_enabled 1

*****  Plugin catchall (11.6 confidence) suggests   **************************

If you believe that named should be allowed name_bind access on the port 61000 udp_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:
# ausearch -c 'named' --raw | audit2allow -M my-named
# semodule -X 300 -i my-named.pp
========

Version-Release number of selected component (if applicable):

selinux-policy-targeted-3.14.3-54.el8_3.3.noarch

How reproducible:
Install named with chroot in a RHEL 8.3 systems

Comment 1 Zdenek Pytela 2021-04-19 18:23:41 UTC
Switching the component to bind for the maintainer to assess.

Comment 3 Petr Menšík 2021-10-12 13:53:06 UTC
BIND reads ephemeral values from /proc/sys/net/ipv4/ip_local_port_range file during startup. It should adjust its used range during startup, reported in log.

journalctl -xeu named | grep 'port range'
...named[5001]: using default UDP/IPv4 port range: [32768, 60999]

However, bind-chroot package and named-chroot service do not propagate /proc to chroot, so it cannot read used range from the system. It therefore falls back to defaults, which are blocked by selinux.

journalctl -xeu named-chroot | grep 'port range'
named[5126]: using default UDP/IPv6 port range: [1024, 65535]

It would therefore use also blocked ports by SELinux in this case. I think we do not want whole /proc propagated into chroot for security reasons. But I guess this single file should be propagated there.

Possible workarounds are:
- Not using bind-chroot/named-chroot, but using just named.service. With SELinux enforcing mode it should be well protected even without chroot. chroot is a weak protection compared to SELinux.
- mkdir -p /var/named/chroot/proc/sys/net/ipv4; add /proc/sys/net/ipv4/ip_local_port_range to /etc/named-chroot.files before /var/named
- Add into options section in /etc/named.conf:
        use-v4-udp-ports { range 32768 60999; };
        use-v6-udp-ports { range 32768 60999; };

Comment 4 Zdenek Pytela 2021-10-12 16:32:02 UTC
(In reply to Petr Menšík from comment #3)
> Possible workarounds are:
> - Not using bind-chroot/named-chroot, but using just named.service. With
> SELinux enforcing mode it should be well protected even without chroot.
> chroot is a weak protection compared to SELinux.
Personally, I'd not stop using chroot, especially for the cases where customers decide not to use SELinux protection. Also note SELinux can be put into permissive mode temporarily.

> - mkdir -p /var/named/chroot/proc/sys/net/ipv4; add
> /proc/sys/net/ipv4/ip_local_port_range to /etc/named-chroot.files before
> /var/named
> - Add into options section in /etc/named.conf:
>         use-v4-udp-ports { range 32768 60999; };
>         use-v6-udp-ports { range 32768 60999; };

Comment 21 errata-xmlrpc 2022-05-10 15:29:44 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 (Moderate: bind security, 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/RHSA-2022:2092


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