728x90
안녕하세요!
오늘은 SELinux 명령어 대하여 알아보겠습니다.
SELinux 명령어
getenforce
- 현재 SELinux 모드 출력 [Enforcing, Permissive, Disabled 중 하나]
사용법 : getenforce
setenforce
- SELinux 모드를 강제(Enforcing) 또는 허용(Permissive)으로 설정
사용법 : setenforce Enforcing | setenforce Permissive
setenforce 1 | setenforce 0
[root@localhost ~]# setenforce usage: setenforce [ Enforcing | Permissive | 1 | 0 ] [root@localhost ~]# setenforce enforcing [root@localhost ~]# getenforce Enforcing [root@localhost ~]# setenforce permissive [root@localhost ~]# getenforce Permissive |
- 영구적으로 변경하려면 /etc/selinux/config 파일에서 SELINUX=enforcing 또는 SELINUX=permissive로 설정해야 합니다.
sestatus
- SELinux의 현재 상태와 구성 세부 정보를 표시
사용법 : sestatus
chcon
- 파일 또는 디렉터리의 SELinux 보안 컨텍스트를 변경
사용법 : chcon [옵션] 컨텍스트 파일명
예시 : chcon -t httpd_sys_content_t /var/www/html/index.html
restorecon
- 파일 또는 디렉터리의 SELinux 보안 컨텍스트를 기본값으로 재설정
사용법 : restorecon [옵션] 컨텍스트 파일명
예시 : restorecon -t httpd_sys_content_t /var/www/html/index.html
semanage
- SELinux 파일, 포트, 사용자 등에 대한 정책 관리
파일 컨텍스트 변경: semanage fcontext -a -t httpd_sys_content_t "/var/www/html(/.*)?"
포트 컨텍스트 변경: semanage port -a -t http_port_t -p tcp 8080
Troubleshooting SELinux
- setroubleshootd
SELinux 관련 문제를 감지하고 해결하기 위한 데몬으로 setroubleshootd 명령을 사용하면 /var/log/message에 로그 메시지가 생성
- sealert
SELinux 정책 위반에 대한 감사로그를 분석하여 사용자가 이해하기 쉬운 형태로 제공
이상입니다.
감사합니다!
728x90
반응형