SELinux阻止/ etc / aliases电子邮件pipe道从工作脚本

当有人发送电子邮件到我的服务器,例如

[email protected] 

我想它pipe道到一个PHP脚本。 所以在我的

 /etc/aliases 

文件我有:

 somestringthatisnotnecessarilyauser: "|/path/to/php/script.php" 

在禁用SELinux的情况下,它将电子邮件完美地发送到PHP脚本。

启用S​​Elinux后,maillog出现了一个权限错误:

 local[19660]: fatal: execvp /path/to/php/script.php: Permission denied 

我对SELinux相当陌生,但是我把这个问题归咎于SELinux,因为在禁用的时候,它工作的很好。

有谁知道什么semanage命令,或其他政策,我需要申请与SELinux启用这个工作?

操作系统是Centos6.5 64位

这是什么/var/log/audit/audit.log发送电子邮件地址时说:

 type=AVC msg=audit(1395174916.444:476603): avc: denied { search } for pid=25396 comm="local" name="web" dev=dm-0 ino=522246 scontext=unconfined_u:system_r:postfix_local_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=dir type=SYSCALL msg=audit(1395174916.444:476603): arch=c000003e syscall=59 success=no exit=-13 a0=7feaddb404a0 a1=7feaddb40470 a2=7feaddb3b2d0 a3=7fffa4fe93d0 items=0 ppid=21187 pid=25396 auid=500 uid=99 gid=99 euid=99 suid=99 fsuid=99 egid=99 sgid=99 fsgid=99 tty=(none) ses=69836 comm="local" exe="/usr/libexec/postfix/local" subj=unconfined_u:system_r:postfix_local_t:s0 key=(null) 

这里是getsebool httpd_can_sendmail的输出

 $ getsebool httpd_can_sendmail httpd_can_sendmail --> on 

SELinux学习起来相当艰巨。 哎呀,我还是不完全了解一切。 但有一件事帮助我,就是安装包setroubleshoot并学习如何使用sealertaudit2allow工具。 它会查看您的审计日志,查找被拒绝的内容,为什么被阻止提供基本描述,并帮助您创build规则,以便在需要时允许它。 我认为这是EPEL回购协议的一部分。 一探究竟。

你可以尝试:

 semanage permissive -a postfix_local_t 

它应该设置SELinux允许进程typespostfix_local_t