TITLE:
Issues with AppArmor
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:Plesk 17.5 Web Pro
Postfix+Dovecot
Ubuntu 16.04
PROBLEM DESCRIPTION:Postfix+Dovecot
Ubuntu 16.04
When using a "normal" plesk setup with Postfix + Dovecot, AppArmor complains about some behavior of Dovecot.
Error messages in /var/log/syslog:
a) Login via IMAP / POP3:
Aug 20 12:59:35 srv kernel: [35761.155025] audit: type=1400 audit(1503226775.515:599): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/imap" pid=19812 comm="imap" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/imap-login"
Aug 20 12:59:35 srv kernel: [35761.155051] audit: type=1400 audit(1503226775.515:600): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/imap-login" pid=19812 comm="imap" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/imap"
Aug 20 12:59:35 srv kernel: [35761.220990] audit: type=1400 audit(1503226775.583:605): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/pop3" pid=19815 comm="pop3" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/pop3-login"
Aug 20 12:59:35 srv kernel: [35761.221012] audit: type=1400 audit(1503226775.583:606): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/pop3-login" pid=19815 comm="pop3" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/pop3"
b) Deleting files from the inbox:
Aug 20 12:46:30 srv kernel: [34975.986403] audit: type=1400 audit(1503225990.347:536): apparmor="ALLOWED" operation="link" profile="/usr/lib/dovecot/imap" name="/var/qmail/mailnames/domain.tld/user/Maildir/.Trash/tmp/1503225990.M282726P15860.srv.domain.tld" pid=15860 comm="imap" requested_mask="l" denied_mask="l" fsuid=30 ouid=30 target="/var/qmail/mailnames/domain.tld/user/Maildir/cur/1503225411.M418561P15574.srv.domain.tld,S=1401,W=1432:2,Sc"
c) Still unknown:
Aug 20 06:57:48 srv kernel: [14054.505556] audit: type=1400 audit(1503205068.868:303): apparmor="ALLOWED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/lib/dovecot/auth" name="run/systemd/journal/dev-log" pid=8858 comm="auth" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
STEPS TO REPRODUCE:Error messages in /var/log/syslog:
a) Login via IMAP / POP3:
Aug 20 12:59:35 srv kernel: [35761.155025] audit: type=1400 audit(1503226775.515:599): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/imap" pid=19812 comm="imap" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/imap-login"
Aug 20 12:59:35 srv kernel: [35761.155051] audit: type=1400 audit(1503226775.515:600): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/imap-login" pid=19812 comm="imap" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/imap"
Aug 20 12:59:35 srv kernel: [35761.220990] audit: type=1400 audit(1503226775.583:605): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/pop3" pid=19815 comm="pop3" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/pop3-login"
Aug 20 12:59:35 srv kernel: [35761.221012] audit: type=1400 audit(1503226775.583:606): apparmor="ALLOWED" operation="file_receive" profile="/usr/lib/dovecot/pop3-login" pid=19815 comm="pop3" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none peer="/usr/lib/dovecot/pop3"
b) Deleting files from the inbox:
Aug 20 12:46:30 srv kernel: [34975.986403] audit: type=1400 audit(1503225990.347:536): apparmor="ALLOWED" operation="link" profile="/usr/lib/dovecot/imap" name="/var/qmail/mailnames/domain.tld/user/Maildir/.Trash/tmp/1503225990.M282726P15860.srv.domain.tld" pid=15860 comm="imap" requested_mask="l" denied_mask="l" fsuid=30 ouid=30 target="/var/qmail/mailnames/domain.tld/user/Maildir/cur/1503225411.M418561P15574.srv.domain.tld,S=1401,W=1432:2,Sc"
c) Still unknown:
Aug 20 06:57:48 srv kernel: [14054.505556] audit: type=1400 audit(1503205068.868:303): apparmor="ALLOWED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/lib/dovecot/auth" name="run/systemd/journal/dev-log" pid=8858 comm="auth" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
For error messages in a): Use a remote e-mail client and connect / log in to the server via IMAP/POP3
and b): Obviously delete a file from the Inbox using IMAP.
ACTUAL RESULT:and b): Obviously delete a file from the Inbox using IMAP.
AppArmor complains about the activities as decribed above.
EXPECTED RESULT:AppArmor does not complain...
ANY ADDITIONAL INFORMATION:Potential steps to solve the issue:
Fix for a):
Potentially related to Bug #1512131 “Apparmor complains about multiple /run/dovecot fil...” : Bugs : apparmor package : Ubuntu
Add the line
network unix stream,
to the files /etc/apparmor.d/local/usr.lib.dovecot.{imap,imap-login,pop3,pop3-login}
Fix for b (delete mail):
change the lines in /etc/apparmor.d/local/user.lib.dovecot.{imap, pop3}
old:
/var/qmail/mailnames/** wrk,
new:
/var/qmail/mailnames/** rwkl,
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:Fix for a):
Potentially related to Bug #1512131 “Apparmor complains about multiple /run/dovecot fil...” : Bugs : apparmor package : Ubuntu
Add the line
network unix stream,
to the files /etc/apparmor.d/local/usr.lib.dovecot.{imap,imap-login,pop3,pop3-login}
Fix for b (delete mail):
change the lines in /etc/apparmor.d/local/user.lib.dovecot.{imap, pop3}
old:
/var/qmail/mailnames/** wrk,
new:
/var/qmail/mailnames/** rwkl,
Help with sorting out