October 3, 2021 8:18 PM, "Constantine A. Murenin" <muren...@gmail.com> wrote:

> Hello misc@OpenSMTPD,
> 

Hello,


> Not too sure if https://github.com/OpenSMTPD/OpenSMTPD/issues/1145 is
> a place to file this or not, or whether mailing lists are preferred.
> 

Mailing list is preferred :-)


> I'm looking into https://github.com/termux/termux-packages/issues/7633
> -- adding any mail spool package into single-user Termux on unrooted
> Android.
> 
> I'm curious on your thoughts of what would it take to get OpenSMTPD
> working on Android without root privilidges, in single-user mode,
> entirely for the purposes of doing mail spooling, without acting as an
> SMTP server for the outside world at all, and without delivering local
> mail at all, either. (Smarthost functionality not required -- in
> fact, it's expressly required that it works without having to
> configure anything as a user, other than the `From:` and `To:` fields
> in a mail client like `mutt`.)
> 

It would take some work but it is doable.

OpenSMTPD needs root privileges to:

- bootstrap and drop privileges of child processes
- bind port 25
- privilege separate the daemon from the queue
- fork MDA processes for the recipient users with their privileges
- authenticate users
- access ~/.forward files

If these are all things you can sacrifice, then it's within technical reach,
very likely two or three days of work at most.


> I imagine the install scripts would have to be redone, and some
> priviledge separation taken care of. Would any changes to make
> something like this work be welcome back upstream to OpenSMTPD, or
> should they all be done as local patches just within the termux pkg
> system?
> 

I dunno if upstream would take these changes, can't speak for OpenBSD,
but it's probably a matter of how invasive the diff is.


> Is there any easy way to get just the mail spooling out of OpenSMTPD,
> without the server and the local delivery bits? E.g., just the `mta`
> subsystem for `schedule remote transfers`, without `smtp` and without
> `mda` subsystems? I've looked into `sendmail(8)` and `smtpd(8)`
> manual pages, but nothing stood out, other than the `-P` option that
> describes pausing one of the 3 subsystems mentioned above.
> 

It is the same process that handles smtp, mta and mda.

If you only configure your OpenSMTPD with relay actions and that you
do not set listeners, you will have an enqueue + mta only daemon.


> Would it make sense to have an `mta`-only version of OpenSMTPD on
> OpenSMTPD's side, for example?
> 

See above :-)


> Is the `mta` subsystem the only thing that's required to accept mail
> locally from mutt, and perform mail spooling, MX lookup, and delivery
> attempts to remote hosts, both directly and maybe also through a
> smarthost if desired? Can the other two subsystems be ripped out
> easily and/or at all?
> 

Mail enters the system through the smtp engine, no matter what, but
this smtp engine is not necessarily tied to the network.

if you only have:

    listen on socket
    
    action foobar relay
    match from socket for any action foobar

The MDA subsystem will be idle, the SMTP subsystem will accept mail
enqueued from mutt and route them through the mta subsystem.


> Is there any other package one could recommend for this task instead?
> It seems like the `msmtp` package is often a suggestion, but it
> doesn't seem to do any spooling, doesn't seem to be capable of MX
> lookup, and requires manual smarthost configuration for each
> installation.
> 

Nope, no alternative suggestion if you want spooling.


> Cheers,
> Constantine.SU.

Cheers,

Reply via email to