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

Send all mail to /dev/null #64

Open
micolous opened this issue Aug 5, 2019 · 3 comments
Open

Send all mail to /dev/null #64

micolous opened this issue Aug 5, 2019 · 3 comments

Comments

@micolous
Copy link

micolous commented Aug 5, 2019

Implemented as a protocol handler (like smtp), this would take a configuration option like

anything delete

When operating in this mode, nullmailer would accept mail and always report success, but drop all mail it received on the floor (ie: send to /dev/null).

This would be useful for systems that demand an MTA be installed, but are read-only or the system administrator deliberately wants all mail to be discarded.

Making it an internal option would remove the need to set up a symlink for it, and avoid the need to exec another process.

Alternatives

  • One can misuse /bin/true as a protocol handler with:

    ln -s /bin/true /usr/lib/nullmailer/
    echo "localhost true" > /etc/nullmailer/remotes
  • Debian formerly had a lsb-invalid-mta package, this is no longer present.

@benbro
Copy link

benbro commented Jun 16, 2023

@micolous did you find a solution for dropping all emails?
What happens by default when you don't change any settings and a service tries to send a mail?

@micolous
Copy link
Author

micolous commented Jun 16, 2023

@benbro It's been a long time since I've looked at this, but from memory this package has no "default configuration", because you'd normally point this at a "real" mail server.

I was running Debian on a Raspberry Pi, and many packages demanded an MTA be installed. However, I was trying to run the system read only (to preserve the life of the SD card), offline, and generally cut down on any unnecessary background tasks (eg: writing to a mail queue in tmpfs that I'd never read).

The "null" in nullmailer lead me to believe that this might just drop all the mail out-of-the-box, but in fact "null" was referring to the fact it has no local mail queue and immediately forwards messages to some smarthost (ie: external SMTP server).

However, on further investigation, I found nullmailer's "protocol handlers" are just binaries in /usr/lib/nullmailer/ which accept a message and return an exit code, so I ended up using /bin/true as documented above. I don't think that the name localhost actually mattered -- nullmailer passes that as a command-line argument to true (which does nothing with it).

That work-around isn't perfect (for the reasons I opened this issue for), but nullmailer was still a significant improvement over running a fully-fledged MTA. :)

@benbro
Copy link

benbro commented Jun 16, 2023

Thanks, I'll use that. I don't understand why debain removed lsb-invalid-mta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants