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 2176487 - the wg-quick service is still broken in enforcing mode
Summary: the wg-quick service is still broken in enforcing mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.2
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Nikola Knazekova
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 2179025
TreeView+ depends on / blocked
 
Reported: 2023-03-08 14:00 UTC by Milos Malik
Modified: 2023-05-09 10:21 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-38.1.9-1.el9_2
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2179025 (view as bug list)
Environment:
Last Closed: 2023-05-09 08:17:18 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Audit log as requested (11.32 KB, text/plain)
2023-03-08 20:34 UTC, Ilkka Tengvall
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-151058 0 None None None 2023-03-08 14:02:46 UTC
Red Hat Product Errata RHBA-2023:2483 0 None None None 2023-05-09 08:17:24 UTC

Description Milos Malik 2023-03-08 14:00:57 UTC
Description of problem:
 * follow-up BZ based on https://bugzilla.redhat.com/show_bug.cgi?id=2149452#c36 and later comments

Version-Release number of selected component (if applicable):
selinux-policy-38.1.8-1.el9.noarch
selinux-policy-targeted-38.1.8-1.el9.noarch

Actual results:
----
type=PROCTITLE msg=audit(03/08/23 10:40:11.260:32085) : proctitle=ip link show dev cool-lab 
type=SYSCALL msg=audit(03/08/23 10:40:11.260:32085) : arch=x86_64 syscall=ioctl success=no exit=ENODEV(No such device) a0=0x4 a1=SIOCGIFINDEX a2=0x7ffd8ef87ce0 a3=0x9b items=0 ppid=32272 pid=32273 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ip exe=/usr/sbin/ip subj=system_u:system_r:wireguard_t:s0 key=(null) 
type=AVC msg=audit(03/08/23 10:40:11.260:32085) : avc:  denied  { sys_module } for  pid=32273 comm=ip capability=sys_module  scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:system_r:wireguard_t:s0 tclass=capability permissive=0 
----
type=USER_AVC msg=audit(03/08/23 10:40:11.394:32086) : pid=787 uid=dbus auid=unset ses=unset subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for  scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tclass=dbus permissive=0  exe=/usr/bin/dbus-broker sauid=dbus hostname=? addr=? terminal=?' 
----
type=PROCTITLE msg=audit(03/08/23 10:40:11.435:32087) : proctitle=ip link delete dev cool-lab 
type=SYSCALL msg=audit(03/08/23 10:40:11.435:32087) : arch=x86_64 syscall=sendmsg success=yes exit=32 a0=0x3 a1=0x7ffdc4b601f0 a2=0x0 a3=0x9b items=0 ppid=32267 pid=32295 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ip exe=/usr/sbin/ip subj=system_u:system_r:wireguard_t:s0 key=(null) 
type=AVC msg=audit(03/08/23 10:40:11.435:32087) : avc:  denied  { search } for  pid=32295 comm=ip name=slab dev="debugfs" ino=10789 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:debugfs_t:s0 tclass=dir permissive=0 
----

Expected results:
 * no SELinux denials
 * the wg-quick service works in enforcing mode

Comment 2 Milos Malik 2023-03-08 14:26:42 UTC
The SELinux denials listed in comment#0 appear after removing the dontaudit rules.

