2015-06-18

selinux 해제하기

SELinux 는 Linux의 보안을 강화해 주는 보안 강화 커널이고 zero-day 공격 및 buffer overflow 등 어플리케이션 취약점으로 인한 해킹을 방지해 주는 핵심 구성요소이다.
특정 서비스가 SELinux 때문에 동작하지 않는다면 SELinux 를 끄기 보다는 해당 서비스가 SELinux 하에서 잘 동작하도록 설정을 수정하는걸 권장한다.

SELinux 동작 모드
enforce, permissive, disable 세 가지 모드가 있으며 RHEL/CentOS/Oracle Linux를 설치하면 default 로 enforce mode 로 동작하며 SELinux 의 rule 에 어긋나는 operation 은 거부된다.
현재 SELinux 의 동작 모드는 sestatus 명령어로 확인할 수 있다.
SELinux 모드 확인
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted

Permissive mode 는 rule 에 어긋나는 동작이 있을 경우 audit log 를 남기고 해당 operation 은 허용된다. 개발 서버일 경우 특정 daemon 이나 서비스에 문제가 있을 경우 setenforce 0 으로 Permissive mode 로 전환하여 문제 해결후 enforce mode 로 전환하는걸 추천한다.
# setenforce 0
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted

SELinux 해제
인터넷에 연결된 리눅스 서버라면 SELinux 해제는 결코 추천하지 않는다.
해제할 경우 다시 활성화 시키려면 재부팅이 필요하며 재부팅시 모든 자원에 대해 보안 레이블을 설정해야 하므로 부팅 시간이 매우 오래 걸릴 수 있다.
vi /etc/sysconfig/selinux
SELINUX=enforcing 을 SELINUX=disabled 로 변경후 저장한다.
reboot

댓글 없음:

댓글 쓰기