12. CentOS는 우분투와 다르게 SELinux라는 커널 레벨의 보안 모듈을 사용합니다. 평소에는 enforcing 모드로 보안 정책을 적용하도록 설정합니다. sestatus 명령어를 이용해 SELinux의 보안 모드를 확인해 보겠습니다. 예상했던 것처럼 Current mode가 enforcing으로 설정되어 있습니다.
[root@compute ~]# sestatus 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
13. SELinux의 보안 모드를 변경하는 방법은 두 가지입니다. 그중 하나는 /etc/sysconfig/selinux 파일을 열어 enforcing으로 설정된 SELINUX 값을 permissive나 disabled로 변경하는 것입니다. 저장한 후 시스템을 재부팅합니다.
[root@compute ~]# vi /etc/sysconfig/selinux
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 SELINUX = disabled
SELINUXTYPE= 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.
SELINUXTYPE=targeted