본문 바로가기

DevOps/Linux

[Linux] SELinux

SELinux

리눅스의 전통적인 보안을 강화하기 위하여 탄생함. 리눅스의 각각의 객체 (프로세스 파일 서비스 디렉토리 데몬 등)에 모두 정책을 부여한다. 접근, 실행, 수정, 복사 등의 정책을 부여하여 정책이 어긋나면 실행이 되지 않게 하는 것

CentOS 7 부터는 SELinux의 역할이 자동으로 수행된다.


SELinux의 3가지 모드

# 강제 (Enforcing) : 완전히 실행을 시킴. 시스템 보안에 영향을 끼치는 영향이 확인이 되면 그 기능의 작동을 차단

# 허용 (Permissive) : 시스템보안에 영향을 끼치는 기능이 확인되면 허용은 하되 로그에 기록을 한다

# 비활성 (Disabled) : SELinux를 비활성화 한다. 메모리에 SELinux 모듈이 아예 올라가지 않는다.


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
Max kernel policy version:      31

 

getenforce
Enforcing

 

# SELinux의 상태를 확인하는 명령어이다. Enforcing은 SELinux가 작동중임을 알 수 있다.

# 따라서 SELinux를 중지시키기 위해서는 아래의 명령어를 이용해야한다.

 

setenforce 0
getenforce
Permissive

# setenforce 1 : Enforcing 설정

# setenforce 0 : Permissive 설정

 

# 하지만 해당 설정은 재부팅시 초기화가 되므로

 

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=disabled # disabled로 수정
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

# 6번째 라인의 SELINUX= disabled로 수정한다.

# Host VM과 Client VM 모두를 해당 작업을 진행해준다.

 

'DevOps > Linux' 카테고리의 다른 글

[Linux] XE를 이용하여 웹서버 구축하기  (0) 2021.08.25
[Linux] Linux DB서버 구축하기  (0) 2021.08.24
[Linux] Linux 데이터베이스 기초  (0) 2021.08.24
[Linux] DNS 레코드  (0) 2021.08.23
[Linux] DNS 서버 만들기 실습  (0) 2021.08.23