"SELinux"의 두 판 사이의 차이
둘러보기로 가기
검색하러 가기
잔글 |
잔글 |
||
38번째 줄: | 38번째 줄: | ||
− | Security Context (보안 컨텍스트) | + | <span style="color:#008000;">'''Security Context (보안 컨텍스트)'''</span> |
{| border="1" cellspacing="0" cellpadding="1" style="width:100%;" | {| border="1" cellspacing="0" cellpadding="1" style="width:100%;" | ||
57번째 줄: | 57번째 줄: | ||
− | == SELinux | + | == SELinux 설정 == |
− | |||
− | |||
− | SELinux 관리 도구 설치 | + | === SELinux 관리 도구 설치 === |
<pre>yum -y install setools-console</pre> | <pre>yum -y install setools-console</pre> | ||
− | + | === <br/>Context 정보 조회 === | |
− | |||
− | Context 정보 조회 | ||
<pre>seinfo | <pre>seinfo | ||
seinfo -adomain -x | seinfo -adomain -x | ||
76번째 줄: | 72번째 줄: | ||
</pre> | </pre> | ||
− | + | ||
+ | |||
=== 조회 및 상태 확인 === | === 조회 및 상태 확인 === | ||
100번째 줄: | 97번째 줄: | ||
port 확인 | port 확인 | ||
<pre>semanage port -l | grep http</pre> | <pre>semanage port -l | grep http</pre> | ||
− | + | <br/>sestatus | |
− | |||
− | sestatus | ||
<pre>[root@manage001 selinux] sestatus | <pre>[root@manage001 selinux] sestatus | ||
SELinux status: enabled | SELinux status: enabled | ||
113번째 줄: | 108번째 줄: | ||
Policy deny_unknown status: allowed | Policy deny_unknown status: allowed | ||
Max kernel policy version: 28</pre> | Max kernel policy version: 28</pre> | ||
− | |||
=== SELinux 설정 변경 === | === SELinux 설정 변경 === | ||
144번째 줄: | 138번째 줄: | ||
<pre>setenforce 0 #--- permissive mode로 전환 | <pre>setenforce 0 #--- permissive mode로 전환 | ||
setenforce 1 #--- enforce mode로 전환</pre> | setenforce 1 #--- enforce mode로 전환</pre> | ||
− | + | <br/>vi /etc/selinux/config | |
− | |||
− | vi /etc/selinux/config | ||
<pre>SELINUX=disabled</pre> | <pre>SELINUX=disabled</pre> | ||
− | |||
== 참고 문헌 == | == 참고 문헌 == | ||
2016년 5월 23일 (월) 08:51 판
SELinux (Security-Enhanced Lunux)를 정리 한다.
목차
SELinux 개요
SELinux (Security-Enhanced Lunux)은 NSA (National Security Agency, 미국 국가 안보국)에서 개발한 MAC 기안의 보안 커널을 Linux에 이식한 커널 레벨의 보안 모듈 이다.
Access Control (접근 통제)
Object (객체) | 시스템 자원 |
Subject (주체) | 사용자나 프로세스 |
DAC (Discretionary Access Control, 임의 접근 통제)
시스템 객체에 대한 접근을 사용자 또는 그룹을 기준으로 제한 한다.
setuid : 일반 사용자가 root 권한으로 프로그램을 실행할 수 있도록 허용 한다.
ls -alF /usr/bin/passwd find /bin /usr/bin /sbin -perm -4000 -exec ls -ldb {} \;
MAC (Mandatory Access Control, 강제 접근 통제)
미리 정해진 정책과 보안 등급에 의거하여 주체에게 허용된 접근 권한과 객체에게 보여된 허용 등급을 비교하여 접근을 통제 한다.
Security Context (보안 컨텍스트)
User (사용자) | 시스템과는 별도로 SELinx 사용자 |
Role (역할) | 하나 이상의 Type과 연결 |
Type | TE (Type Enforcement) 프로세스의 도메인이나 파일의 타입을 기반으로 접근 통제를 수행 한다. |
Level | MLS (Multi Level System) 강제 접근 통제보다 더 강력한 보안이 필요할 때 사용 한다. |
SELinux 설정
SELinux 관리 도구 설치
yum -y install setools-console
Context 정보 조회
seinfo seinfo -adomain -x #--- httpd_sys_content_t 객체에 접근할 수 있는 role 표시 sesearch --role_allow -t httpd_sys_content_t #--- Contextㅇ 허용된 action sesearch --allow -s httpd_t
조회 및 상태 확인
-Z 옵션
#--- Security Context 확인 : httpd_t [root@cloud-web data] ps -efZ | grep http unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 1582 1555 0 23:39 pts/0 00:00:00 grep --color=auto http system_u:system_r:httpd_t:s0 root 5895 1 0 5월20 ? 00:00:13 /usr/sbin/httpd -DFOREGROUND system_u:system_r:httpd_t:s0 apache 26481 5895 0 03:19 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND system_u:system_r:httpd_t:s0 apache 26482 5895 0 03:19 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND system_u:system_r:httpd_t:s0 apache 26483 5895 0 03:19 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND system_u:system_r:httpd_t:s0 apache 26484 5895 0 03:19 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND system_u:system_r:httpd_t:s0 apache 26485 5895 0 03:19 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND system_u:system_r:httpd_t:s0 apache 30046 5895 0 12:54 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND #--- TE (Type Enforcement) 확인 : httpd_sys_content_t [root@cloud-web www] ls -Z /var/www drwxr-xr-x. root root system_u:object_r:httpd_sys_script_exec_t:s0 cgi-bin drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 html
User (system_u), Role (object_r), Type (httpd_sys_script_exec_t, httpd_sys_content_t), Level (s0)
port 확인
semanage port -l | grep http
sestatus
[root@manage001 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: disabled Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 28
SELinux 설정 변경
SELinux Mode
Mode | int | Description |
---|---|---|
enforce | 1 | 기본 설정 위반시 차안 |
permissive | 0 | 위반시 경고 메시지를 표시하지만 차단하지 않음 |
disable | SELinux를 사용하지 않음 |
setenforce 명령으로 설정 변경
setenforce 0 #--- permissive mode로 전환 setenforce 1 #--- enforce mode로 전환
vi /etc/selinux/config
SELINUX=disabled