Pages

Thursday, April 19, 2012

Introduction to Selinux

Security-Enhanced Linux (SELinux) is an implementation of a mandatory access control mechanism in the Linux kernel, checking for allowed operations after standard discretionary access controls are checked. It was created by the National Security Agency and can enforce rules on files and processes in a Linux system, and on their actions, based on defined policy.

When using SELinux, files, including directories and devices, are referred to as objects. Processes, such as a user running a command or the Mozilla Firefox application, are referred to as subjects. Most operating systems use a Discretionary Access Control (DAC) system that controls how subjects interact with objects, and how subjects interact with each other. On operating systems using DAC, users control the permissions of files (objects) that they own. For example, on Linux operating systems, users could make their home directories world-readable, giving users and processes (subjects) access to potentially sensitive information, with no further protection over this unwanted action. Security-Enhanced Linux (SELinux) adds Mandatory Access Control (MAC) to the Linux kernel, and is enabled by default in Red Hat Enterprise Linux.

 The following is an example of the labels containing security-relevant information that are used on processes, Linux users, and files, on Linux operating systems that run SELinux.

This information is called the SELinux context, and is viewed using the ls -Z command:-

 # ls -Z file1 


 -rwxrw-r--   user1      group1         unconfined_u:object_r:user_home_t:s0            file1

In this example, SELinux provides a user (unconfined_u), a role (object_r), a type (user_home_t), and a level (s0). Linux contexts follow the SELinux user:role:type:level

SELinux user :-   The SELinux user identity is an identity known to the policy that is authorized for a specific set of roles, and for a specific MLS range.

 # /usr/sbin/semanage login -l

 Login Name                        SELinux User                     MLS/MCS Range 
 __default__                         unconfined_u                           s0-s0:c0.c1023
 root                                     unconfined_u                          s0-s0:c0.c1023
 system_u                             system_u                                s0-s0:c0.c1023

 Role :- Part of SELinux is the Role-Based Access Control (RBAC) security model. The role is an attribute of RBAC. SELinux users are authorized for roles, and roles are authorized for domains.

Type:-  The type is an attribute of Type Enforcement. The type defines a domain for processes, and a type for files.

Level:-  The level is an attribute of MLS and Multi-Category Security (MCS). An MLS range is a pair of levels, written aslowlevel-highlevel if the levels differ, or lowlevel if the levels are identical (s0-s0 is the same as s0). Each level is a sensitivity-category pair, with categories being optional. If there are categories, the level is written assensitivity:category-set. If there are no categories, it is written as sensitivity. If the category set is a contiguous series, it can be abbreviated. For example, c0.c3 is the same as c0,c1,c2,c3. The /etc/selinux/targeted/setrans.conf file maps levels (s0:c0) to human-readable form (ie. CompanyConfidential)

No comments:

Post a Comment