LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-24-2009, 10:26 AM   #1
isomtech
LQ Newbie
 
Registered: Mar 2005
Posts: 13

Rep: Reputation: 2
[SOLVED] Disable NDR on Postfix Revisited


Greetings all!
I have a conundrum that I'm hoping someone can help me with.
As you can tell by the subject, I'm looking to disable NDR messages from being sent on my Postfix server. I've read dozens of posts of other people trying to ask the same question, and there's a pattern I've noticed: Every post is answered with a lecture on why you shouldn't do that, but none have said "no, that can't be done". I don't want a lesson on how mail servers are supposed to work. I fully understand the ramifications of what I wish to accomplish. I just want to know if it is possible to disable this behavior, and if so, a hint or two on how I might accomplish this. I did find one post making reference to notify_classes, but after reading the documentation I don't think this is what I am looking for.

In case you're wondering if disabling NDR on this server will destroy the world as we know it, know this: This server does not serve as a destination for anyone's mail. This server is a MX backup for a primary system that goes down very infrequently. The primary has a rather nice spam filter that rejects mail it knows to be spam during the SMTP session. Putting the same spam filter on the backup MX is not an option I have available to me. I have added several sender restrictions to Postfix to reduce the number of illegitimate messages that it stores and forwards.

I want to further reduce the unnecessary SMTP traffic by eliminating the NDR messages for the messages that my backup does accept, and the primary does not.

I hope this doesn't come off too crass, but I have spent much of my time lately reading through post after post on dozens of forums and mail lists. They all lecture on why you shouldn't do this, with no lecture making a good case for my particular situation. I just hope to get a simple answer - can it be done and how might one suggest I do it?

Thank you!
Dave

Last edited by isomtech; 12-17-2009 at 10:06 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-25-2009, 12:29 PM   #2
roybal
LQ Newbie
 
Registered: Sep 2009
Posts: 8
Blog Entries: 8

Rep: Reputation: 0
Since nobody has responded....
I don't know how to do it either, but I have a few ideas. The qmgr actually tracks undeliverable mail and sends the NDR. The first time a message is tried and fails, it goes to the deferred queue. When it reaches max_tries, it goes to the bounce queue. By default these are:
/var/spool/postfix/bounce/* non-delivery records
/var/spool/postfix/defer/* non-delivery records
I would (attempt to) remove the bounce inode and replace it with a symlink to /dev/nul
Mail going to the bounce queue would then silently pass out of existence.

Disclaimer: I have never actually done this...
/bithead
 
Old 11-25-2009, 12:48 PM   #3
isomtech
LQ Newbie
 
Registered: Mar 2005
Posts: 13

Original Poster
Rep: Reputation: 2
A very interesting idea, for sure. The only problem I foresee with that is, Postfix will try to create a file in that directory rather than send something to that file. I don't know what will happen in that instance. I would think that I would get an error stating that is a file and not a directory during the file creation attempt. I may have to do some tests to see how that would behave.
 
Old 11-25-2009, 12:56 PM   #4
isomtech
LQ Newbie
 
Registered: Mar 2005
Posts: 13

Original Poster
Rep: Reputation: 2
Yeah, it has issues. I did a quick and dirty test so see if it would throw errors.
Code:
$ ln -s /dev/null my
$ touch my/nostril
touch: cannot touch `my/nostril': Not a directory
Now that doesn't mean that it won't prevent the bounce messages from being sent. I'll have to play with that concept a bit. Thanks for the idea!
I still have a hard time accepting that there is no configuration directive to accomplish this. With as granular as the configuration options are, there has to be something to just switch that off. I've read through the postconf man page and I can't find anything though...
 
Old 11-30-2009, 01:30 PM   #5
isomtech
LQ Newbie
 
Registered: Mar 2005
Posts: 13

Original Poster
Rep: Reputation: 2
Anyone else have a definitive answer on this? My concern is simply this:
Code:
84 messages sent
2 messages expired and returned to sender
17 messages removed from queue
I'm sending out an awful lot of NDRs. I don't want to contribute to the worthless bandwidth hog that is spam. In one day, I've sent out 84 NDR messages that probably bounced and just wasted CPU cycles and bandwidth. This is down considerably since I added RBL and other sender restrictions to the Postfix config. I would like to reduce this further by not sending NDRs, since the only time this would actually have a negative impact is when my primary is down, and only if my primary were down for longer than the queue lifetime.
 
Old 12-17-2009, 10:15 AM   #6
isomtech
LQ Newbie
 
Registered: Mar 2005
Posts: 13

Original Poster
Rep: Reputation: 2
I finally did it!
There may be a more refined way to accomplish this, but this was the best solution I could come up with. I modified the master.cf file and changed one line.
master.cf
Code:
bounce    unix  -       -       n       -       0       bounce
should be changed to:

master.cf
Code:
bounce    unix  -       -       n       -       0       discard
Now it's not without it's drawbacks. In the logs I have identified an error that get's thrown whenever this runs the discard handler instead of the bounce handler. The errors I get look like this:
Code:
Dec 15 16:07:40 websrv1 postfix/discard[15220]: warning: unexpected attribute nrequest from bounce socket (expecting: flags)
Dec 15 16:07:40 websrv1 postfix/discard[15220]: warning: deliver_request_get: error receiving common attributes
however, the behavior is what I have been looking for. Messages get queued and stored and deferred as they should, but bounced messages just disappear.

I'll report back if I discover some other ramifications, but so far it appears to be solid. This morning was the 1st time I've seen the logwatch report show the same number of messages delivered and removed from queue. (usually the delivered messages were on the order of 20x larger than the removed from queue figure)
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix disable logging? lennard Linux - Software 3 12-08-2010 11:00 AM
Postfix MTA NDR Message keep attachment? shawnedwards Linux - Server 1 06-09-2009 10:20 AM
How to disable NDR in postfix inaki Linux - Server 1 01-28-2008 04:59 PM
disable relay in postfix inaki Linux - Server 1 12-05-2007 02:10 PM
Disable NDR on Postfix ALInux Linux - Server 1 11-20-2007 11:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration