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.

Bug 1701969

Summary: bind is unable to determine the local ephemeral port range, leading to selinux denials
Product: Red Hat Enterprise Linux 7 Reporter: Kyle Walker <kwalker>
Component: bindAssignee: Petr Menšík <pemensik>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.6CC: fkrska, thozza
Target Milestone: rcKeywords: Patch, Reproducer
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-17 15:32:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1683754    
Bug Blocks:    

Description Kyle Walker 2019-04-22 15:15:59 UTC
Description of problem:
 bind is unable to determine the local ephemeral port range, via the "net.ipv4.ip_local_port_range" tunable, and as a result defaults to 1024 to 65535. This results in periodic SELinux name_bind AVCs when attempting to bind to ports which other labels are applied. 

Such as the port 20514 syslogd_port_t context shown below with dontaudit rules disabled:

time->Mon Apr 22 11:10:26 2019
type=PROCTITLE msg=audit(1555945826.464:6309): proctitle=2F7573722F7362696E2F6E616D6564002D75006E616D6564002D63002F6574632F6E616D65642E636F6E66
type=SYSCALL msg=audit(1555945826.464:6309): arch=c000003e syscall=49 success=no exit=-13 a0=205 a1=7fb29380e440 a2=10 a3=12 items=0 ppid=1 pid=23570 auid=4294967295 uid=25 gid=25 euid=25 suid=25 fsuid=25 egid=25 sgid=25 fsgid=25 tty=(none) ses=4294967295 comm="named" exe="/usr/sbin/named" subj=system_u:system_r:named_t:s0 key=(null)
type=AVC msg=audit(1555945826.464:6309): avc:  denied  { name_bind } for  pid=23570 comm="named" src=20514 scontext=system_u:system_r:named_t:s0 tcontext=system_u:object_r:syslogd_port_t:s0 tclass=udp_socket permissive=0


Also visible in the system journal as the EPERM errors below:

Apr 22 11:11:56 example.com named[23570]: dispatch 0x7fb28c0b7870: open_socket(0.0.0.0#20514) -> permission denied: continuing


Version-Release number of selected component (if applicable):
 bind-9.9.4-73.el7_6.x86_64


How reproducible:
 Easily

Steps to Reproduce:
1. Start the "named" service
 # systemctl start named

2. Verify the port range for the service
 # journalctl -u named.service | grep port\ range
 Apr 22 11:13:27 example.com named[24005]: using default UDP/IPv6 port range: [1024, 65535]

Actual results:
 # journalctl -u named.service | grep port\ range
 Apr 22 11:13:27 example.com named[24005]: using default UDP/IPv6 port range: [1024, 65535]
 

Expected results:
 For a default configuration:

 # journalctl -u named.service | grep port\ range
 Apr 22 11:13:27 example.com named[24005]: using default UDP/IPv6 port range: [32768, 60999]


Additional info:
 The fix seems to have been implemented upstream in the following PR:

    4109. [port] linux: support reading the local port range from · isc-projects/bind9@e77e449
    https://github.com/isc-projects/bind9/commit/e77e44954909dd2e0af1ce724e01f4199ae1e9c0

Comment 2 Petr Menšík 2019-05-31 14:23:22 UTC
This issue has to be fixed by selinux-policy, there is nothing I can do about it in bind. Should be already solved by bug #1683754

Comment 3 Tomáš Hozza 2019-06-17 15:32:48 UTC

*** This bug has been marked as a duplicate of bug 1683754 ***