SELinux is a system in which :
- you put labels on everything : users, stuff users may want to play with (files, processes, ), ways of playing with these (read, write, )
- by default, everything is forbidden
- each rule defines a
type of user + type of stuff + type of play
that is allowed. When someone asks to play with something, access is granted if labels mach
In more details,
SELinux manages :
- subjects : those who do things : users, processes,
- objects : stuff the "subjects" are trying to interact with : files, ports,
- access : what "subject" does to "object" : read, write, open, connect to,
All these are labelled.
Rules (aka policies) list the
subject → access → object
relationships.
By default, everything is forbidden, unless an explicit rule allows a "subject + access + object".
SELinux does not handle individual
subjects nor individual
objects. It works by
type enforcement, meaning it deals with :
processes with the label user_t
files with the label bin_t
- in rules such as
Processes with the label user_t can execute regular files labeled bin_t
allow cat cat_chow:food eat;
allow dog dog_chow:food eat;
^^^ ^^^^^^^^^^^^^ ^^^
subject object access
- only processes of type
cat
can access cat_chow:food
for action eat
- only processes of type
dog
can access dog_chow:food
for action eat
Multi Category Security (MCS) enforcement
If you own 2 dogs, you may create new types :
Fido_dog
Fido_dog_chow
Spot_dog
Spot_dog_chow
But :
- this will get complex with an increasing number of dogs
- this added complexity is unnecessary as all dogs basically have the same kind of rules : each dog can only eat its own food