SEMODULE(8)

๐Ÿ“ฆ
version 3.11 ยท 5 versions
, in centos-stream 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

๐Ÿ’– SEMODULE(8) ๐Ÿ’–

okay bestie, welcome to semodule, from the System Manager's Manual โ€” she's the SELinux policy module manager and she's that girl ๐Ÿ’…


โœจ NAME โœจ

semodule โ€” Manage SELinux policy modules. ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

semodule [option]... MODE...

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so semodule is literally the tool for managing SELinux policy modules โ€” installing them, upgrading them, listing them, removing them, the whole vibe. ๐Ÿซถ she can also force a rebuild of policy from the module store and/or force a reload of policy without doing any other transaction. no cap.

semodule acts on module packages created by semodule_package. conventionally those files have a .pp suffix (policy package) โ€” though this is not mandated in any way, it's just the ~aesthetic~ iykyk.


๐Ÿ‘‘ MODES ๐Ÿ‘‘

  • -R, --reload โ€” force a reload of policy ๐Ÿ”„
  • -B, --build โ€” force a rebuild of policy (also reloads unless -n is used)
  • --refresh โ€” like --build, but she reuses the existing linked policy if no changes to module files are detected (by comparing with the checksum from the last transaction). you can use this instead of -B to make sure any changes to the module store done by an external tool (e.g. a package manager) get applied, while automatically skipping the module re-linking if there are no module changes. efficient queen ๐Ÿ’…
  • -D, --disable_dontaudit โ€” temporarily remove dontaudits from policy. reverts whenever policy is rebuilt โš ๏ธ
  • -i,--install=MODULE_PKG โ€” install/replace a module package
  • -u,--upgrade=MODULE_PKG โ€” deprecated, alias for --install
  • -b,--base=MODULE_PKG โ€” deprecated, alias for --install
  • -r,--remove=MODULE_NAME โ€” remove existing module at desired priority (defaults to -X 400)
  • -l[KIND],--list-modules[=KIND] โ€” display list of installed modules (other than base)

๐Ÿ’œ KIND:

  • standard โ€” list highest priority, enabled, non-base modules
  • full โ€” list all modules
  • -X,--priority=PRIORITY โ€” set priority for following operations (1-999)
  • -e,--enable=MODULE_NAME โ€” enable module โœจ
  • -d,--disable=MODULE_NAME โ€” disable module ๐Ÿ™ˆ
  • -E,--extract=MODULE_PKG โ€” Extract a module from the store as an HLL or CIL file to the current directory. A module is extracted as HLL by default. The name of the module written is <module-name>.<lang_ext>

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -s,--store โ€” name of the store to operate on
  • -n,--noreload,-N โ€” do not reload policy after commit
  • -h,--help โ€” prints help message and quit
  • -P,--preserve_tunables โ€” Preserve tunables in policy
  • -C,--ignore-module-cache โ€” Recompile CIL modules built from HLL files
  • -g,--config=PATH โ€” use an alternate path for the semanage config
  • -p,--path โ€” Use an alternate path for the policy root
  • -S,--store-path โ€” Use an alternate path for the policy store root
  • -v,--verbose โ€” be verbose ๐Ÿ—ฃ๏ธ
  • -c,--cil โ€” Extract module as a CIL file. This only affects the --extract option and only modules listed in --extract after this option.
  • -H,--hll โ€” Extract module as an HLL file. This only affects the --extract option and only modules listed in --extract after this option.
  • -m,--checksum โ€” Add SHA256 checksum of modules to the list output.

๐Ÿ”ฅ EXAMPLE ๐Ÿ”ฅ

she ate with these, fr fr:

# Install or replace a base policy package.
$ semodule -b base.pp
# Install or replace a non-base policy package.
$ semodule -i httpd.pp
# Install or replace all non-base modules in the current directory.
# This syntax can be used with -i/u/r/E, but no other option can be entered after the module names
$ semodule -i *.pp
# Install or replace all modules in the current directory.
$ ls *.pp | grep -Ev "base.pp|enableaudit.pp" | xargs /usr/sbin/semodule -b base.pp -i
# List non-base modules.
$ semodule -l
# List all modules including priorities
$ semodule -lfull
# Remove a module at priority 100
$ semodule -X 100 -r wireshark
# Turn on all AVC Messages for which SELinux currently is "dontaudit"ing.
$ semodule -DB
# Turn "dontaudit" rules back on.
$ semodule -B
# Disable a module (all instances of given module across priorities will be disabled).
$ semodule -d alsa
# Install a module at a specific priority.
$ semodule -X 100 -i alsa.pp
# Set an alternate path for the policy root
$ semodule -B -p "/tmp"
# Set an alternate path for the policy store root
$ semodule -B -S "/tmp/var/lib/selinux"
# Write the HLL version of puppet and the CIL version of wireshark
# modules at priority 400 to the current working directory
$ semodule -X 400 --hll -E puppet --cil -E wireshark
# Check whether a module in "localmodule.pp" file is same as installed module "localmodule"
$ /usr/libexec/selinux/hll/pp localmodule.pp | sha256sum
$ semodule -l -m | grep localmodule
# Translate binary module file into CIL (useful for debugging installation errors)
$ /usr/libexec/selinux/hll/pp alsa.pp > alsa.cil

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

checkmodule(8), semodule_package(8)


๐Ÿ’œ AUTHORS ๐Ÿ’œ

This manual page was written by Dan Walsh <dwalsh@redhat.com>. The program was written by Karl MacMillan <kmacmillan@tresys.com>, Joshua Brindle <jbrindle@tresys.com>, Jason Tang <jtang@tresys.com>


k that's the whole page bestie, you're officially semodule-pilled ๐Ÿ’…โœจ

Security Enhanced Linux ๐ŸŒธ Nov 2005 ๐ŸŽ€ โ€” that's the source, the version vibe and the date, mwah, go forth and manage those modules queen ๐Ÿ‘‘๐Ÿฆ‹