Here are the SELinux denials caught in permissive mode:
----
type=PROCTITLE msg=audit(03/08/2023 09:20:36.049:343) : proctitle=ip link delete dev ppp0 
type=SYSCALL msg=audit(03/08/2023 09:20:36.049:343) : arch=x86_64 syscall=sendmsg success=yes exit=32 a0=0x3 a1=0x7ffe74892a30 a2=0x0 a3=0x9b items=0 ppid=4704 pid=4711 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ip exe=/usr/sbin/ip subj=system_u:system_r:wireguard_t:s0 key=(null) 
type=AVC msg=audit(03/08/2023 09:20:36.049:343) : avc:  denied  { search } for  pid=4711 comm=ip name=slab dev="debugfs" ino=9932 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:debugfs_t:s0 tclass=dir permissive=1 
----
type=PROCTITLE msg=audit(03/08/2023 09:20:40.752:352) : proctitle=ip link show dev ppp0 
type=SYSCALL msg=audit(03/08/2023 09:20:40.752:352) : arch=x86_64 syscall=ioctl success=no exit=ENODEV(No such device) a0=0x4 a1=SIOCGIFINDEX a2=0x7ffc3bd7aec0 a3=0x16 items=0 ppid=4739 pid=4740 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ip exe=/usr/sbin/ip subj=system_u:system_r:wireguard_t:s0 key=(null) 
type=AVC msg=audit(03/08/2023 09:20:40.752:352) : avc:  denied  { sys_module } for  pid=4740 comm=ip capability=sys_module  scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:system_r:wireguard_t:s0 tclass=capability permissive=1 
----

Comment 3 Ilkka Tengvall 2023-03-08 14:31:35 UTC
further info of where I face this:

This works:
sudo wg-quick up <profile>

This does not work:
sudo systemctl start wg-quick@<profile>
sudo nmcli connection up <profile>

My wg conf is:

------
[Interface]
Address = 10.254.251.102
PrivateKey = <privkey>
DNS = 10.128.1.10
[Peer]
PublicKey = <pubkey>
AllowedIPs = 10.128.1.0/24, 10.128.2.0/24, 10.128.3.0/24, 10.128.4.0/24
Endpoint = <server-ip>:51820
PersistentKeepalive = 25
------

Comment 4 Milos Malik 2023-03-08 17:42:48 UTC
@ikke I would like you to test a special policy module in enforcing mode:

# setenforce 1
# cat testpolicy.cil 
( allow wireguard_t wireguard_t ( capability ( sys_module )))
( allow wireguard_t system_dbusd_t ( dbus ( send_msg )))
( allow wireguard_t debugfs_t ( dir ( search )))

# semodule -i testpolicy.cil 
#

Please re-run your scenario (systemctl start wg-quick@<profile>) and let us know if it works.

Please collect SELinux denials if they appear:

# ausearch -m avc -m user_avc -m selinux_err -i -ts today

The following command removes the policy module shown above:

# semodule -r testpolicy
#

Thank you.

Comment 5 Ilkka Tengvall 2023-03-08 20:34:23 UTC
Created attachment 1949149 [details]
Audit log as requested

Here are the commands:

------------
[coolboy@apu ~]$ cat testpolicy.cil
( allow wireguard_t wireguard_t ( capability ( sys_module )))
( allow wireguard_t system_dbusd_t ( dbus ( send_msg )))
( allow wireguard_t debugfs_t ( dir ( search )))
[coolboy@apu ~]$ getenforce
Enforcing
[coolboy@apu ~]$ sudo semodule -i testpolicy.cil
[coolboy@apu ~]$ date
Wed Mar  8 22:28:02 EET 2023
[coolboy@apu ~]$ sudo systemctl start wg-quick@cool-lab
[coolboy@apu ~]$ sudo wg
interface: cool-lab
  public key: xxx
  private key: (hidden)
  listening port: 37170

peer: xxx
  endpoint: xxx:51820
  allowed ips: 10.128.1.0/24, 10.128.2.0/24, 10.128.3.0/24, 10.128.4.0/24
  latest handshake: 3 seconds ago
  transfer: 92 B received, 180 B sent
  persistent keepalive: every 25 seconds
[coolboy@apu ~]$ sudo ausearch -m avc -m user_avc -m selinux_err -i -ts 03/08/23 22:28 > audit.txt
------------

see attached audit.txt.

It worked \o/ , not going to remove the policy :D

Comment 21 errata-xmlrpc 2023-05-09 08:17:18 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-2023:2483


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