CHECKPOLICY(8)
π CHECKPOLICY(8) β the checkpolicy era π
okay bestie, gather round, because this one is literally the SELinux policy compiler and she is iconic. this is the page for checkpolicy(8) from the System Manager's Manual, and yes we are gonna get through every single flag together, no skipping, no skimming, periodt. π«Ά
β¨ NAME β¨
checkpolicy β SELinux policy compiler π
πΈ SYNOPSIS πΈ
checkpolicy [-b[F]] [-C] [-d] [-U handle_unknown (allow,deny,reject)]
[-M] [-N] [-L] [-c policyvers] [-o output_file|-] [-S] [-t
target_platform (selinux,xen)] [-O] [-E] [-V] [input_file]
π¦ DESCRIPTION π¦
so like, this manual page describes the checkpolicy command. that's the vibe. π
checkpolicy is that girl: she checks and compiles a SELinux security policy configuration into a binary representation that can be loaded into the kernel. main character energy fr fr.
and here's the part where you gotta pay attention: if you don't specify an input file name, checkpolicy will try to read from policy.conf or policy, and which one it picks depends on whether the -b flag is specified. it's giving β¨conditionalβ¨. iykyk.
π OPTIONS π
-b,--binaryβ read an existing binary policy file instead of a sourcepolicy.conffile. flip the script, bestie π-F,--confβ write apolicy.conffile instead of a binary policy file. heads up: this can only be used with a binary policy file, so don't try it anywhere else π-C,--cilβ write a CIL policy file instead of a binary policy file. we love a format change π-d,--debugβ enter debug mode after loading the policy. goblin mode but for debugging π-U,--handle-unknown<action>β specify how the kernel should handle unknown classes or permissions. the options aredeny,alloworreject. you get to decide their fate π-M,--mlsβ enable the MLS policy when checking and compiling the policy. multi-level security said hello π-N,--disable-neverallowβ do not checkneverallowrules. bold move, no cap π-L,--line-marker-for-allowβ output line markers forallowrules, in addition toneverallowrules. this option increases the size of the output CIL policy file, but those extra line markers help with debugging, especially forneverallowfailure reports. can only be used when writing a CIL policy file. bigger file, better vibes, worth it π-cpolicyversβ specify the policy version. defaults to the latest, because obviously β¨-o,--outputfilenameβ write a policy file (binary,policy.conf, or CIL policy) to the specified filename. and if you give-as the filename, it writes to standard output. cute AND flexible π-S,--sortβ sort ocontexts before writing out the binary policy. this makes the output ofcheckpolicyconsistent with binary policies created bysemanageandsecilc. matching fits, we love to see it π―-t,--targetβ specify the target platform (selinuxorxen). pick your fighter βοΈ-O,--optimizeβ optimize the final kernel policy (removes redundant rules). spring cleaning energy π§Ήβ¨-E,--werrorβ treat warnings as errors. no chill mode, activated π€-V,--versionβ show version information. say hi to the version number π«Ά-h,--helpβ show usage information. when in doubt,-hit out π¦
π EXAMPLE π
Generate policy.conf based on the system policy
# checkpolicy -b -M -F /etc/selinux/targeted/policy/policy.33 -o policy.conf
Recompile system policy so that unknown permissions are denied (uses policy.conf from ^^).
note that binary policy extension represents its version, which is subject to change π
# checkpolicy -M -U deny -o /etc/selinux/targeted/policy/policy.33 policy.conf
# load_policy
Generate CIL representation of current system policy
# checkpolicy -b -M -C /etc/selinux/targeted/policy/policy.33 -o policy.out
π SEE ALSO π
SELinux Reference Policy documentation at https://github.com/SELinuxProject/refpolicy/wiki
go read it, bestie, it's giving educational πβ¨
π AUTHOR π
this manual page was written by ΓrpΓ‘d MagosΓ‘nyi <mag@bunuel.tii.matav.hu>, and edited by Stephen Smalley <stephen.smalley.work@gmail.com>. the program itself was written by Stephen Smalley <stephen.smalley.work@gmail.com>. shoutout to the icons who made this possible π«‘π
and that's the whole page, bestie!! π this was checkpolicy(8) from the System Manager's Manual β no date on this one so don't come for me, the page simply didn't say π β stay compiled, stay iconic, mwah πβ¨
π¦ where this page comes from
- centos-stream 10: checkpolicy 3.10-1.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: checkpolicy 3.11-2.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 43: checkpolicy 3.9-2.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: checkpolicy 3.10-1.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: checkpolicy 3.11-1.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: checkpolicy 3.10
- nixpkgs unstable: checkpolicy 3.11
- ubuntu resolute: checkpolicy 3.9-1 Β· GPL-2.0-only
- ubuntu stonking: checkpolicy 3.11-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms