Sendmail Message Sink

Mail Sink | Mail Tarpit

Configuration for Sendmail to accept and discard all e-mail sent to it. Not for production use, nor for any host accessible from the Internet. These notes based largely on the message sink documentation in Sendmail Performance Tuning.

Mail Sink

  1. Ensure that the aliases file has a nobody alias as follows. Warning: some systems still use the legacy /etc/aliases path by default. Check sendmail.cf for the actual path on your system.
  2. # grep nobody /etc/mail/aliases
    nobody: /dev/null

    Then run newaliases to rebuild the aliases data, and confirm mail is discarded:

    $ sudo sendmail -bv nobody
    /dev/null... deliverable: mailer *file*, user /dev/null

  3. Setup the following mailertable file and rebuild the hashed databases. This points all messages to the nobody user. Use a tab, not a space after the period and before local.
  4. . local:nobody

  5. Configure sendmail using sink.mc.
  6. Be sure to review the OSTYPE and confDF_BUFFER_SIZE settings. Build sink.cf, usually via something like the following command.

    # m4 /usr/share/sendmail/m4/cf.m4 sink.mc > sink.cf

    On RedHat-based systems, the sendmail-cf package will need to be installed to obtain the cf.m4 file.

  7. Start sendmail with the custom sink.cf configuration file.
  8. Kill off any running sendmail processes on the system.

    # /usr/sbin/sendmail -C/etc/mail/sink.cf -q1h -bd

    On RedHat Linux systems, rename the sink.cf to sendmail.cf, then restart the Sendmail service.

Be sure to remove the discard configuration before using the host anywhere else.

Mail Tarpit

To save all messages, follow the above instructions, except disable the nobody entry in the aliases file. Confirm e-mail sent to nobody will be delivered locally:

$ sudo sendmail -bv nobody
nobody... deliverable: mailer local, user nobody

The nobody mail spool file should be rotated to prevent the file from filling the disk. On systems with logrotate, setup a /etc/logrotate.d/nobody-mailbox rotate configuration:

/var/mail/nobody {
daily
rotate 14
missingok
notifempty
}