Creating our own modules
We can always maintain our own SELinux policy modules as well. To accomplish this, we need to have at least a file with the .te
suffix (which stands for type enforcement) and optionally an .fc
file (file context) and .if
(interface). All these files need to have the same base name, which will be used as a module name later.
There are two "formats" in which SELinux policy modules can be written: the native one, and the reference policy one. The native one does not understand reference policy macros but remains supported (as the reference policy builds on this). Formats using the reference policy support all functions of the "native" one as well, so this format is becoming more and more popular for building and maintaining our own modules.
Building native modules
A native SELinux policy language module starts with a line defining the name of the module, followed by a set of requirements (types or attributes, classes, and permissions) and then the rules themselves, as...