Bug#982162: msmtp: cannot read custom aliases file (Permission denied)

2021-02-17 Thread Simon Deziel

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



Bug#982162: msmtp: cannot read custom aliases file (Permission denied)

2021-02-06 Thread Hugo Villeneuve
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

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


-- System Information:
Debian Release: 10.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-9-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled