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 2187290 - enhancement request - pacemaker + virt + virsh
Summary: enhancement request - pacemaker + virt + virsh
Keywords:
Status: CLOSED ERRATA
Alias: None
Deadline: 2023-05-16
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: CentOS Stream
Hardware: x86_64
OS: Linux
medium
urgent
Target Milestone: rc
: ---
Assignee: Nobody
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-17 11:44 UTC by lejeczek
Modified: 2023-11-07 11:22 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-38.1.13-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:52:21 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-154865 0 None None None 2023-04-17 11:47:00 UTC
Red Hat Product Errata RHBA-2023:6617 0 None None None 2023-11-07 08:52:30 UTC

Description lejeczek 2023-04-17 11:44:44 UTC
Description of problem:

Hi.
I see some denials which result in:

module my-virsh-pacemaker 1.0;

require {
	type virt_port_t;
	type cluster_var_lib_t;
	type virsh_t;
	class file write;
	class tcp_socket name_connect;
}

#============= virsh_t ==============
allow virsh_t cluster_var_lib_t:file write;
allow virsh_t virt_port_t:tcp_socket name_connect;

I think it would be good to have, if not in default policies then perhaps with the help of boolean(s) to allow these.
Maybe even more as these come from pacemaker use ocf_heartbeat_VirtualDomain - which would be a common/popular env I'd imagine - when set to use tcp and/or tls -> thus should be easy to "policy-debug"

many thanks, L.

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

selinux-policy-38.1.11-2.el9.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Nikola Knazekova 2023-04-18 18:51:50 UTC
Hi lejeczek,

can you please attach audit logs?

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

Thank you
Nikola

Comment 2 lejeczek 2023-04-19 07:26:29 UTC
Yes I can but I'd have to revert back to "broken" setup, which would be costly.

I'd suggest to get the authors/devel of pcs/pacemaker involved - no better way then go to the source - and ask them to use plain-vanilla Centos 9 to run VirtualDomain _live_ migration (move) with tls & with tcp (it does not appear to be an issue with ssh)

This issue does not seem to occur with libvirtd alone, virsh migrates okey, seems to pertain pcs/pacemaker specifically.

Comment 3 lejeczek 2023-04-19 08:06:43 UTC
-> $ ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts 9:40
----
type=PROCTITLE msg=audit(19/04/23 09:57:49.713:60379) : proctitle=virsh --connect=qemu:///system --quiet migrate --live --unsafe orum2 qemu+tls://swir.serv.internal/system 
type=SYSCALL msg=audit(19/04/23 09:57:49.713:60379) : arch=x86_64 syscall=connect success=no exit=EACCES(Permission denied) a0=0x7 a1=0x55f35b5c1560 a2=0x10 a3=0x7fff95fd4724 items=0 ppid=3696697 pid=3696741 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=virsh exe=/usr/bin/virsh subj=system_u:system_r:virsh_t:s0 key=(null) 
type=AVC msg=audit(19/04/23 09:57:49.713:60379) : avc:  denied  { name_connect } for  pid=3696741 comm=virsh dest=16514 scontext=system_u:system_r:virsh_t:s0 tcontext=system_u:object_r:virt_port_t:s0 tclass=tcp_socket permissive=0 

Additional Information:
Source Context                system_u:system_r:virsh_t:s0
Target Context                system_u:object_r:virt_port_t:s0
Target Objects                port 16514 [ tcp_socket ]
Source                        virsh
Source Path                   /usr/bin/virsh
Port                          16514
Host                          whale.mine.priv
Source RPM Packages           libvirt-client-9.0.0-7.el9.x86_64
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-38.1.11-2.el9.noarch
Local Policy RPM              selinux-policy-targeted-38.1.11-2.el9.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     whale.mine.priv
Platform                      Linux whale.mine.priv 5.14.0-299.el9.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Thu Apr 13 10:08:03 UTC 2023
                              x86_64 x86_64
Alert Count                   1
First Seen                    2023-04-19 09:57:49 CEST
Last Seen                     2023-04-19 09:57:49 CEST
Local ID                      6aa6e73e-04c4-4d9a-a8ec-a6aa407cab39

Raw Audit Messages
type=AVC msg=audit(1681891069.713:60379): avc:  denied  { name_connect } for  pid=3696741 comm="virsh" dest=16514 scontext=system_u:system_r:virsh_t:s0 tcontext=system_u:object_r:virt_port_t:s0 tclass=tcp_socket permissive=0


type=SYSCALL msg=audit(1681891069.713:60379): arch=x86_64 syscall=connect success=no exit=EACCES a0=7 a1=55f35b5c1560 a2=10 a3=7fff95fd4724 items=0 ppid=3696697 pid=3696741 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=virsh exe=/usr/bin/virsh subj=system_u:system_r:virsh_t:s0 key=(null)

Hash: virsh,virsh_t,virt_port_t,tcp_socket,name_connect

Comment 4 Milos Malik 2023-04-21 09:35:03 UTC
Caught in enforcing mode:
----
type=PROCTITLE msg=audit(04/21/2023 11:23:45.290:1809) : proctitle=virsh --connect=qemu+tls:///system 
type=SOCKADDR msg=audit(04/21/2023 11:23:45.290:1809) : saddr={ saddr_fam=inet laddr=127.0.0.1 lport=16514 } 
type=SYSCALL msg=audit(04/21/2023 11:23:45.290:1809) : arch=x86_64 syscall=connect success=no exit=EACCES(Permission denied) a0=0x5 a1=0x5562b908cee0 a2=0x10 a3=0x7fff1ca8f744 items=0 ppid=5763 pid=46373 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=6 comm=virsh exe=/usr/bin/virsh subj=system_u:system_r:virsh_t:s0 key=(null) 
type=AVC msg=audit(04/21/2023 11:23:45.290:1809) : avc:  denied  { name_connect } for  pid=46373 comm=virsh dest=16514 scontext=system_u:system_r:virsh_t:s0 tcontext=system_u:object_r:virt_port_t:s0 tclass=tcp_socket permissive=0 
----

Caught in permissive mode:
----
type=PROCTITLE msg=audit(04/21/2023 11:25:44.608:2015) : proctitle=virsh --connect=qemu+tls:///system 
type=SOCKADDR msg=audit(04/21/2023 11:25:44.608:2015) : saddr={ saddr_fam=inet laddr=127.0.0.1 lport=16514 } 
type=SYSCALL msg=audit(04/21/2023 11:25:44.608:2015) : arch=x86_64 syscall=connect success=no exit=ECONNREFUSED(Connection refused) a0=0x5 a1=0x5599f95625a0 a2=0x10 a3=0x7fff0d76e524 items=0 ppid=5763 pid=47879 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=6 comm=virsh exe=/usr/bin/virsh subj=system_u:system_r:virsh_t:s0 key=(null) 
type=AVC msg=audit(04/21/2023 11:25:44.608:2015) : avc:  denied  { name_connect } for  pid=47879 comm=virsh dest=16514 scontext=system_u:system_r:virsh_t:s0 tcontext=system_u:object_r:virt_port_t:s0 tclass=tcp_socket permissive=1 
----

The reproducer I used:

# runcon system_u:system_r:initrc_t:s0 bash -c 'virsh --connect=qemu+tls:///system'

Comment 16 errata-xmlrpc 2023-11-07 08:52:21 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:6617


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