SELinx(Security Enhaced Linux)는 리눅스 운영체제에 내장된 보안 모듈로 Deny All, Permit Some 기반으로 동작하여 시스템의 권한 관리와 접근 제어에 있어 세밀하고 엄격한 정책을 관리할 수 있도록 합니다.DAC(Discretionary Access Control)와 다르게 SELinux는 MAC(Mandatory Access Control) 기반으로 중앙에서 걸정된 보안 정책에 따라서 엄격하게 제어됩니다.Enforcing, Permissive, Disabled 세 가지 모드로 동작할 수 있습니다.Enforcing 모드를 사용할 수 있습니다. 정책을 위한하는 행동은 차단하고 차단한 행동에 대한 로그가 기록됩니다.Permissive를 모드를 사용할 수 있습니다. 시스템의 동작을 제한하지 않기 때문에 실제로 발생하는 위반 행동을 분석하여 정책을 수립할 때 도움이 됩니다.Disabled 모드를 사용할 수 있습니다. SELinux 설정은 복잡할 수 있습니다. 만약 정책을 올바르게 구성하지 않으면 애플리케이션 실행 시 문제가 발생할 수 있습니다. 또한 SELinux는 시스템의 상호작용을 검사하기 때문에 오버헤드가 발생할 수 있습니다. 그러므로 클라우드 환경(예: AWS)에서 주로 비활성화하는 경우가 많습니다./etc/selinux/config 입니다.Disabled 할 때, sudo grubby --update-kernel ALL --args selinux=0 사용하여 SELinux가 부팅시 로드되지 않도록 설정할 수 있습니다. 이렇게 하면 /etc/selinux/config 를 별도로 설정하지 않고 SELinux가 부팅시 로드되지 않도록 설정할 수 있습니다.1. SELinux의 현재 상태를 확인
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
Memory protection checking: actual (secure)
Max kernel policy version: 33
2. SELinux 설정 파일에서 모드를 permissive로 변경
sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
3. SELinux 설정 파일을 확인하여 변경 내역을 확인
cat /etc/selinux/config | grep ^SELINUX=
출력
SELINUX=permissive
4. SELinux 설정을 일시적으로 변경
sudo setenforce 0
5. SELinux 상태를 확인
sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 33