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:
- enforcing – SELinux security policy is enforced.
- permissive – SELinux prints warnings instead of enforcing.
- disabled – SELinux is fully disabled.
Allow access to an HTTP network port
Check that SELinux is not denying actions
Check that SELinux is Properly Enabled
Get List Of Allowed Network Ports
Run SELinux in permissive mode
Temporarily Switch Off SELinux Enforcement
Temporarily Switch On SELinux Enforcement
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.