spamassassin: use virtual user home directories under /var/lib/spamassassin to avoid permission problems

When spamd isn't running as 'root', it cannot access the usual ~/.spamassassin
path where user-specific files normally reside. Instead, we use the path
/var/lib/spamassassin-<user> to store those home directories.
This commit is contained in:
Peter Simons 2012-09-28 00:06:52 +02:00
parent bcb8038726
commit 6f052ee62e
2 changed files with 13 additions and 6 deletions

View File

@ -126,6 +126,7 @@ in
clamav = 51;
fprot = 52;
wwwrun = 54;
spamd = 55;
networkmanager = 56;
# When adding a gid, make sure it doesn't match an existing uid.

View File

@ -38,17 +38,23 @@ in
# Allow users to run 'spamc'.
environment.systemPackages = [ pkgs.spamassassin ];
users.extraUsers = singleton
{ name = "spamd";
description = "Spam Assassin Daemon";
uid = config.ids.uids.spamd;
};
users.extraUsers = singleton {
name = "spamd";
description = "Spam Assassin Daemon";
uid = config.ids.uids.spamd;
group = "spamd";
};
users.extraGroups = singleton {
name = "spamd";
gid = config.ids.gids.spamd;
};
jobs.spamd = {
description = "Spam Assassin Server";
startOn = "started networking and filesystem";
environment.TZ = config.time.timeZone;
exec = "${pkgs.spamassassin}/bin/spamd ${optionalString cfg.debug "-D"} --username=spamd --pidfile=/var/run/spamd.pid";
exec = "${pkgs.spamassassin}/bin/spamd ${optionalString cfg.debug "-D"} --username=spamd --groupname=spamd --nouser-config --virtual-config-dir=/var/lib/spamassassin/user-%u --allow-tell --pidfile=/var/run/spamd.pid";
};
};