20160804 SELinux
(정리) 예제 : 웹서비스(httpd, /etc/httpd/conf/httpd.conf, 80)
데몬 이름 : /usr/sbin/httpd
주 설정 파일 : /etc/httpd/conf/httpd.conf
서비스 포트 : 80
웹 디렉토리 : /var/www/html
■ 새로운 서비스(EX: FTP)를 Open 하는 경우의 "서비스 Open 설정 절차"
(ㄱ) 소프트웨어 설치
# yum -y install httpd httpd-tools
(ㄴ) 서비스를 ON
# chkconfig httpd on
# service httpd start
(ㄴ) 방화벽에 서비스를 등록
# iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
# service iptables save /* /etc/sysconfig/iptables */
(ㄷ) SELinux 설정 설정
(서비스 boolean 설정)
# getsebool -a | grep httpd
-> audit messages (AVC denied 메세지를 확인)
-> 적당한 기능 on
(EX) # setsebool httpd_enable_homedirs on
# setsebool -P httpd_enable_homedires on
(서비스 데몬이 읽어 들이는 파일)
-> audit messages (AVC denied 메세지를 확인)
(EX) # mv /home/user01/index.html /var/www/html
# chcon -t httpd_sys_content_t /var/www/html/index.html
# semanage fcontext -a -t httpd_sys_content_t /var/www/html/index.html
|
|
|
[실습] 기타
# avcstat
lookups hits misses allocs reclaims frees 9001600 8979425 22175 22243 15440 21738 |
# seinfo
Statistics for policy file: /etc/selinux/targeted/policy/policy.24 Policy Version & Type: v.24 (binary, mls)
Classes: 81 Permissions: 235 Sensitivities: 1 Categories: 1024 Types: 3637 Attributes: 280 Users: 9 Roles: 12 Booleans: 217 Cond. Expr.: 257 Allow: 291046 Neverallow: 0 Auditallow: 123 Dontaudit: 226655 Type_trans: 33142 Type_change: 38 Type_member: 48 Role allow: 19 Role_trans: 308 Range_trans: 4521 Constraints: 90 Validatetrans: 0 Initial SIDs: 27 Fs_use: 23 Genfscon: 83 Portcon: 446 Netifcon: 0 Nodecon: 0 Permissives: 75 Polcap: 2 |
# seinfo -adomain -x
domain sosreport_t git_session_t cfengine_execd_t bootloader_t netutils_t qmail_tcp_env_t devicekit_power_t ..... (중략) ..... piranha_web_t user_screen_t condor_master_t greylist_milter_t calamaris_t staff_openoffice_t mailman_queue_t |
# seinfo -adomain -x | wc -l
670 |
# seinfo --permissive -x
Permissive Types: 75 nova_api_t sblim_reposd_t nova_compute_t nova_console_t openvswitch_t nova_network_t ..... (중략) ..... vdagent_t zarafa_ical_t namespace_init_t httpd_mediawiki_script_t condor_schedd_t condor_startd_t condor_master_t |
# seinfo --permissive -x | wc -l
77 |
# sesearch --role_allow -t httpd_sys_content_ /etc/selinux/targeted/policy/policy.24
Found 19 role allow rules: allow system_r sysadm_r; allow sysadm_r system_r; allow sysadm_r staff_r; allow sysadm_r user_r; allow system_r guest_r; allow logadm_r system_r; allow system_r logadm_r; allow system_r nx_server_r; allow system_r staff_r; allow staff_r logadm_r; allow staff_r sysadm_r; allow staff_r unconfined_r; allow staff_r webadm_r; allow unconfined_r system_r; allow system_r unconfined_r; allow system_r user_r; allow webadm_r system_r; allow system_r webadm_r; allow system_r xguest_r; |
# sesearch --allow | wc -l
291048 |
# sesearch --dontaudit | wc -l
226657 |
[실습] (GUI) system-config-selinux 툴 사용법
system-config-selinux 메뉴
■ 상태(Status)
■ 부울(Boolean)
■ 파일레이블링(File Labeling)
■ 사용자 맵핑(User Mapping)
■ SELinux사용자(SELinux User)
■ 네트워크포트(Network Port)
■ 정책모듈(Policy Module)
■ 프로세스도메인(Process Domain)
# system-config-selinux &
■ 상태(Status)
|
■ 부울(Boolean)
|
■ 파일레이블링(File Labeling)
|
■ 사용자 맵핑(User Mapping)
|
■ SELinux사용자(SELinux User)
|
■ 네트워크포트(Network Port)
|
■ 정책모듈(Policy Module)
|
■ 프로세스도메인(Process Domain)
|
■ SELinux 반드시 필요한가?
(예) 핸드폰
(예) 사물인터넷 기기와 제어용/모니터링 시스템
(예) 보안장비(EX: Firewall, IPS/IDS, WAF)
(예) IDC 센터의 메인 장비
(예) 공유기
■ SELinux을 설정을 어떻게 하는 것이 좋은가? (EX: 핸드폰)
Box 기법
-------------------
BOX(Software) <-- SELINUX
-------------------
OS(System Software) <-- SELINUX
-------------------
4. 참고 URL
SELinux on CentOS-6.4 - part 1/2
http://www.youtube.com/watch?v=5XzHQvtGfI4
SELinux on CentOS 6.4 - part 2/2
http://www.youtube.com/watch?v=BRXDotR0Mio
SELinux란?
http://www.ylabs.co.kr/index.php?document_srl=4030&mid=board_centos
[실습] SELinux 활용방법에 대한 조사(제한시간: 30분 + 문서작성: 30분)
SELinux에 대해 조사하고 발표한다.- 인터넷 자료를 검색- 신문기사를 검색- 논문을 검색- 기타
발표자료에는 주로 SELinux의 활용방법에 주로 중점을 둔다.(예) SELinux을 어디에 활용할수 있는가?
'모의해킹 침해대응 전문가 과정' 카테고리의 다른 글
| 20160804 ACL(Access Control List) (0) | 2016.08.04 |
|---|---|
| 20160804 Linux and Unix sudo command (0) | 2016.08.04 |
| 20160803 SELinux (0) | 2016.08.03 |
| 20160803 소프트웨어 관리 (0) | 2016.08.03 |
| 20160802 웹 방화벽 (0) | 2016.08.02 |

SELinux관련보고서_윤진식.hwp