2024-08-29 msmtp and app armor

I tried to send an email from Emacs and it didn't work. The error was:

msmtp: account default not found: no configuration file available

I was able to reproduce the problem with the following `hello.txt` file:

From: Alex <alex@alexschroeder.ch>
To: Alex <alex@alexschroeder.ch>
Subject: Test

This is the test.

And then feeding that to `msmtp` with debugging enabled (`-d`) and reading recipients from the mail (`-t`):

msmtp -d -t < hello.txt

Now I had more info, however:

ignoring system configuration file /etc/msmtprc: No such file or directory
ignoring user configuration file /home/alex/.config/msmtp/config: Permission denied
falling back to default account
msmtp: account default not found: no configuration file available

I checked permissions, and it was 0600 for the config file. Online, I found a reference to AppArmor. Taking a peek at `/etc/apparmor.d/usr.bin.msmtp` I didn't see anything surprising. But then I grew suspicious… I had in fact moved `~/.config/msmtp` to `~/src/home/.config/msmtp` (which is a Git repository) and replaced that with a symbolic link. AppArmor didn't like this and decided that `msmtp` was not allowed to read that other file. Moving the directory back solved this problem.

I guess I'll be making occasional copies of this file into the Git repository. 😒

​#Administration ​#AppArmor

msmtp and AppArmor: investigating a curious access issue

How to teach AppArmor about toplevel symlinks

I ended up initializing a new git repo inside `~/.config`.