mock_selinux(8)

πŸ“¦
version 20250627+git412.dbf877ab7 Β· 7 versions
, in opensuse-leap 16.0

πŸ’– mock_selinux(8) β€” the SELinux handbook for mock, bestie edition πŸŽ€

okay so. this is section 8 of the manual, it lives in the SELinux Policy mock corner of the universe, and it's literally all about keeping the mock processes on a leash. grab a snack, we're doing policy πŸ’…


✨ NAME ✨

mock_selinux β€” Security Enhanced Linux Policy for the mock processes 🫢


🌸 DESCRIPTION 🌸

Security-Enhanced Linux secures the mock processes via flexible mandatory access control. yes, "mandatory access control" β€” the main character of access control, no cap πŸ”₯

The mock processes execute with the mock_t SELinux type. wanna check if you've got these processes running? run the ps command with the -Z qualifier. it's giving detective era πŸ”

For example:

ps -eZ | grep mock_t

πŸ¦‹ ENTRYPOINTS πŸ¦‹

so how does something even get into the mock_t SELinux type? through the mock_exec_t file type, periodt ✨

The default entrypoint paths for the mock_t domain are the following:

/usr/bin/mock, /usr/libexec/mock/mock

πŸ‘‘ PROCESS TYPES πŸ‘‘

SELinux defines process types (domains) for each process running on the system πŸ’œ

You can see the context of a process using the -Z option to ps

Policy governs the access confined processes have to files. SELinux mock policy is very flexible, allowing users to setup their mock processes in as secure a method as possible. lowkey iconic of it.

The following process types are defined for mock:

mock_t, mock_build_t
Note: semanage permissive -a mock_t can be used to make the process type mock_t permissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated. so like… it's chill about it, but it's still watching you πŸ‘€

πŸŽ€ BOOLEANS πŸŽ€

SELinux policy is customizable based on least access required. mock policy is extremely flexible and has several booleans that allow you to manipulate the policy and run mock with the tightest access possible. tightest access = the slay-est access, fr fr 🌈

If you want to allow mock to read files in home directories, you must turn on the mock_enable_homedirs boolean. Disabled by default.

setsebool -P mock_enable_homedirs 1

If you want to allow system to run with NIS, you must turn on the nis_enabled boolean. Disabled by default.

setsebool -P nis_enabled 1

If you want to support NFS home directories, you must turn on the use_nfs_home_dirs boolean. Enabled by default. (look at her, already on ✨)

setsebool -P use_nfs_home_dirs 1

If you want to support SAMBA home directories, you must turn on the use_samba_home_dirs boolean. Disabled by default.

setsebool -P use_samba_home_dirs 1

πŸ“ MANAGED FILES πŸ“

The SELinux process type mock_t can manage files labeled with the following file types. The paths listed are the default paths for these file types. Not me reminding you: the process's UID still needs to have DAC permissions πŸ’€ (SELinux isn't doing all the work for you, bestie)

  • cifs_t
  • krb5_host_rcache_t
/var/tmp/krb5_0.rcache2
/var/cache/krb5rcache(/.*)?
/var/tmp/nfs_0
/var/tmp/DNS_25
/var/tmp/host_0
/var/tmp/imap_0
/var/tmp/HTTP_23
/var/tmp/HTTP_48
/var/tmp/ldap_55
/var/tmp/ldap_487
/var/tmp/ldapmap1_0
  • lvm_lock_t
/etc/lvm/lock(/.*)?
/run/lock/lvm(/.*)?
/run/lock/dmraid(/.*)?
  • mock_cache_t
/var/cache/mock(/.*)?
  • mock_tmp_t
  • mock_var_lib_t
/var/lib/mock(/.*)?
  • mock_var_run_t
  • mount_var_run_t
/run/mount(/.*)?
/dev/.mount(/.*)?
/run/davfs2(/.*)?
/var/cache/davfs2(/.*)?
  • nfs_t
  • rpm_tmp_t
  • rpm_var_cache_t
