chcon -Rv --type=spamc_home_t /usr/local/spamassassin
semanage fcontext -a -t spamc_home_t "/usr/local/spamassassin(/.*)?"
Estou tentando seguir este tutorial
Mas Spamassassin está dando um erro
[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 ]
Mesmo que tenha permissões!
[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
Aqui está o arquivo 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"
Eu tenho o SELinux ativado.
# sestatus
SELinux status: enabled
# ls -Z /usr/local/spamassassin/
-rw-r--r--. spam spam unconfined_u:object_r:usr_t:s0 spamfilter.log
Eu tentei mudar o contexto do diretório, mas ele falhou, mesmo sendo root.
# 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
Lançamento do CentOS 6.8 (Final)
chcon -Rv --type=spamc_home_t /usr/local/spamassassin
semanage fcontext -a -t spamc_home_t "/usr/local/spamassassin(/.*)?"
Verificar:
1) Permissões em toda a árvore de diretórios |
2) Não se lembra exatamente, mas o daemon pode querer recriar o arquivo, então ele precisará de permissão de execução nele