3 ms·
They are completely different things, and where available should be used together. SELinux is a policy system where policy is enforced via labels. Labels are
by cpuguy83 5y ago
They are completely different things, and where available should be used together.
SELinux is a policy system where policy is enforced via labels.
Labels are applied to processes which classify what the process is.
Labels are applied to files which define the what classification of process can access the file.
The application of labels happens automatically based on policy. Such policy would include the location of the file or the label of the parent process.
As an example, the default policy for httpd would prevent httpd from accessing /etc/passwd even though the process is running as (or can be) the root user.
I believe you could also do interesting things like prevent httpd from opening a socket on a non-standard port if you wanted to.
SELinux is very powerful but complicated. Ideally you use this with distro packages which should have policies already configured for you.
Critically it is not one vs the other. Use both if you have it.