Security-Enhanced Linux (SELinux) - (1)
What is SELinux?
SELinux (Security-Enhanced Linux ) is a kernel level security mechanism.Its main purpose is protect user data.
There are two main types of access controls.
- DAC - Discretionary Access Control
- MAC - Mandatory Access Control
DAC - Discretionary Access Control
It provide access control by using user identity. For an example, for particular file there will be a set of users who can access it. Give permissions to user, group and others for reading, writing and executing. Sysadmin involve for each and every moment.In DAC we use , ACL (Access Control List), File permissions and Special permissions .
Owner of the file can transfer information to others. DAC is not secure.
After we creating a file, system will allocate some permissions to it based on umask.
MAC - Mandatory Access Control
When we are dealing with a great number of users, MAC make our life much easier. Because MAC provide the access control by using levels. User can access all the resources with in his level.SELinux is a MAC
It provides kernel level security.
There are three (3) modes is SELinux.
- Enforced
- Permissive
- Disabled
Use this command for retrieving that modes.
Result will be,
We can use following command to see what is current SELinux mode.
There is a SELinux status : enabled and Current mode: enforcing. So that is the mode .
Lets see what are that three modes.
Enforced Mode
It control the access using SELinux policy rules and also event is logged into audit log.Log files are in /vim/log/audit/audit.log
Permissive Mode
Its only monitor and allow access. Event is logged into audit log.Log files are in /vim/log/audit/audit.log
Disabled Mode
SELinux disable. Any one can access.How does it work?
How to Change SELinux mode?
We have three options/modes. Permissive , Enforced , Disabled .Use this command then vim text editor will open.
There is a section called SELinux = enforcing
Now SELinux is in enforcing mode. If we want to change it to permissive mode.
SELinux = permissive then pres ESC and type :WQ to write and exit.
After that we have to reboot the system. Then only the changes will apply.
After type sestatus to check the status.
Always use /etc/sysconfig/selinux path.
A real mode example,
User said that his/her could not access the home directory. So what we can do for it?
- Check current SELinux status using sestatus
- If enforced mode change it to the permissive mode.
- If it does not work , there should be the problem in SELinux policy. So we need to check it.
Switching between enforced mode and permissive mode
Use setenforced [0 or 1]You have to use either 1 or 0. 1 is for enable enforced mode and 0 is for permissive mode.
For an example, Your current mode is permissive and you need to switch to the enforced mode.
setenforced 1
Comments
Post a Comment
Thank you for your comment