1-SELinux - SSH Key Based Authentication
1-SELinux - SSH Key Based Authentication
It will tell us which application have which type of access and user used to which
directories in our computers.
We use SElinux if our server is connected to the internet to avoid attacks but if we
are in our data center and the server is protected we do not have to use it.
Protection from Users and Services from any security risk. SELinux Depends on
Mandatory access control (MAC). SELinux implemented in the kernel.
Note: to move from disabled mode to either Permissive or enforcing mode you
have to restart the machine and vice versa.
It is composed of subject and object where subject can be (users or services) trying
to access object (files, folders, ports and sockets).
The context protects process, file and ports form any change not match with the
policy set.
Role Section:
1. file or directory: object_r
2. Process: system_r
3. Port: system_r
Type:
1. file or directory: httd_sys_content_t
2. Process: httpd_t
3. Port: httpd_t
Note: any change in the above the context, that is means the policy do not match
and the service will break down. The service protects itself with context and the
files in the directories inherit this context form the directory.
Note: each service have its own context on the system, so to let service access the
other service we must make policy. Any service components (files, process and
port)
It is a very nice utility when something goes wrong because it check the context of
the directory and make sure that it matches the policy.
To modify the context, we need to know which context we should use easy
solution see the configuration of service because there is many contexts.
[root@server ~]#semanage fcontext –l | less ==> will display all contexts of the
system.
[root@server ~]# semanage fcontext –l | grep httpd
Note: fingerprint is found when we connect from the client to the server, it will ask
me to save the fingerprint on my client machine, this is the server public key.
public and private key can be used in another way in ssh user can use them instead
of password:
1. At the client side ssh [email protected] → user has its private key that is
saved at ~/user1/.ssh/id_rsa message sent with the private key.