POLICYGENTOOL(1)
β¨ POLICYGENTOOL(1) β¨
okay bestie, so this is policygentool from the Debian GNU/Linux manual β buckle up, we're writing SELinux policy together π
πΈ NAME πΈ
policygentool β the interactive SELinux policy generation tool π§ no cap, it literally walks you through it.
π SYNOPSIS π
policygentool [options] <Module Name> <full path for application binary file>
π¦ DESCRIPTION π¦
so like, this tool generates three files for policy development, and they each have a job okay:
- a Type Enforcement (te) file
- a File Context (fc) file
- an Interface File (if)
Most of the policy rules are gonna live in the te file. Use the File Context file to associate file paths with security context. And use the interface rules to let other protected domains interact with the newly defined domains. periodt. π
The tool prompts you for locations of pidfiles, any logfiles, files in /var/lib, and any init scripts β plus whether any network access is desirable for the application. Then it generates the appropriate policy rules for the module. β¨
After these files have been generated, the make files for the appropriate SELinux policy β namely, /usr/share/selinux/refpolicy-targeted/include/Makefile or /usr/share/selinux/refpolicy-strict/include/Makefile β can be used to compile the SELinux policy package. And the resulting policy package can be loaded using semodule. it's giving workflow, fr fr:
# /usr/bin/policygentool myapp /usr/bin/myapp
# cat >Makefile
> HEADERDIR:=/usr/share/selinux/refpolicy-targeted/include
> include $(HEADERDIR)/Makefile
> ^D
# make
# semodule -l myapp.pp
# restorecon -R -v /usr/bin/myapp "all files defined in myapp.fc"
# setenforce 0
# /etc/init.d/myapp start
# audit2allow -R -i /var/log/audit/audit.log
π OPTIONS π
-h,--helpβ prints a short usage message. that's it, that's the whole list bestie π
π FILES π
myapp.te, myapp.if, myapp.fc. the trio. the icons. the moment. π«Ά
π SEE ALSO π
semodule(8), check_policy(8), load_policy(8) β go read these next, iykyk π
π BUGS π
None known. not me being shocked π clean sheet, slay.
π AUTHOR π
This manual page was written by Manoj Srivastava <srivasta@debian.org>, for the Debian GNU/Linux system. thank you for your service π
and that's the whole page, bestie! this one's from the Debian crew, dated Feb 27 2007 β vintage but make it iconic β¨π¦ go forth and write some policies π
π¦ where this page comes from
- debian bookworm: selinux-policy-dev 2:2.20221101-9 Β· GPL-2.0-or-later
- debian trixie: selinux-policy-dev 2:2.20250213-13~deb13u1 Β· GPL-2.0-or-later
- ubuntu jammy: selinux-policy-dev 2:2.20210203-10 Β· GPL-2.0-or-later
- ubuntu noble: selinux-policy-dev 2:2.20240202-1 Β· GPL-2.0-or-later
- ubuntu questing: selinux-policy-dev 2:2.20250213-10
- ubuntu resolute: selinux-policy-dev 2:2.20250213-11 Β· GPL-2.0-or-later
- ubuntu stonking: selinux-policy-dev 2:2.20260929-1 Β· GPL-2.0-or-later
- Copyright (c) 20077 Manoj Srivastava <srivasta@debian.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms