SELinux Flashcards
Check the current SELinux state:
getenforce
There are 3 states in SELinux:
disabled, permissive, and enforcing
How to change the state of SELinux:
setenforce {Permissive or 0, Enforcing or 1}
Where are the SELinux logs?
/var/log/audit/audit.log
How to search the logs?
grep AVC /var/log/audit/audit.log
or
sealert -a /var/log/audit/audit.log
(Access Vector Cache)
SELinux Overview
SELinux is essentially labeling, called security contexts
All processes, files, and directories have security contexts. All files and directories in inherit a default security context.
SELinux is a type enforcement system
SELinux messages for allowing or denying are cached as Access Vector Cach(AVC)
SELinux Messages Contain?
scontext = source context of the process tcontext = target context of the process
Two packages to install to help troubleshoot SELinux
yum install policycoreutils-gui setroubleshoot
File that contains the state of SELinux?
/etc/selinux/config
To see the man pages related to SELinux?
apropos selinux
man -k selinux
to view the secuirty context on a file or directory?
ls -Z /etc/
The security context is broken down into three components
User:Role:Type
User- refers to the type of user logged in
Role- Which indicates the purpose of this file
View the security context for a running process
ps auZ
Reference a files security context and transfer it to another file:
chcon –reference /root/anaconda-ks.cfg /etc/ssh/sshdconfig
To restore the default security context ?
restorecon -R /root/.ssh