I know about sudo, but I still wonder about the need for root rights
at all.
Access to the database credentials can be managed through filesystem
permissions.
So the next (and hopefully last) thing where we need root rights
seems to be the creation of domain directories, or even user
directories:
Nov 26 02:55:21 ambassador dovecot: lmtp(20221): Error: user
test@pantsfullofunix.net: Initialization failed: Namespace '':
mkdir(/srv/vmm/6/70000/70000/Maildir) failed: Permission denied
(euid=70000(test%pantsfullofunix.net)
egid=70000(pantsfullofunix.net) missing +w perm: /srv/vmm/6/70000,
dir owned by 0:70000 mode=0750)
I can't seem to find a way to tell lmtp to drop privileges only
after it verified existence of the target directories, and we don't
want to go the pam_session route.
If we can agree that it's best to run as little code as possible as
root, then maybe it would be best to factor out just the domain/user
directory creation to a script and letting vmm invoke that script,
either as setuid or with sudo, while the rest of vmm runs with user
privileges.