Subject: bug#36468: Exim fails with permission denied

From: Jonathan Brielmaier <[email-masked]>
Date: Mon, 1 Jul 2019 19:02:19 +0200

Hi,

I try to setup a SMTP server on a Guix system. I just choose exim and
followed the manual and added this part to my config.scm. It's not
production or anything, just to see if it works.

(service exim-service-type
         (exim-configuration
           (config-file (local-file "/etc/exim.conf"))))
(service mail-aliases-service-type
         '(("jonathan" "[email-masked]")))

After reconfiguring exim starts fine with `herd start`. Then I tried to
test if exim works:

root@guixone /home/jonathan# echo "Subject: test" | exim -v
[email-masked]
LOG: MAIN
  Warning: purging the environment.
 Suggested action: use keep_environment.
LOG: MAIN PANIC DIE
  Failed to create spool file
/var/spool/exim//input//1hhzWj-00007i-Mb-D: Permission denied
LOG: PANIC DIE
  Cannot open main log file "/var/spool/exim/log/mainlog": Permission
denied: euid=65534 egid=65534
2019-07-01 18:51:37 1hhzWj-00007i-Mb Failed to create spool file
/var/spool/exim//input//1hhzWj-00007i-Mb-D: Permission denied
2019-07-01 18:51:37 1hhzWj-00007i-Mb Cannot open main log file
"/var/spool/exim/log/mainlog": Permission denied: euid=65534 egid=65534
exim: could not open panic log - aborting: see message(s) above

Maybe it's not intended to work with root, so I changed /etc/passwd:
exim:x...:/var/empty:/gnu/store.../bin/bash

echo "Subject: test" | sudo su exim -c "exim -v [email-masked]"
LOG: MAIN
  Warning: purging the environment.
 Suggested action: use keep_environment.
2019-07-01 18:55:19 Warning: purging the environment.
 Suggested action: use keep_environment.
LOG: MAIN PANIC DIE
  Failed to create spool file
/var/spool/exim//input//1hhzaJ-000084-D9-D: Permission denied

ls -al /var/spool/exim/input/
total 8
drwxr-x--- 2 exim exim 4096 Jul  1 18:58 ./
drwxr-xr-x 4 exim exim 4096 Jul  1 18:58 ../
-rw-r----- 1 exim exim    0 Jun 29 22:49 1hhKHP-0001D3-6P-D
-rw-r----- 1 exim exim    0 Jun 29 22:53 1hhKLb-00005D-RV-D
-rw-r----- 1 exim exim    0 Jun 29 22:53 1hhKLl-00005E-Ut-D
-rw-r----- 1 exim exim    0 Jul  1 17:37 1hhyN4-0002pn-IN-D
-rw-r----- 1 exim exim    0 Jul  1 18:57 1hhzcT-00008t-JD-D
-rw-r----- 1 exim exim    0 Jul  1 18:58 1hhzdp-0000A9-Oi-D

Do I miss some point here? Do I need to set something in the exim.conf?
I tried to use the exim.conf from openSUSE, with the same effect.

@Carlo: I CCed you, because you have written the original patch to add
exim to Guix :)

~Jonathan