httpd (WordPress) 获取 avc 拒绝写入 (SELinux)

httpd (WordPress) 获取 avc 拒绝写入 (SELinux)

我收到以下消息/var/log/audit/audit.log

type=AVC msg=audit(1402615093.053:68): avc:  denied  { write } for  pid=799 comm="httpd" name="php" dev="xvda1" ino=8667365 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=dir
type=SYSCALL msg=audit(1402615093.053:68): arch=c000003e syscall=2 success=no exit=-13 a0=7f7a5ca697a8 a1=241 a2=1b6 a3=1 items=0 ppid=662 pid=799 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)

管道audit2allow输出:

#============= httpd_t ==============

#!!!! This avc can be allowed using the boolean 'httpd_unified'
allow httpd_t httpd_sys_content_t:dir write;

@Michael 我试过了,但仍然有 wordpress 写入问题.htaccess,,wp-config.phpwp-content.

# ls -Z .htaccess wp-config.php 
-rw-rw-rw-. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 .htaccess
-rw-rw-rw-. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 wp-config.php
# chcon -t httpd_sys_rw_content_t .htaccess wp-config.php 
# ls -Z .htaccess wp-config.php 
-rw-rw-rw-. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 .htaccess
-rw-rw-rw-. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 wp-config.php
# 

有任何想法吗?

答案1

您有两个选择:

  1. 您可以设置您想要写入的httpd_sys_rw_content_t文件的类型。httpd

  2. 您可以设置httpd_unified建议的布尔值。但这可能会产生其他副作用。

相关内容