Inicio › Foros › Sistemas operativos › Linux › semanage para SELinux en Linux CentOS 7 no aparece › Respuesta a: semanage para SELinux en Linux CentOS 7 no aparece
Así es, no es recomendable desactivar SELinux.
Si quieres tener acceso desde Apache a un servidor MySQL externo con SELinux puedes ejecutar estos comandos:
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
Y no necesitarás desactivar SELinux. Asegúrate de que tienes habilitado y activo (modo enforcing) el SELinux. Puedes ver su estado con:
sestatus
Que te devolverá algo así:
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
Si en «Current mode» tienes permissive en lugar de enforcing es porque lo tienes desactivado, para activarlo usa el comando:
setenforce enforcing
Y para asegurarte de que SELinux esté activo en el próximo arranque del equipo comprueba el fichero:
/etc/selinux/config
que debe tener este contenido:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXENGINE= can take one of three two values:
# targeted – Targeted processes are protected,
# minimum – Modification of targeted policy. Only selected processes are protected.
# mls – Multi Level Security protection.
SELINUXENGINE=targeted