Re: sendmail without root privs cannot bind.

From: Francesco Toscan <f.toscan_at_hotmail.it>
Date: Thu, 23 Dec 2021 09:56:39 UTC
Dewayne Geraghty <dewayne@heuristicsystems.com.au> wrote:

> Today I decided that it was time to move sendmail from root to an
> unprivileged user.

...

> Does anyone have sendmail running without root?  My magical
> rubber-chicken doesn't seem to be working...

...
> 1. Added define(`confTRUSTED_USER', `smmsp')dnl tos endmail.mc

Last time I had a "working" non-root sendmail setup (well...kinda 
working) I relied on RunAsUser.
Since there are many moving parts, I had to relax permissions 
on queue directories, drop .forward files, forget about :include .

It was very tricky and I didn't really liked it.  Sendmail textbook
discourages this practice. If I recall correctly, RunAsUser can't 
make sendmail run as $user in daemon mode. You have to 
run it so by hand.
Btw, on FreeBSD sendmail is compiled with support to setreuid(2) and
the program drops privileges as soon as it can:  mucking with 
franken-sendmail I felt I was actually lowering the overall security.

> 3. added uid:25:tcp:25,uid:25:tcp:465,uid:25:tcp:587 to
> security.mac.portacl.rules

That should allow binding, but raise debuglevel, at lease -d2.9 and
investigate opened file descriptors.
Maybe some sendmail guru may chime in?

> Sendmail has been running within a jailed environment as root for a few
> years.  The host is FreeBSD 12.2Stable from June 2021.

That's how I ended. I used to run several "specialized" sendmail 
instances in different jails, exposing the minimum set of features 
needed for the task (ie: receive mail; content filtering; local delivery; send
mail outside).


Good luck,
f