virsh_selinux(8)
π
virsh_selinux(8) β like, the whole SELinux vibe for virsh processes β¨
okay bestie, welcome to the virsh_selinux(8) page β yes that's the manual section 8, and yes this is the SELinux Policy for virsh situation. buckle up π
πΈ NAME πΈ
virsh_selinux β Security Enhanced Linux Policy for the virsh processes. that's it, that's the whole name, slay π
β¨ DESCRIPTION β¨
Security-Enhanced Linux secures the virsh processes via flexible mandatory access control. literally the whole point π«Ά
The virsh processes execute with the virsh_t SELinux type. You can check if you've got these processes running by executing the ps command with the -Z qualifier. easy peasy.
For example:
ps -eZ | grep virsh_t
go run it, i'll wait π
πͺ ENTRYPOINTS πͺ
The virsh_t SELinux type can be entered via the virsh_exec_t file type. that's the doorway, no cap.
The default entrypoint paths for the virsh_t domain are the following:
/usr/bin/xl, /usr/bin/xm, /usr/bin/virsh
three little icon paths, all iconic π
𧬠PROCESS TYPES π§¬
SELinux defines process types (domains) for each process running on the system. yes, every process gets its own little domain identity β main character energy for real.
You can see the context of a process using the -Z option to ps. (yes, -Z again, it's the moment, let it have it.)
Policy governs the access confined processes have to files. SELinux virsh policy is very flexible, allowing users to setup their virsh processes in as secure a method as possible. tightest access possible, periodt.
The following process types are defined for virsh:
virsh_t, virsh_ssh_t
Note:semanage permissive -a virsh_tcan be used to make the process typevirsh_tpermissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated. so like, it stops blocking you but it still talks about you in the logs π
π BOOLEANS π
SELinux policy is customizable based on least access required. virsh policy is extremely flexible and has several booleans that allow you to manipulate the policy and run virsh with the tightest access possible. no wasted permissions here, we're minimalists π
If you want to allow all domains to execute in fips_mode, you must turn on the fips_mode boolean. Enabled by default.
setsebool -P fips_mode 1
If you want to allow confined applications to use nscd shared memory, you must turn on the nscd_use_shm boolean. Enabled by default.
setsebool -P nscd_use_shm 1
If you want to support ecryptfs home directories, you must turn on the use_ecryptfs_home_dirs boolean. Disabled by default.
setsebool -P use_ecryptfs_home_dirs 1
If you want to allow confined virtual guests to manage nfs files, you must turn on the virt_use_nfs boolean. Disabled by default.
setsebool -P virt_use_nfs 1
If you want to allow confined virtual guests to manage cifs files, you must turn on the virt_use_samba boolean. Disabled by default.
setsebool -P virt_use_samba 1
five booleans, five setsebool -P commands, we are THRIVING π
ποΈ MANAGED FILES ποΈ
The SELinux process type virsh_t can manage files labeled with the following file types. The paths listed are the default paths for these file types. Heads up bestie: the process's UID still needs to have DAC permissions. SELinux isn't gonna override good old-fashioned file permissions for you, that's not the vibe π
cifs_t
(no paths listed, it's just out here living its life)
container_file_t
/var/lib/rkt/cas(/.*)?
nfs_t
(again, no default paths listed, mysterious and gorgeous)
ssh_home_t
/var/lib/[^/]+/.ssh(/.*)?
/root/.ssh(/.*)?
/var/lib/one/.ssh(/.*)?
/srv/gitolite/.ssh(/.*)?
/srv/gitolite3/.ssh(/.*)?
/var/lib/pgsql/.ssh(/.*)?
/var/lib/openshift/[^/]+/.ssh(/.*)?
/var/lib/amanda/.ssh(/.*)?
/var/lib/stickshift/[^/]+/.ssh(/.*)?
/var/lib/nocpulse/.ssh(/.*)?
/var/lib/openshift/gear/[^/]+/.ssh(/.*)?
/root/.shosts
/home/[^/]+/.ssh(/.*)?
/home/[^/]+/.ansible/cp/.*
/home/[^/]+/.shosts
look at all those ssh directories, it's giving β¨infrastructureβ¨
systemd_passwd_var_run_t
/run/systemd/ask-password(/.*)?
/run/systemd/ask-password-block(/.*)?
vhostmd_tmpfs_t
(no paths, it's shy)
virt_etc_rw_t
/etc/xen/.*/.*
/etc/xen/[^/]*
/etc/libvirt/.*/.*
/etc/libvirt/[^/]*
virt_etc_t
/etc/xen/[^/]*
/etc/libvirt/[^/]*
/etc/xen
/etc/libvirt
virt_image_type
all virtual image files
literally all of them. every single virtual image file. ate. π₯
virt_lock_t
(no paths listed, but it's important, trust)
virt_lxc_var_run_t
/run/libvirt/lxc(/.*)?
/run/libvirt-sandbox(/.*)?
/run/virtlxcd.pid
/run/libvirt/virtlxcd-sock
/run/libvirt/virtlxcd-sock-ro
/run/libvirt/virtlxcd-admin-sock
xenfs_t
(no paths, just vibes)
π·οΈ FILE CONTEXTS π·οΈ
SELinux requires files to have an extended attribute to define the file type. yes, files have labels now, we love a rebrand π
You can see the context of a file using the -Z option to ls. (-Z is literally the guest star of this entire manpage at this point π)
Policy governs the access confined processes have to these files. SELinux virsh policy is very flexible, allowing users to setup their virsh processes in as secure a method as possible.
π STANDARD FILE CONTEXT π
SELinux defines the file context types for the virsh. If you wanted to store files with these types in a different path, you need to execute the semanage command to specify alternate labeling and then use restorecon to put the labels on disk. two-step process, both steps matter, don't skip π
semanage fcontext -a -t virsh_exec_t '/srv/virsh/content(/.*)?'
restorecon -R -v /srv/myvirsh_content
Note: SELinux often uses regular expressions to specify labels that match multiple files. regex girlies rise π¦
The following file types are defined for virsh:
virsh_exec_t
- Set files with the
virsh_exec_ttype if you want to transition an executable to thevirsh_tdomain.
Paths:
/usr/bin/xl, /usr/bin/xm, /usr/bin/virsh
(the same three paths as the entrypoints β consistency icon π )
Note: File context can be temporarily modified with thechconcommand. If you want to permanently change the file context you need to use thesemanage fcontextcommand. This will modify the SELinux labeling database. You will need to userestoreconto apply the labels. so like βchconis the temporary tattoo,semanage fcontextis the real one π
π οΈ COMMANDS π οΈ
semanage fcontext can also be used to manipulate default file context mappings.
semanage permissive can also be used to manipulate whether or not a process type is permissive.
semanage module can also be used to enable/disable/install/remove policy modules.
semanage boolean can also be used to manipulate the booleans.
system-config-selinux is a GUI tool available to customize SELinux policy settings. for the besties who prefer clicking over typing π±οΈβ¨
π«Ά AUTHOR π«Ά
This manual page was auto-generated using sepolicy manpage. (yes, robot-written, and honestly? it ate.)
π SEE ALSO π
selinux(8), virsh(8), semanage(8), restorecon(8), chcon(1), sepolicy(8), setsebool(8), virsh_ssh_selinux(8), virsh_ssh_selinux(8)
and yes, virsh_ssh_selinux(8) is listed twice β she said it once, she said it again, because she's that important ππ
okay that's the whole page, go forth and confine your virsh processes responsibly π§ββοΈ
β signed, virsh, dated 26-10-06, filed under virsh_selinux(8) π bye bestie!!
π¦ where this page comes from
- opensuse-leap 16.0: selinux-policy-doc 20250627+git412.dbf877ab7-160000.1.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms