Table of Contents

SELinux

Security-Enhanced Linux (SELinux) is a Linux kernel feature that provides a mechanism for supporting access control security policies which provides great protection. It can stop many attacks before your system rooted.

SELinux enforces the idea that programs should be limited in what files they can access and what actions they can take.

SELinux is a kernel security extension, which can be used to guard against misconfigured or compromised programs. It comes with Mandatory Access Control (MAC) system that improves the traditional UNIX/Linux DAC (Discretionary Access Control) model.

SELinux can be any one of the following state:

Allow access to an HTTP network port

Change the SELinux mode

Check that SELinux is not denying actions

Check that SELinux is Properly Enabled

Check SELinux Status

Confine users

Find Unprotected Services

Get List Of Allowed Network Ports

Install SELinux

Run SELinux in enforcing mode

Run SELinux in permissive mode

Temporarily Switch Off SELinux Enforcement

Temporarily Switch On SELinux Enforcement

Troubleshooting SELinux Policy Errors

Turn off SELinux

Understanding SELinux Configuration

See SELinux Labels

Type the following command:

ls -lZ /path/to/file
ls -lZd /path/to/dir
ls -lZd /etc
ls -lZ /dev/ | grep deviceName
ls -lZ /etc/resolv.conf

Sample outputs:

-rw-r--r--  root root system_u:object_r:net_conf_t     /etc/resolv.conf

Do Boolean Lockdown

Run the getsebool -a command and lockdown system:

getsebool -a | less
getsebool -a | grep off
getsebool -a | grep on

To secure the machine, look at settings which are set to ‘on’ and change to ‘off’ if they do not apply to your setup with the help of setsebool command. Set correct SE Linux booleans to maintain functionality and protection.

Please note that SELinux adds 2-8% overheads to a typical installation.