4

I am trying to create a blackhole account in Postfix and did the following which seems to be the most commonly employed method of doing this in Postfix:

1) Created a user (I named the user blackhole) with /dev/null as the user's home directory.

useradd blackhole -d /dev/null

2) Made an entry in /etc/postfix/virtual to direct all the emails sent to blackhole@<subdomain.myhostname.com> to blackhole user's mailbox, which by default is /home/<user/Maildir/new :

 /^blackhole@subdomain.myhostname.com$/   blackhole

Then, updated postfix database and reloaded the service with the following commands:

  postmap /etc/postfix/virtual
  /etc/init.d/postfix reload

While this is working as expected, that is, emails sent to blackhole@<subdomain.myhostname.com> vanishes without sending a bounce message to the sender, I see the following in the maillog which gives out the impression that this method is an easy, crude method to create a blackhole account and makes me wonder whether there is a correct and legal way to do this in Postfix.

Jan 17 09:21:20 plmercury01 postfix/local[17760]: DBC8F16197F: to=<blackhole@plmercury01.myhostname.com>, orig_to=<blackhole@plmercury01.myhostname.com>, relay=local, delay=0.19, delays=0.09/0/0/0.1, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /dev/null/Maildir/tmp/1484666479.P17760.plmercury01.myhostname.com: Not a directory)

My question:

1) Is this the legal way to create a blackhole account in Postfix and not a short-cut?

2) Can I ignore what I see the in the maillogs complaining about /dev/null?

Sreeraj
  • 5,062

1 Answers1

4

You don't need to create a 'blackhole' account - just have a transport map entry like :

blackhole@subdomain.myhostname.com   discard:silently
  • Thank you. Unfortunately, I have already made this change. Your suggestion looks very good and neat. I will have to try this during our next maintenance and update here. – Sreeraj Jun 06 '17 at 02:44
  • This isn't very complete, simply putting discard:silently as the entry tries to route it to a user discard:silently@{domain}. – Clint Priest Jan 09 '20 at 21:26
  • http://www.postfix.org/discard.8.html - perhaps drop the 'silently' ? – David Goodwin Jan 10 '20 at 22:49