我已经安装在CentOS 7.1上。 在过去,我经常只是禁用了SELinux,但是现在我想要一个带SELinux的服务器。 无论如何,我有邮件存储在/ home / USER / Maildir,由于我不明白的原因,我得到以下错误:
Jul 25 22:32:03 server dovecot: imap(dean): Error: open(/home/dean/Maildir/dovecot.index.log) failed: Permission denied (euid=1000(dean) egid=1000(dean) missing +r perm: /home/dean/Maildir/dovecot.index.log stat(/home/dean/Maildir/dovecot.index.log) failed: Permission denied) Jul 25 22:32:03 server dovecot: imap(dean): Error: file_dotlock_create(/home/dean/Maildir/dovecot-uidlist) failed: Permission denied (euid=1000(dean) egid=1000(dean) missing +w perm: /home/dean/Maildir, UNIX perms appear ok (ACL/MAC wrong?))
我使用以下方法检查了SELinux:
grep -i AVC /var/log/audit/audit.log
并发现:
avc: denied { read write } for pid=13443 comm="imap" name="dovecot-uidlist" dev="dm-2" ino=1051352 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437859923.579:147270): avc: denied { read } for pid=13443 comm="imap" name="dovecot-uidlist" dev="dm-2" ino=1051352 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437860132.705:147592): avc: denied { read append } for pid=13630 comm="imap" name="dovecot.index.log" dev="dm-2" ino=1051357 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437860132.705:147593): avc: denied { read } for pid=13630 comm="imap" name="dovecot.index.log" dev="dm-2" ino=1051357 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437860132.706:147594): avc: denied { read } for pid=13630 comm="imap" name="dovecot.index.log" dev="dm-2" ino=1051357 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437860132.706:147595): avc: denied { getattr } for pid=13630 comm="imap" path="/home/dean/Maildir/dovecot.index.log" dev="dm-2" ino=1051357 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437860132.707:147596): avc: denied { write } for pid=13630 comm="imap" name="Maildir" dev="dm-2" ino=1048660 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=dir type=AVC msg=audit(1437860132.707:147597): avc: denied { write } for pid=13630 comm="imap" name="Maildir" dev="dm-2" ino=1048660 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=dir type=AVC msg=audit(1437860132.707:147598): avc: denied { read write } for pid=13630 comm="imap" name="dovecot-uidlist" dev="dm-2" ino=1051352 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file type=AVC msg=audit(1437860132.707:147599): avc: denied { read } for pid=13630 comm="imap" name="dovecot-uidlist" dev="dm-2" ino=1051352 scontext=system_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:fusefs_t:s0 tclass=file
我真的不知道如何进行sorting。 我确实希望拥有SELinux,但是我还没有find解决scheme。 有人可以帮忙吗?
首先要指出的是,解决scheme不是禁用SELinux,而是使用它。
有一些工具可以用来确定你需要做的事情,好消息是在CentOS 7.1中,与早期版本相比,它们有很大的改进。
首先在您收集的AVC消息上运行audit2why
audit2why <FileContainingMessages
如果事情顺利,它会为您提供被拒绝的消息列表,以及您需要做什么来解决它们。
如果这不能给你一个直接的答案,它可能会指向你audit2allow 。
在你的具体情况下,我相当确定audir2why会为你提供一个合适的答案。