semanage.conf(5)
โจ NAME โจ
semanage.conf โ the global configuration file for the SELinux Management library. Yep, it's the little file that runs the whole vibe of how policy management behaves, and it lives in section 5, so bestie, say hi to semanage.conf(5) ๐
๐ DESCRIPTION ๐
okay so. The semanage.conf file is usually located under the directory /etc/selinux, and it's used for run-time configuration of the behavior of the SELinux Management library. It's giving "quiet little file, enormous consequences" and honestly? iconic. ๐
Each line should contain a configuration parameter followed by the equal sign (=) and then followed by the configuration value for that parameter. Anything after the # symbol is ignored, similarly to empty lines. So comment your heart out, nobody's stopping you ๐
๐ธ the parameters ๐ธ
The following parameters are allowed:
module-storeโ tells the SELinux Management library how it should interact with the SELinux policy store. When it's set to"direct", the library writes to the SELinux policy module store directly (and yes, that's the default setting, no cap). Otherwise a socket path or a server name can be used for the argument. If the argument begins with/(as in/foo/bar), it represents the path to a named socket that should be used to connect the policy management server. If the argument does not begin with a/(as inexample.com:4242), it should be interpreted as the name of a remote policy management server to be used through a TCP connection โ and the default port is4242unless a different one is specified after the server name using the colon to separate the two fields. ๐ซถrootโ specify an alternative root path to use for the store. The default is/.store-rootโ specify an alternativestore_rootpath to use. The default is/var/lib/selinux.compiler-directoryโ specify an alternative directory that contains HLL to CIL compilers. The default value is/usr/libexec/selinux/hll.ignore-module-cacheโ whether or not to ignore the cache of CIL modules compiled from HLL. It can be set to either"true"or"false", and it's set to"false"by default. If the cache is ignored, then all CIL modules are recompiled from their HLL modules. ๐ฅpolicy-versionโ when generating the policy, by defaultsemanagewill set the policy version toPOLICYDB_VERSION_MAX, as defined in<sepol/policydb/policydb.h>. Change this setting if a different version needs to be set for the policy.target-platformโ the target platform to generate policies for. Valid values are"selinux"and"xen", and it's set to"selinux"by default.expand-checkโ whether or not to check"neverallow"rules when executing allsemanagecommand. It can be set to either"0"/"false"(disabled) or"1"/"true"(enabled), and by default it is enabled. โ ๏ธ Heads up: there might be a large penalty in execution time if this option is enabled.file-modeโ by default the permission mode for the run-time policy files is set to0644.save-previousโ it controls whether the previous module directory is saved after a successful commit to the policy store, and it can be set to either"true"or"false". By default it is set to"false"(meaning the previous version is deleted). ๐save-linkedโ it controls whether the previously linked module is saved (with name"base.linked") after a successful commit to the policy store. It can be set to either"true"or"false", and by default it is set to"false"(meaning the previous module is deleted).ignoredirsโ a list, separated by;, of directories to ignore when setting up users homedirs. Some distributions use this to stop labeling/rootas a homedir. ๐usepasswdโ whether or not to enable the usegetpwent()to obtain a list of home directories to label. It can be set to either"true"or"false". By default it is set to"true".disable-genhomedirconโ it controls whether or not thegenhomedirconfunction is executed when using thesemanagecommand, and it can be set to either"false"or"true". By default thegenhomedirconfunctionality is enabled (equivalent to this option set to"false").handle-unknownโ this option overrides the kernel behavior for handling permissions defined in the kernel but missing from the actual policy. It can be set to"deny","reject"or"allow". By default the setting from the policy is taken.bzip-blocksizeโ it should be in the range0-9. A value of0means no compression. By default the bzip block size is set to9(the actual block size value is obtained after multiplication by100000).bzip-smallโ when set to"true", the bzip algorithm shall try to reduce its system memory usage. It can be set to either"true"or"false", and by default it is set to"false".remove-hllโ when set to"true", HLL files will be removed after compilation into CIL. In order to delete HLL files already compiled into CIL, modules will need to be recompiled with theignore-module-cacheoption set to'true'or using theignore-module-cacheoption withsemodule. Theremove-hlloption can be set to either"true"or"false", and by default it is set to"false".
๐ญ Please note that since this option deletes all HLL files, an updated HLL compiler will not be able to recompile the original HLL file into CIL. In order to compile the original HLL file into CIL, the same HLL file will need to be reinstalled. fr fr, be careful with this one.
optimize-policyโ when set to"true", the kernel policy will be optimized upon rebuilds. It can be set to either"true"or"false", and by default it is set to"true". โจmultiple-declsโ when set to"true", duplicate type, type attribute, and role declarations will be allowed. It can be set to either"true"or"false", and by default it is set to"true".
๐ฆ overriding external commands ๐ฆ
For certain tasks the SELinux Management library resorts to running external commands. For the following commands their path and arguments can be overridden:
load_policyโ command to load a kernel policy. Requires no argument. Defaults to/sbin/load_policywith no arguments.setfilesโ command to verify file context definitions. Requires two arguments, the path to the kernel policy and the path to the file context definition file. Defaults to/sbin/setfileswith the arguments'-q -c $@ $<'.sefcontext_compileโ command to compile a file context definition file. Requires one argument, the path to the to be compiled file context definition file. Defaults to/sbin/sefcontext_compilewith the argument'$@'.
Either path or args can be omitted. The argument string must contain '$@' for the first required argument, and '$<' for the second one. The syntax for overriding an external command property is:
[name]
path = /path/to/command
args = --flag
[end]
๐ Example ๐
[sefcontext_compile]
path = /usr/sbin/sefcontext_compile
args = -r $@
[end]
๐ verifying stuff ๐
Optionally the SELinux Management library can invoke external commands to verify source modules (verify module), linked modules (verify linked), and kernel policies (verify kernel). The syntax is identical to the above command overrides. The program should exit with a value of 0 on success, and non zero on failure. Main character exit codes only, obviously. ๐
๐ SEE ALSO ๐
๐ AUTHOR ๐
This manual page was written by Guido Trentalancia <guido@trentalancia.com>.
The SELinux management library was written by Tresys Technology LLC and Red Hat Inc.
and that's the whole page, bestie โ this was semanage.conf, from section 5 of the manual, dated September 2011 ๐ thanks for reading, you ate ๐
โจ
๐ฆ where this page comes from
- fedora 44: libsemanage 3.11-1.fc44 ยท LGPL-2.1-or-later
- fedora 44: libsemanage 3.11-1.fc44 ยท LGPL-2.1-or-later
- nixpkgs unstable: libsemanage 3.11
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms