Hello Hugo,
On 2021-02-06 11:13 p.m., Hugo Villeneuve wrote:
Source: msmtp
Version: 1.8.3
Severity: normal
Dear Maintainer,
when specifying a custom aliases file in /etc/msmtprc configuration file like
this:
aliases /etc/aliases.msmtp
msmtp returns the following error:
$> echo -e "foo" | msmtp -t postmaster
msmtp: /etc/aliases.msmtp: Permission denied
Here are the permissions of the file:
$> ls -al /etc/aliases.msmtp
-rw-r--r-- 1 root root 75 Feb 6 21:44 /etc/aliases.msmtp
That is not a common configuration but a valid one nevertheless.
Here is the dmesg output that I observed that seems to indicate it is a problem
with AppArmor (which I know nothing about):
[1051574.267096] audit: type=1400 audit(1612667641.178:68): apparmor="DENIED" operation="open" profile="/usr/bin/msmtp"
name="/etc/aliases.msmtp" pid=17563 comm="sendmail" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Indeed, the default Apparmor profile only allows reading a handful of
files. You have several options available to make it work:
1) move the aliases file to /etc/aliases
2) add a custom rule to the local override file
3) disable msmtp's Apparmor profile
For instructions on how to do 2 and 3, please refer to msmtp's
NEWS.Debian.gz.
Regards,
Simon