Disabled <--> Permissive <--> Enforcing
| enforcing/permissive | disabled |
|<--- setenforce ----> |
|<---------------- reboot ------->|
# getenforce -> 현재 상태 확인
# sestatus -> 상태 확인
Current mode: permissive //현재
Mode from config file: permissive // 부팅시
# vi /etc/selinux/config -> SELINUX=enforcing // 부팅 설정
# setenforce 1|0 -> enforcing | permissive // 현재 설정
# ls -Zd /etc/www/html
system_u:object_r:httpd_sys_content_t:s0 /var/www/html
# touch /var/www/html/index.html
# ls -Z /var/www/html/index.html
system_u:object_r:httpd_sys_content_t:s0 /var/www/html/index.html
# touch /tmp/file{1,2}
# ls -Z /tmp/file*
unconfined_u:object_r:user_tmp_t:s0 /tmp/file1
unconfined_u:object_r:user_tmp_t:s0 /tmp/file2
# mv /tmp/file1 /var/www/html
# cp /tmp/file2 /var/www/html
# ls -Z /var/www/html/file*
unconfined_u:object_r:user_tmp_t:s0 /var/www/html/file1
unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/file2
[확인]
# semanage boolean -l | grep homedirs
[설정]
# setsebool -P httpd_enable_homedirs on|off
-P: 현재상태, 부팅시 상태 모두 설정.
[확인]
# semanage port -l | grep http
[추가/변경]
# semanage port -a -t http_port_t -p tcp 8888
[삭제]
# semanage port -d -t http_port_t -p tcp 8888

# setenforce 0
# setenforce 1
# cat /var/log/messages | grep -i preventing
# sealert -l UUID
# semanage fcontext –a –t httpd_sys_content_t‘/web’
# restorecon –Rv /web/index.html
# curl localhost/web/index.html
# cat /var/log/audit/audit.log | grep -i 'avd: denied'
# sealert -a /var/log/audit/audit.log
;;;;