local mail submission sendmail fails when loopback is down

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

local mail submission sendmail fails when loopback is down

Daniel Armengod
Hello all,

TL;DR: `sendmail <address>` fails with `sendmail: fatal: could not find
any active network interfaces` if loopback interface is not up. Is this
expected behaviour?

Longer:

I know applications can expect the loopback interface to be available.
However, strictly speaking, sendmail when invoked for local mail
submission shouldn't attempt to access the network, all it has to do is
drop the file into the maildrop directory. It shouldn't have open any
kind of network socket, and indeed it does work even with postfix daemon
stopped.

The background for this werid question, by the way, is that I was poking
about an application I have, and I wanted to see what would happen if I
ran it without internet access. The expected outcome was that it'd
gracefully fail and send me a nice e-mail with a notification - which
would be delivered whenever the site got internet access back. So I ran
it with

unshare --net myapp

And got this outcome instead. Thoughts?
Reply | Threaded
Open this post in threaded view
|

Re: local mail submission sendmail fails when loopback is down

Viktor Dukhovni


> On Jun 8, 2018, at 6:47 AM, Daniel Armengod <[hidden email]> wrote:
>
> TL;DR: `sendmail <address>` fails with `sendmail: fatal: could not find
> any active network interfaces` if loopback interface is not up. Is this
> expected behaviour?

Yes, expected.  The failure is in common initialization code that is
not sendmail command specific.  The "mynetworks", "myhostname",
"mydomain" and "myorigin" parameters are initialized in the same way
across all of Postfix, and internally a list of "own" network
addresses is also computed.  This code expects to find at least one
interface even on systems not connected to a network.

--
        Viktor.