Bug 2049300 - SELinux is preventing /usr/bin/rpcbind from 'name_bind' accesses on the udp_socket port 65154.
Summary: SELinux is preventing /usr/bin/rpcbind from 'name_bind' accesses on the udp_s...
Keywords:
Status: CLOSED DUPLICATE of bug 1758147
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 35
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:353bb6bd6a8e04006146647683a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-01 21:27 UTC by Bruce Petrie
Modified: 2022-02-22 10:25 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-22 10:25:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bruce Petrie 2022-02-01 21:27:10 UTC
Description of problem:
happens during boot. rpcbind triggers numerous ports in the 65xxx rang which i believe are non priveleged ports.
SELinux is preventing /usr/bin/rpcbind from 'name_bind' accesses on the udp_socket port 65154.

*****  Plugin bind_ports (92.2 confidence) suggests   ************************

If you want to allow /usr/bin/rpcbind to bind to network port 65154
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p udp 65154
    where PORT_TYPE is one of the following: agentx_port_t, apertus_ldp_port_t, comsat_port_t, dhcpc_port_t, dhcpd_port_t, dns_port_t, efs_port_t, flash_port_t, ftp_port_t, gdomap_port_t, hi_reserved_port_t, inetd_child_port_t, ipmi_port_t, ipp_port_t, kerberos_admin_port_t, kerberos_port_t, kprop_port_t, ktalkd_port_t, ldap_port_t, pki_ca_port_t, pop_port_t, portmap_port_t, printer_port_t, rlogin_port_t, rlogind_port_t, rndc_port_t, router_port_t, rsh_port_t, rsync_port_t, rtsp_port_t, rwho_port_t, smtp_port_t, spamd_port_t, swat_port_t, syslogd_port_t, uucpd_port_t.

*****  Plugin catchall_boolean (7.83 confidence) suggests   ******************

If you want to allow system to run with NIS
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.

Do
setsebool -P nis_enabled 1

*****  Plugin catchall (1.41 confidence) suggests   **************************

If you believe that rpcbind should be allowed name_bind access on the port 65154 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 'rpcbind' --raw | audit2allow -M my-rpcbind
# semodule -X 300 -i my-rpcbind.pp

Additional Information:
Source Context                system_u:system_r:rpcbind_t:s0
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                port 65154 [ udp_socket ]
Source                        rpcbind
Source Path                   /usr/bin/rpcbind
Port                          65154
Host                          (removed)
Source RPM Packages           rpcbind-1.2.6-1.fc35.x86_64
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-35.11-1.fc35.noarch
Local Policy RPM              selinux-policy-targeted-35.11-1.fc35.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.15.18-200.fc35.x86_64 #1 SMP Sat
                              Jan 29 13:54:17 UTC 2022 x86_64 x86_64
Alert Count                   1
First Seen                    2022-02-01 14:13:38 MST
Last Seen                     2022-02-01 14:13:38 MST
Local ID                      0a7ed6fc-12cb-416e-8041-a888a21c10d8

Raw Audit Messages
type=AVC msg=audit(1643750018.399:125): avc:  denied  { name_bind } for  pid=827 comm="rpcbind" src=65154 scontext=system_u:system_r:rpcbind_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=udp_socket permissive=0


type=SYSCALL msg=audit(1643750018.399:125): arch=x86_64 syscall=bind success=no exit=EACCES a0=b a1=7ffcde9642a0 a2=1c a3=7ffcde9641a8 items=0 ppid=1 pid=827 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=rpcbind exe=/usr/bin/rpcbind subj=system_u:system_r:rpcbind_t:s0 key=(null)

Hash: rpcbind,rpcbind_t,unreserved_port_t,udp_socket,name_bind

Version-Release number of selected component:
selinux-policy-targeted-35.11-1.fc35.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.15.2
hashmarkername: setroubleshoot
kernel:         5.15.18-200.fc35.x86_64
type:           libreport

Potential duplicate: bug 1563792

Comment 1 Juan Quintela 2022-02-21 09:34:12 UTC
Similar problem has been detected:

It happened during boot after 1st installation.
I only use rpcbind because it is needed for nfs-server.service, nothing related to nis here.

hashmarkername: setroubleshoot
kernel:         5.16.9-200.fc35.x86_64
package:        selinux-policy-targeted-35.15-1.fc35.noarch
reason:         SELinux is preventing rpcbind from 'name_bind' accesses on the udp_socket port 64585.
type:           libreport

Comment 2 Zdenek Pytela 2022-02-21 10:38:00 UTC
Has something changed in your configuration? Processes are allowed to bind to ephemeral ports when the port number matches the range for local ports as defined in the net.ipv4.ip_local_port_range kernel tunable, regardless of their SELinux label:

  # sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 32768    60999

Refer to a knowledgebase article for more details (subscription required):
https://access.redhat.com/solutions/3236651

Comment 3 Bruce Petrie 2022-02-22 02:31:19 UTC
(In reply to Zdenek Pytela from comment #2)
> Has something changed in your configuration? Processes are allowed to bind
> to ephemeral ports when the port number matches the range for local ports as
> defined in the net.ipv4.ip_local_port_range kernel tunable, regardless of
> their SELinux label:
> 
>   # sysctl net.ipv4.ip_local_port_range
> net.ipv4.ip_local_port_range = 32768    60999

Hi again, thank you for looking into this. The SELinux errors do not occur every system boot but do occur often enough to be annoying. The system I am seeing this on is an older laptop with very boring software requirements that has been upgraded over many fedora releases (FC19 to FC35). A much faster server running security camera software, multiple network interfaces, multiple disk volumes, etc does not seems to exhibit this behavior. So is this a cockpit error on this laptop or something else... 

The ephemeral port number involved has varied over time. I have no need for NIS or NFS and have tried to avoid running since they expose more attack vectors. I saw this behavior occasionally on fc34 as well as now on fc35.

# sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 32768    60999

# getsebool -a|grep nis_enabled
nis_enabled --> off

I removed the only SELinux module that I installed to eliminate that as a possibility. 

I will report back after testing for a week or so unless there is anything else you would like to be tested.

cheers

> 
> Refer to a knowledgebase article for more details (subscription required):
> https://access.redhat.com/solutions/3236651

Comment 4 Zdenek Pytela 2022-02-22 10:15:19 UTC
(In reply to Bruce Petrie from comment #3)
> Hi again, thank you for looking into this. The SELinux errors do not occur
> every system boot but do occur often enough to be annoying. The system I am
> seeing this on is an older laptop with very boring software requirements
> that has been upgraded over many fedora releases (FC19 to FC35). A much
> faster server running security camera software, multiple network interfaces,
> multiple disk volumes, etc does not seems to exhibit this behavior. So is
> this a cockpit error on this laptop or something else... 
> 
> The ephemeral port number involved has varied over time. I have no need for
> NIS or NFS and have tried to avoid running since they expose more attack
> vectors. I saw this behavior occasionally on fc34 as well as now on fc35.
I don't think the range changed in past few years, but some programs may follow different standards.
Can you affect the range rpcbind can bind to?

> # sysctl net.ipv4.ip_local_port_range
> net.ipv4.ip_local_port_range = 32768    60999
> 
> # getsebool -a|grep nis_enabled
> nis_enabled --> off
> 
> I removed the only SELinux module that I installed to eliminate that as a
> possibility. 
> 
> I will report back after testing for a week or so unless there is anything
> else you would like to be tested.
If the occurence is more like random, it would probably need attention of rpcbind developers.

Comment 5 Zdenek Pytela 2022-02-22 10:25:43 UTC
Closing a dup of bz#1758147 to continue the discussion there.

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


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