Selinux TIPS para RHCSA
* sestatus: para revisar la configuración de selinux en el equipo
[root@exam2 ftp]# sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 24 Policy from config file: targeted
* Cambiar el rol de un usuario: semanager login -a -s <rol> <usuario>
[root@exam2 ftp]# semanage login -l Nombre de Ingreso Usuario SELinux Rango MLS/MCS __default__ unconfined_u s0-s0:c0.c1023 root unconfined_u s0-s0:c0.c1023 system_u system_u s0-s0:c0.c1023 test1 guest_u s0 [root@exam2 ftp]# semanage login -a -s staff_u test1 [root@exam2 ftp]# semanage login -l Nombre de Ingreso Usuario SELinux Rango MLS/MCS __default__ unconfined_u s0-s0:c0.c1023 root unconfined_u s0-s0:c0.c1023 system_u system_u s0-s0:c0.c1023 test1 staff_u s0-s0:c0.c1023 [root@exam2 ftp]#
*Manejo de booleanos en selinux (-P hace persistente el cambio):
[root@exam2 ftp]# setsebool -P allow_guest_exec_content 0 [root@exam2 ftp]# getsebool allow_guest_exec_content allow_guest_exec_content --> off [root@exam2 ftp]#
* Identificar el contexto de los archivos.
Ejm: Para cambiar el DocumentRoot del ftp
[root@exam2 ftp]# ls -Zd /var/ftp/pub/ drwxr-xr-x. root root system_u:object_r:public_content_t:s0 /var/ftp/pub/ [root@exam2 ftp]# ls -Zd /ftp drwxr-xr-x. root root system_u:object_r:default_t:s0 /ftp [root@exam2 ftp]# chcon -R --reference /var/ftp/pub/ /ftp/ [root@exam2 ftp]# ls -Zd /ftp drwxr-xr-x. root root system_u:object_r:public_content_t:s0 /ftp
También es válido:
[root@exam2 ftp]# chcon -R -u system_u -t public_content_t /ftp
Para saber más SeLinux Tips en el Proyecto Fedora
Comentarios (0)
Trackbacks (0)
Deja un comentario
Trackback