我试图按照这个教程
https://www.rosehosting.com/blog/how-to-install-and-integrate-spamassassin-with-postfix-on-a-centos-6-vps/
但Spamassassin正在给出一个错误
[root@ip-172-99-99-99 ~]# service spamassassin restart Stopping spamd: [ OK ] Starting spamd: Jan 4 21:17:10.569 [22463] warn: logger: failed to open file /usr/local/spamassassin/spamfilter.log: Permission denied Jan 4 21:17:10.587 [22463] warn: logger: failed to add file method: logger: file initialization failed [ OK ]
即使它有权限!
[root@ip-172-99-99-99 ~]# ls -ld /usr/local/spamassassin /usr/local/spamassassin/* drwx------. 2 spam spam 4096 Jan 3 20:02 /usr/local/spamassassin -rw-r--r--. 1 spam spam 0 Jan 3 20:02 /usr/local/spamassassin/spamfilter.log # sudo -u spam ls /usr/local/spamassassin/spamfilter.log /usr/local/spamassassin/spamfilter.log # sudo -u spam touch /usr/local/spamassassin/spamfilter.log
这是sysconfig文件
[root@ip-172-99-99-99 ~]# cat /etc/sysconfig/spamassassin # Options to spamd SAHOME=/usr/local/spamassassin SPID_DIR=/var/run/spamassassin SUSER=spam SPAMDOPTIONS="-d -c -m5 --username ${SUSER} -H ${SAHOME} -s ${SAHOME}/spamfilter.log"
我启用了SELinux。
# sestatus SELinux status: enabled # ls -Z /usr/local/spamassassin/ -rw-r--r--. spam spam unconfined_u:object_r:usr_t:s0 spamfilter.log
我试图改变目录的上下文,但它失败了,即使我是根。
# grep spamd_t /var/log/audit/audit.log type=AVC msg=audit(1483587389.449:354941): avc: denied { append } for pid=31588 comm="spamd" name="spamfilter.log" dev=xvde ino=24109 scontext=unconfined_u:system_r:spamd_t:s0 tcontext=unconfined_u:object_r:usr_t:s0 tclass=file type=SYSCALL msg=audit(1483587389.449:354941): arch=c000003e syscall=2 success=no exit=-13 a0=3463960 a1=441 a2=1b6 a3=7ff745c00d50 items=0 ppid=31587 pid=31588 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=4038 comm="spamd" exe="/usr/bin/perl" subj=unconfined_u:system_r:spamd_t:s0 key=(null) # chcon -v --type=spamd_t /usr/local/spamassassin changing security context of `/usr/local/spamassassin' chcon: failed to change context of `/usr/local/spamassassin' to `system_u:object_r:spamd_t:s0': Permission denied # sudo chcon -v --type=spamd_t /usr/local/spamassassin changing security context of `/usr/local/spamassassin' chcon: failed to change context of `/usr/local/spamassassin' to `system_u:object_r:spamd_t:s0': Permission denied
CentOS版本6.8(最终)
https://wiki.centos.org/HowTos/SELinux#head-0f6390ddacfab39ee973ed8018a32212c2a02199
chcon -Rv --type=spamc_home_t /usr/local/spamassassin semanage fcontext -a -t spamc_home_t "/usr/local/spamassassin(/.*)?"
检查:
1)在目录树中的权限
2)不能准确记住它,但守护进程可能要重新创build文件,所以它将需要执行权限