Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




2.2. Where is the Policy?

There are two components to the policy, the binary tree and the source tree. The binary tree comes from the selinux-policy-<policyname> package and supplies the binary policy file. Alternately, the binary policy can be built from source when the selinux-policy-<policyname>-sources package is installed. For Red Hat Enterprise Linux 4 the <policyname> is targeted. Directory conventions for this guide are explained in Section 3 Conventions for SELinux Directories and Files.

  • /etc/selinux/targeted/ — this is the root folder for the targeted policy, and contains both the binary and source trees.

  • /etc/selinux/targeted/policy/ — the binary policy file policy.<XY> is here. In this guide, the variable $SELINUX_POLICY/ is used for this directory.

  • /etc/selinux/targeted/src/policy/ — this is the location of the policy source tree. For details about these sub-directories, read Section 3.2 Files and Directories of the Targeted Policy. In this guide, the variable $SELINUX_SRC/ is used for this directory.

  • /etc/selinux/targeted/contexts/ — location of the security context information and configuration files, which are used during runtime by various applications. This directory contains:

    • *_context* and default_type — various contexts used by applications, such as the userhelper_context used by userhelper.

    • files/* — the file file_contexts contains the default contexts for the whole file system. This is what restorecon references when relabeling. The file media contains the default contexts for media devices such as the CD-ROM and floppy disk.

    • users/* — in the targeted policy, only the file root is in this directory. These files are used for determining context on login, which is system_r:unconfined_t for root.

  • booleans — this is where the runtime Booleans are configured. This is the canonical configuration file when Boolean values are changed.

To help applications that need the various SELinux paths, libselinux has a number of functions that return the paths to the different configuration files and directories. This keeps applications from having to hard code the paths, especially since the active policy location is dependent on the setting in /etc/selinux/config. The list of functions is available from the manual page which you can view with the command man 3 selinux_binary_policy_path.

  Published under the terms of the GNU General Public License Design by Interspire