zoukankan      html  css  js  c++  java
  • SELinux的故障排除一例

    刚刚采用Puppet部署了dokuwiki,不过配置完成后报错:

    DokuWiki Setup Error
    
    The datadir ('pages') at /pages is not found, isn't accessible or writable. You should check your config and permission settings. Or maybe you want to run the installer?

    尝试关闭了SELinux,之后就正常。可是在测试环境中就没这个问题。系统环境基本一致。

    于是查看了下audit.log:

    tail -f /var/log/audit/audit.log | grep -i httpd
    
    type=AVC msg=audit(1377479847.165:7269): avc:  denied  { search } for  pid=11160 comm="httpd" name="/" dev=dm-2 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir
    type=SYSCALL msg=audit(1377479847.165:7269): arch=40000003 syscall=33 success=no exit=-13 a0=1ebef68 a1=0 a2=1323e18 a3=f items=0 ppid=11149 pid=11160 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1122 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
    type=AVC msg=audit(1377479847.166:7270): avc:  denied  { search } for  pid=11160 comm="httpd" name="/" dev=dm-2 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir
    type=SYSCALL msg=audit(1377479847.166:7270): arch=40000003 syscall=33 success=no exit=-13 a0=1ec5a58 a1=0 a2=1323e18 a3=f items=0 ppid=11149 pid=11160 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1122 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
    type=AVC msg=audit(1377479847.166:7271): avc:  denied  { search } for  pid=11160 comm="httpd" name="/" dev=dm-2 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir
    type=SYSCALL msg=audit(1377479847.166:7271): arch=40000003 syscall=33 success=no exit=-13 a0=1eafc54 a1=0 a2=1323e18 a3=f items=0 ppid=11149 pid=11160 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1122 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
    type=AVC msg=audit(1377479847.166:7272): avc:  denied  { search } for  pid=11160 comm="httpd" name="/" dev=dm-2 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir
    type=SYSCALL msg=audit(1377479847.166:7272): arch=40000003 syscall=33 success=no exit=-13 a0=1eafcb8 a1=0 a2=1323e18 a3=f items=0 ppid=11149 pid=11160 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1122 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
    type=AVC msg=audit(1377479847.166:7273): avc:  denied  { search } for  pid=11160 comm="httpd" name="/" dev=dm-2 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir
    type=SYSCALL msg=audit(1377479847.166:7273): arch=40000003 syscall=33 success=no exit=-13 a0=1eb04e8 a1=0 a2=1323e18 a3=f items=0 ppid=11149 pid=11160 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1122 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
    type=AVC msg=audit(1377479847.166:7274): avc:  denied  { search } for  pid=11160 comm="httpd" name="/" dev=dm-2 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir
    type=SYSCALL msg=audit(1377479847.166:7274): arch=40000003 syscall=33 success=no exit=-13 a0=1eb0624 a1=0 a2=1323e18 a3=f items=0 ppid=11149 pid=11160 auid=0 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1122 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

    HOHO,第一次处理SELinux的故障,看到其中的name、dev以及scontext和tcontext,于是在“/”下找找:

    [root@localhost /]# ll -Z /
    drwxr-xr-x. apache apache system_u:object_r:file_t:s0      wiki

    后来发现是因为将wiki的目录建在了“/”下面,并重新挂载了一个分区,重新赋予权限就好了

    [root@localhost /]# chcon -t httpd_t /wiki

    对SELinux的了解还是太浅,呵呵。

  • 相关阅读:
    JS事件冒泡、事件捕获和事件委托
    实现英文字母排序
    JavaScript异步加载的四种方法
    JavaScript作用域与作用域链
    JavaScript 自定义属性 data-*
    asycn和await
    style collectd
    JavaScript如何比较两个数组的内容是否相同
    VScode插件开发--M2D文档转换插件
    BOM笔记
  • 原文地址:https://www.cnblogs.com/rexkang/p/selinux-problem-of-dokuwiki-installation.html
Copyright © 2011-2022 走看看