CentOS 7のdovecotとpostfixに対するACL / MAC権限

CentOS 7のdovecotとpostfixに対するACL / MAC権限

使っていますこのチュートリアルはWebサーバーをPostfix設定するためのものです。DovecotCentOS 7。ただし、Dovecotを使用してテスト電子メールを送信しようとすると、sudo echo "TEST" | mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillogDovecotに電子メールを保存するために使用されるディレクトリを作成する権限がないというエラーメッセージが表示されます。権限を設定しDovecotPostfix作業するにはどうすればよいですかCentOS 7

私はここで初めてですlinuxadduser、、、chmodおよびその他のコマンドchownについては知っていますがoctal permissions、この特定の要件にどのように適用されるのかわかりません。

以下は、エラーメッセージの最も関連性の高い部分です。

Error: user import: Initialization failed: Namespace '':  
mkdir(/home/import/Maildir) failed:  
Permission denied (euid=1001(import) egid=1001(import)  
missing +w perm: /home/import, UNIX perms appear ok (ACL/MAC wrong?))

完全なエラーメッセージは次のとおりです。

Dec 30 19:03:42 mydomain postfix/pickup[8093]: A22E78221C13: uid=1000 from=<anotherusername>
Dec 30 19:03:42 mydomain postfix/cleanup[8121]: A22E78221C13: message-id=<[email protected]>
Dec 30 19:03:42 mydomain postfix/qmgr[8094]: A22E78221C13: from=<[email protected]>, size=463, nrcpt=1 (queue active)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 19:03:42 mydomain postfix/local[8123]: A22E78221C13: to=<[email protected]>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.06/0.02/0/0.07, dsn=4.3.0, status=deferred (temporary failure)

編集する:

その後、実行してsudo chown -R newusername:newusername /home/newusername再度繰り返しsudo echo "TEST" | sudo mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillogますが、まだ次のエラーが発生します。

Dec 30 20:42:29 mydomain postfix/qmgr[8094]: E0DF28221C14: from=<[email protected]>, size=463, nrcpt=1 (queue active)
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:42:29 mydomain postfix/local[8531]: E0DF28221C14: to=<[email protected]>, orig_to=<newusername@localhost>, relay=local, delay=1101, delays=1101/0.02/0/0.06, dsn=4.3.0, status=deferred (temporary failure)
Dec 30 20:45:40 mydomain postfix/pickup[8529]: CF3CB80B33C4: uid=0 from=<root>
Dec 30 20:45:40 mydomain postfix/cleanup[8551]: CF3CB80B33C4: message-id=<[email protected]>
Dec 30 20:45:40 mydomain postfix/qmgr[8094]: CF3CB80B33C4: from=<[email protected]>, size=455, nrcpt=1 (queue active)
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:45:40 mydomain postfix/local[8553]: CF3CB80B33C4: to=<[email protected]>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.08/0.02/0/0.05, dsn=4.3.0, status=deferred (temporary failure)

答え:

この問題は SELinux が原因で発生します。私はsudo nano /etc/sysconfig/selinuxthenを設定してこの問題を解決しましたSELINUX=disabled。これは開発中に許可されます。より完全な解決策は、運用に入る前にpostfixとdovecotを実行できるようにSELinuxルールを設定することです。

注:700人がSELinuxのステータスを確認するように提案し、正しい答えとしてマークしました。

ベストアンサー1

コアはここにあります:failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755

Dovecotはnewusername:newusernameに書き込もうとします/home/newusername/{whatever your maildir is}が、そのディレクトリはユーザー0:0(root)によって所有されています。特権モードは755なので、所有者のみが+w特権を持ちます。

また、SELinuxを使用している場合は、ACLがdovecotがmaildirに書き込むことを許可していることを確認してください。

おすすめ記事