/var/adm/mount(/.*)?
/var/cache/dnf(/.*)?
/var/cache/yum(/.*)?
/var/cache/zypp(/.*)?
/var/spool/up2date(/.*)?
/var/cache/PackageKit(/.*)?
  • rpm_var_lib_t
/var/lib/dnf(/.*)?
/var/lib/rpm(/.*)?
/var/lib/yum(/.*)?
/usr/lib/YaST2(/.*)?
/var/lib/YaST2(/.*)?
/var/lib/PackageKit(/.*)?
/usr/lib/sysimage/dnf(/.*)?
/usr/lib/sysimage/rpm(/.*)?
/var/lib/alternatives(/.*)?
/var/lib/rpmrebuilddb.*(/.*)?
/usr/lib/sysimage/libdnf5(/.*)?
/run/rpmdb
  • sysfs_t
/sys(/.*)?
  • systemd_passwd_var_run_t
/run/systemd/ask-password(/.*)?
/run/systemd/ask-password-block(/.*)?
  • user_home_t
/home/[^/]+/.+

🧚 FILE CONTEXTS 🧚

SELinux requires files to have an extended attribute to define the file type. yeah, files have labels. we been knew πŸ’…

You can see the context of a file using the -Z option to ls

Policy governs the access confined processes have to these files. SELinux mock policy is very flexible, allowing users to setup their mock processes in as secure a method as possible.

⭐ STANDARD FILE CONTEXT ⭐

SELinux defines the file context types for the mock. If you wanted to store files with these types in a different paths, you need to execute the semanage command to specify alternate labeling and then use restorecon to put the labels on disk.

semanage fcontext -a -t mock_exec_t '/srv/mock/content(/.*)?'
restorecon -R -v /srv/mymock_content
Note: SELinux often uses regular expressions to specify labels that match multiple files. regex girlies, this one's for you 🎯

The following file types are defined for mock:

πŸ’œ mock_build_exec_t

  • Set files with the mock_build_exec_t type, if you want to transition an executable to the mock_build_t domain.

πŸ’œ mock_cache_t

  • Set files with the mock_cache_t type, if you want to store the files under the /var/cache directory.

πŸ’œ mock_etc_t

  • Set files with the mock_etc_t type, if you want to store mock files in the /etc directories.

πŸ’œ mock_exec_t

  • Set files with the mock_exec_t type, if you want to transition an executable to the mock_t domain.

Paths:

/usr/bin/mock, /usr/libexec/mock/mock

πŸ’œ mock_tmp_t

  • Set files with the mock_tmp_t type, if you want to store mock temporary files in the /tmp directories.

πŸ’œ mock_var_lib_t

  • Set files with the mock_var_lib_t type, if you want to store the mock files under the /var/lib directory.

πŸ’œ mock_var_run_t

  • Set files with the mock_var_run_t type, if you want to store the mock files under the /run or /var/run directory.
Note: File context can be temporarily modified with the chcon command. If you want to permanently change the file context you need to use the semanage fcontext command. This will modify the SELinux labeling database. You will need to use restorecon to apply the labels. temporary = vibes only, permanent = commit to it 🫢

πŸ”₯ 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. (a whole GUI, for the girlies who like buttons πŸŽ€)

🌈 AUTHOR 🌈

This manual page was auto-generated using sepolicy manpage. a bot wrote this and honestly? it ate.


πŸ’– SEE ALSO πŸ’–

selinux(8), mock(8), semanage(8), restorecon(8), chcon(1), sepolicy(8), setsebool(8), mock_build_selinux(8), mock_build_selinux(8)

(yes, mock_build_selinux(8) shows up twice β€” that's not a typo on my end, it's literally in the list, and honestly? double the icon, double the slay πŸ‘‘πŸ‘‘)


and that's the whole page, bestie πŸ¦‹ this came to you from mock, dated 26-10-06, in true mock_selinux(8) fashion β€” go forth and label responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from