加入收藏 | 设为首页 | 会员中心 | 我要投稿 无锡站长网 (https://www.0510zz.cn/)- 运维、开发、CDN、操作系统、语音技术!
当前位置: 首页 > 建站 > 正文

系统管理员的SELinux指南:这个大问题的42个答案

发布时间:2018-08-14 19:19:42 所属栏目:建站 来源:Alex Callejas
导读:副标题#e# 技术沙龙 | 8月25日与多位资深技术大咖探讨小程序电商实战 获取有关生活、宇宙和除了有关 SELinux 的重要问题的答案 一个重要而普遍的事实是,事情并不总是你看上去的那样 ―Douglas Adams,《银河系漫游指南》 安全、坚固、遵从性、策略是末世中

SELinux 需要知道 SELinux 设置的关闭或打开的一系列布尔值:

  • 查看所有的布尔值:# getsebool -a
  • 查看每个布尔值的描述:# semanage boolean -l
  • 设置某个布尔值:# setsebool [_boolean_] [1|0]
  • 将它配置为永久值,添加 -P 标志。例如:# setsebool httpd_enable_ftp_server 1 -P
  • SELinux 策略/应用可能有 bug,包括:

    • 不寻常的代码路径
    • 配置
    • 重定向 stdout
    • 泄露的文件描述符
    • 可执行内存
    • 错误构建的库

    开一个工单(但不要提交 Bugzilla 报告;使用 Bugzilla 没有对应的服务)

  • 你的信息可能被损坏了,假如你被限制在某个区域,尝试这样做:

    • 加载内核模块
    • 关闭 SELinux 的强制模式
    • 写入 etc_t/shadow_t
    • 修改 iptables 规则
  • 用于开发策略模块的 SELinux 工具:# yum -y install setroubleshoot setroubleshoot-server。安装完成之后重引导机器或重启 auditd 服务。

  • 使用 journalctl 去列出所有与 setroubleshoot 相关的日志:# journalctl -t setroubleshoot --since=14:20

  • 使用 journalctl 去列出所有与特定 SELinux 标签相关的日志。例如:# journalctl _SELINUX_CONTEXT=system_u:system_r:policykit_t:s0

  • 当 SELinux 错误发生时,使用setroubleshoot 的日志,并尝试找到某些可能的解决方法。例如:从 journalctl 中:

    1. Jun 14 19:41:07 web1 setroubleshoot: SELinux is preventing httpd from getattr access on the file /var/www/html/index.html. For complete message run: sealert -l 12fd8b04-0119-4077-a710-2d0e0ee5755e
    2.  
    3. # sealert -l 12fd8b04-0119-4077-a710-2d0e0ee5755e
    4. SELinux is preventing httpd from getattr access on the file /var/www/html/index.html.
    5.  
    6. ***** Plugin restorecon (99.5 confidence) suggests ************************
    7.  
    8. If you want to fix the label,
    9. /var/www/html/index.html default label should be httpd_syscontent_t.
    10. Then you can restorecon.
    11. Do
    12. # /sbin/restorecon -v /var/www/html/index.html
  • (编辑:无锡站长网)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

  • 推荐文章
      热点阅读