Package: msmtp
Version: 1.8.11-2
Followup-For: Bug #942457
X-Debbugs-Cc: deb...@microjoe.org

Hello,

Tue, 02 Jun 2020 19:02:19 +0200, Jean-Phillipe wrote:
> My config file for msmtp is in a directory synchronized with nextcloud
> and I have a symlink towards ~/.config/msmtp/config. It is pretty
> convenient for my use.

I had the exact same issue recently, and it took me quite some time to
investigate. However I modified the profile to make it work with
symlinks for `~/**/.config/msmtp/*` files.

The problem was not occurring when symlinking to `~/**/*muttrc`, because
this rule is flexible enough to work with symlinks inside of the home
directory.

Please find attached the .patch that needs to be applied to the source
package in order to fix this issue. It is not perfect, but as long as
the `.config/msmtp/*` structure is respected in your dotfiles (git,
Nextcloud, …) then it should work.

Best regards,

Romain.
>From 013c9c7e04fb986a8cb8dc43cd3c8ff5323e1132 Mon Sep 17 00:00:00 2001
From: Romain Porte <micro...@microjoe.org>
Date: Tue, 22 Dec 2020 16:31:11 +0100
Subject: [PATCH] debian: apparmor: allow symlinked ~/.config/msmtp/* files

The current rule is only working for regular files, but when symlinks
are used, for example for the ~/.config/msmtp directory, then msmtp is
unable to read the files.

This issue does not happen with ~/.msmtprc, because the rules are
already flexible enough to allow for ~/**/*msmtprc files, which works
with symlinks.

With this patch, we apply the same technique in order to allow access
for symlinked configuration files using the XDG_CONFIG_HOME path.
---
 debian/apparmor/usr.bin.msmtp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/apparmor/usr.bin.msmtp b/debian/apparmor/usr.bin.msmtp
index 052bbd0..f07cc78 100644
--- a/debian/apparmor/usr.bin.msmtp
+++ b/debian/apparmor/usr.bin.msmtp
@@ -23,7 +23,7 @@ profile msmtp /usr/bin/msmtp flags=(attach_disconnected) {
   /var/log/msmtp            wk,
 
   owner @{HOME}/**/*msmtprc        r,
-  owner @{HOME}/.config/msmtp/*    r,
+  owner @{HOME}/**/.config/msmtp/* r,
   owner @{HOME}/.cache/msmtp/*     r,
   owner @{HOME}/.cache/msmtp/*.log wk,
 
-- 
2.29.2

Reply via email to