공부공부 공부공부내용
vol2_2 SELinux 본문
Selinux
-
리눅스의 보안을 강화
-
DAC 모델이 아닌 MAC 사용
-
DAC
-
/etc/passwdr w-r--r-- 으로 인해 시스템의 모든 사용자가 접근할 수 있음
-
권한이 루트 사용자에게 집중되어 있기 때문에 보안에 취약
-
프로그램 -> root 권한으로 실행 -> 취약점 -> /etc/passwd 접근
-
사용자의 권한을 기반으로 파일이나 자원에 대한 접근
-
MAC
-
주체: 시스템 자원에 접근하는 프로세스 또는 사용자 등을 의미
-
객체: 파일 또는 포트와 같은 시스템 자원
-
사용자, 파일, 포트 ...에 대한 정책 부여
-
정책: context
-
Selinux의 파일 접근 방식
-
process(httpd) ------ 접근 -----> file1 (httpd_sys_t)
|
----------------접근 불가 -------> file2 (mysql_db_t)
-
보안 테스트: context
-
부울: 정책 스위치
setenforce 1 -> Enforcing 모드
setenforce 0 -> Permissive 모드
SELinux 컨텍스트(SELinux Context) 실습
yum install -y httpd
systemctl start httpd
ps Z -ef | grep httpd
ls -dZ /var/www/html/
getenforce
setenforce 0
getenforce
setenforce 1
getenforce
---------------------------------------------------
firewall-cmd --add-service=http
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
vi /var/index.html
ls -Z /var/index.html
cp /var/index.html /var/www/html/index2.html
ls -Z /var/www/html/index2.html
cp -a /var/index.html /var/www/html/index3.html
ls -Z /var/www/html/index3.html
setenforce 0
getenforce
setenforce 1
restorecon -v /var/www/html/index3.html
ls -Z /var/www/html/index3.html
-----------------------------------------------
yum install policycoreutils-python
mkdir /virt1
ls -dZ /virt1
semanage fcontext -a -t httpd_sys_content_t '/virt1(/.*)?'
semanage fcontext -l | grep httpd
restorecon -RFv /virt1/
ls -dZ /virt1/
setenforce 로 permissive 설정 시, SELinux 가 메모리에서만 꺼져있는 상태가 된다.
그래서 , 재부팅을 하면 다시 enforcing 모드로 바뀌어 있음.
영구적으로 꺼져있는 상태를 만들기 위해서는
cat /etc/sysconfig/selinux
로 먼저확인하고,
vi /etc/sysconfig/selinux 명령어를 통해서
SELINUX=enforcing 모드로 전환해준다.
getsebool -a
setsebool -P xdm_write_home on
getsebool -a | grep xdm_write
------------------------------------------------------------------------------------------------------------------------------------------------
오후
'IT 기초, 네트워크, 리눅스 > 2. 리눅스 기초 vol2 (kvm 활용한 서비스 관리)' 카테고리의 다른 글
vol2 _4 NFS (0) | 2020.06.03 |
---|---|
vol2_3 DNS 서버구성 (DHCP 포함) (0) | 2020.06.03 |
vol2_1 네트워크 티밍 (0) | 2020.06.03 |
vol2 _5 nfs 스토리지 구성과 마운트로 연결하기 (수동맵, 자동맵<직접맵,간접맵>) (0) | 2020.06.03 |
vol2_6블록스토리지 (0) | 2020.06.03 |