Linux 之 SELinux

2021-03-08  本文已影响0人  googoler

-#为什么要关闭SELinux?
有的软件对于selinux的安全规则支持不够好,就会建议在安装前把selinux先关闭:
例如:k8s:
附:k8s的相应说明:

Setting SELinux in permissive mode by runningsetenforce 0andsed ...effectively disables it.
This is required to allow containers to access the host filesystem, which is needed by pod networks for example.
You have to do this until SELinux support is improved in the kubelet...

其目的在于允许容器访问宿主机的文件系统,
这种情况下只能先关闭selinux
说明:如果不是要运行的软件有相应需求,不建议关闭SELinux;




  1. 修改配置文件:/etc/selinux/config 中 SELINUX=disabled 然后重启机器
    默认值是: #SELINUX=enforcing
  2. 修改/etc/sysconfig/selinux 这个文件也可以生效;因为它其实就是/etc/selinux/config的符号链接

  1. elinux默认的审计日志位于:/var/log/audit/audit.log;
  2. 如何分析selinux的日志?
  3. 查看 SELinux 策略内置各项规则的布尔值:
    //查询本系统内所有的布尔值设置状况:
    getsebool -a
    
    //查询httpd_enable_homedirs是否为关闭,若没关闭,请关闭它:
    getsebool httpd_enable_homedirs
    setsebool -P httpd_enable_homedirs=0    //0是关闭  1是开启
    
上一篇 下一篇

猜你喜欢

热点阅读