Я успешно установил postfix, и когда я запускаю его как root / sudo с-
postfix start
... он работает без ограничений и отправляет электронные письма.
Когда я настроил его на автоматический запуск при загрузке с помощью -
systemctl enable postfix.service
... он запускается во время загрузки и работает нормально, но отправка писем блокируется selinux.
При отправке электронного письма в журнале отображается-
Jun 6 11:12:20 mainbox kernel: [ 1045.572306] type=1400 audit(1496761940.747:254): avc: denied { read write } for pid=970 comm="cleanup" name="unix.cleanup" dev="xvda1" ino=131013 scontext=system_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file
Jun 6 11:12:20 mainbox kernel: [ 1045.592045] type=1300 audit(1496761940.747:254): arch=c000003e syscall=2 success=no exit=-13 a0=7f3eae371020 a1=2 a2=0 a3=3 items=0 ppid=811 pid=970 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="cleanup" exe="/usr/libexec/postfix/cleanup" subj=system_u:system_r:postfix_cleanup_t:s0 key=(null)
Jun 6 11:12:20 mainbox kernel: type=1400 audit(1496761940.747:254): avc: denied { read write } for pid=970 comm="cleanup" name="unix.cleanup" dev="xvda1" ino=131013 scontext=system_u:system_r:postfix_cleanup_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file
Jun 6 11:12:20 mainbox kernel: type=1300 audit(1496761940.747:254): arch=c000003e syscall=2 success=no exit=-13 a0=7f3eae371020 a1=2 a2=0 a3=3 items=0 ppid=811 pid=970 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="cleanup" exe="/usr/libexec/postfix/cleanup" subj=system_u:system_r:postfix_cleanup_t:s0 key=(null)
Jun 6 11:12:20 mainbox postfix/cleanup[970]: fatal: open lock file pid/unix.cleanup: cannot open file: Permission denied
Jun 6 11:12:21 mainbox postfix/master[811]: warning: process /usr/libexec/postfix/cleanup pid 970 exit status 1
Jun 6 11:12:21 mainbox postfix/master[811]: warning: /usr/libexec/postfix/cleanup: bad command startup -- throttling
Я использовал a2a, чтобы попытаться исправить это, но получаю предупреждение, что новое правило слишком разрешающее-
grep 'postfix_cleanup_t' /var/log/audit/audit.log | audit2allow -m postfix_cleanup > postfix_cleanup.te
cat postfix_cleanup.te
Производит-
module postfix_cleanup 1.0;
require {
type var_run_t;
type postfix_cleanup_t;
class file { read write };
}
#============= postfix_cleanup_t ==============
#!!!! WARNING: 'var_run_t' is a base type.
allow postfix_cleanup_t var_run_t:file { read write };
... разрешает постфиксный бегать по базовому типу - слишком снисходительно.
Как правильно это исправить?