Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailwrapper(8): do not use _PATH_DEFAULTMTA if mailer.conf cannot be opened #969

Closed
wants to merge 1 commit into from

Conversation

llfw
Copy link
Contributor

@llfw llfw commented Dec 30, 2023

Previously, mailwrapper(8) would default to invoking _PATH_DEFAULTMTA (i.e., dma) if mailer.conf couldn't be opened for any reason, including transient errors like ENFILE. This behaviour is undesirable, because if the administrator has configured a different MTA in mailer.conf, they almost certainly don't want mailwrapper to unpredictably fall back to the compiled-in default; and in any case, the default MTA is probably not running, meaning the mail may be queued and then never delivered, which is worse than not accepting it to begin with.

Change this behaviour depending on why mailer.conf can't be opened:

  • If it doesn't exist, keep the existing behaviour of falling back to the default MTA, on the assumption that this is a reasonable default if mailer.conf hasn't been configured at all.

  • If it cannot be opened for any other reason, do not invoke an MTA and instead return an error to the caller.

PR: 25218


note that there was on discussion on the PR about whether this change is desirable or not, and in particular the original submitter changed their mind about it. i think this is worth reconsidering because the current behaviour does not seem very good: the world has changed a lot in the last 20 years, and nowadays any remotely important system will almost certainly be monitored by an external NMS, so the idea of depending on this as a "last gasp" attempt to send a notification mail doesn't seem to justify the downsides.

Previously, mailwrapper(8) would default to invoking _PATH_DEFAULTMTA
(i.e., dma) if mailer.conf couldn't be opened for any reason, including
transient errors like ENFILE.  This behaviour is undesirable, because if
the administrator has configured a different MTA in mailer.conf, they
almost certainly don't want mailwrapper to unpredictably fall back to
the compiled-in default; and in any case, the default MTA is probably
not running, meaning the mail may be queued and then never delivered,
which is worse than not accepting it to begin with.

Change this behaviour depending on why mailer.conf can't be opened:

- If it doesn't exist, keep the existing behaviour of falling back to
  the default MTA, on the assumption that this is a reasonable default
  if mailer.conf hasn't been configured at all.

- If it cannot be opened for any other reason, do not invoke an MTA and
  instead return an error to the caller.

PR:	25218
@igalic
Copy link
Contributor

igalic commented Jan 16, 2024

@bsdimp closed the bug with,

Both Peter and Peter don't like it. We've moved on to DMA. And the inability to open mailer.conf on today's systems is rare. Closing this to reduce the clutter.

@llfw
Copy link
Contributor Author

llfw commented Jan 16, 2024

alright. i suppose this can be closed too then if no one wants to merge it, although i still think the default behaviour is wrong (and potentially a security issue, if a very minor one).

@igalic
Copy link
Contributor

igalic commented Jan 16, 2024

can you fix the commit message, please?

ENFILE —> ENOFILE


otherwise: this looks harmless to me, closing in on net positive.

👍🏻 from me

@llfw
Copy link
Contributor Author

llfw commented Jan 16, 2024

i think ENFILE is correct; ENOFILE doesn't seem to be a thing.

@bsdimp
Copy link
Member

bsdimp commented Jan 16, 2024

I hadn't seen this when i closed the bug. I honestly thought nobody still cared and with more resources this problem stopped happening.

I think it may be worth a chat on arch@freebsd.org to see if we can get more input.

@bsdimp bsdimp self-assigned this Jan 29, 2024
@bsdimp
Copy link
Member

bsdimp commented Apr 9, 2024

So I can't land this... I think it needs more discussion somewhere. If I missed that, please add a pointer.

@bsdimp
Copy link
Member

bsdimp commented Apr 19, 2024

There's a discussion in arch@

@bsdimp
Copy link
Member

bsdimp commented Apr 19, 2024

@emaste and @markjdb say this is good too, so I'll land.

freebsd-git pushed a commit that referenced this pull request Apr 19, 2024
Previously, mailwrapper(8) would default to invoking _PATH_DEFAULTMTA
(i.e., dma) if mailer.conf couldn't be opened for any reason, including
transient errors like ENFILE.  This behaviour is undesirable, because if
the administrator has configured a different MTA in mailer.conf, they
almost certainly don't want mailwrapper to unpredictably fall back to
the compiled-in default; and in any case, the default MTA is probably
not running, meaning the mail may be queued and then never delivered,
which is worse than not accepting it to begin with.

Change this behaviour depending on why mailer.conf can't be opened:

- If it doesn't exist, keep the existing behaviour of falling back to
  the default MTA, on the assumption that this is a reasonable default
  if mailer.conf hasn't been configured at all.

- If it cannot be opened for any other reason, do not invoke an MTA and
  instead return an error to the caller.

PR: 25218
Reviewed by: imp, emaste, markj
Pull Request: #969
@bsdimp
Copy link
Member

bsdimp commented Apr 19, 2024

landed

@bsdimp bsdimp closed this Apr 19, 2024
@bsdimp bsdimp added merged and removed ready labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants