1.SELinux
一种访问控制体系,rhel5的时候支持80多种服务,rhel6的时候支持220各服务,rhel7的时候支持所有服务2.查看SELinux信息
getenforce 查看SELinux的状态setenforce 1/0 设置SELinux的状态
/etc/selinux/conf SELinux的配置文件
ll -Z // 查看文件的上下文
semanage port -l | grep HTTP 查看端口的上下文
semanage port -a -t http_port_t -p tcp 8899 设置端口的上下文
getsebool -a 查看布尔值
yum provides system-config-selinux 查询system-config-selinux从哪个包里安装的
system-config-selinux 图形化的SELinux
3.修改文件的上下文的三种方法(推荐第三种,直接写在内核里,前两种是临时的)
(1)chcon -R -t httpd_sys_content /local/(2)chcon -R --reference /var/www/ /local/
(3)man semanage-fcontext 里面的如下内容
semanage fcontext -a -t httpd_sys_content "/web/(/.*)?"
restorecon -R -v /web
4.SELinux的排错(这些只是大概描述错误)
(1)/var/log/messages(2)/var/log/audit/audit.log
(3)sealert -b(排错工具)
(4)audit2allow < /var/log/audit/audit.log
(5)关于SELinux的排错只能凭经验,企业无论如何都不能关闭SELinux,可以通过关闭和开启SELinux来判断是不是SELinux的错误,可以逐项排查布尔值