Srdan Dukic | 4 Jul 04:45
Picon

How to backhole mail?

Hi,

For one of my projects I'm setting up a server to test the total
number of SMTP connections that our postfix server can handle. I am
trying to isolate the first part of the smtp server transaction up to
the recipient server receiving the message i.e. the end of the smtp
transaction. Afterwards I would like to discard the message (send it
to /dev/null or something), so that the message doesn't place any
extra strain (cpu cycles, disk i/o) on the system.

How do I set up an Postfix server so that it accepts mail for any
domain, any username and then simply deletes the message (sends it to
/dev/null)?

Than you,
--

-- 
Srđan Đukić

Barney Desmond | 4 Jul 09:08
Picon

Re: How to backhole mail?

2009/7/4 Srdan Dukic <srdan.dukic <at> gmail.com>:

> For one of my projects I'm setting up a server to test the total > number of SMTP connections that our postfix server can handle. I am > trying to isolate the first part of the smtp server transaction up to > the recipient server receiving the message i.e. the end of the smtp > transaction. Afterwards I would like to discard the message (send it > to /dev/null or something), so that the message doesn't place any > extra strain (cpu cycles, disk i/o) on the system. > > How do I set up an Postfix server so that it accepts mail for any > domain, any username and then simply deletes the message (sends it to > /dev/null)?
It sounds like you've already got a working solution, but for what it's worth I've done something similar to this before. Our machines use virtual alias maps to local accounts by default, so I found the easiest solution was to accept all domains and addresses, and map them all through to a local "blackhole" account. In /etc/aliases you can then pass this off to /dev/null. Not as efficient as the transport-based method, but it worked nicely for us. As for the testing itself, Postfix has a couple of tools that you may want to use, smtp-source and smtp-sink.
Noel Jones | 4 Jul 05:48

Re: How to backhole mail?


Srdan Dukic wrote: > Hi, > > For one of my projects I'm setting up a server to test the total > number of SMTP connections that our postfix server can handle. I am > trying to isolate the first part of the smtp server transaction up to > the recipient server receiving the message i.e. the end of the smtp > transaction. Afterwards I would like to discard the message (send it > to /dev/null or something), so that the message doesn't place any > extra strain (cpu cycles, disk i/o) on the system. > > How do I set up an Postfix server so that it accepts mail for any > domain, any username and then simply deletes the message (sends it to > /dev/null)? > > > Than you,
This should work... # main.cf # accept anyuser <at> anydomain relay_domains = static:ALL # throw it away smtpd_end_of_data_restrictions = static:discard # safety net default_transport = discard test before sending it a million messages... -- Noel Jones
(Continue reading)

Srdan Dukic | 4 Jul 07:46
Picon

Re: How to backhole mail?

The test didn't work. I tried sending a message using the sendmail
command, going to my hotmail address, and the logs show that it did in
fact deliver the message to the server:

Jul  4 17:38:24 mailtest postfix/pickup[9254]: 363ABF6913: uid=1000 from=<srdan>
Jul  4 17:38:24 mailtest postfix/cleanup[9258]: 363ABF6913:
message-id=<20090704053824.363ABF6913 <at> mailtest.local>
Jul  4 17:38:24 mailtest postfix/qmgr[9255]: 363ABF6913:
from=<srdan <at> mailtest.local>, size=389, nrcpt=1 (queue active)
Jul  4 17:38:25 mailtest postfix/smtp[9260]: 363ABF6913:
to=<srdan.dukic <at> hotmail.com>, relay=mx1.hotmail.com[65.55.92.168]:25,
delay=45, delays=43/0/0.8/0.46, dsn=2.0.0, status=sent (250
<20090704053824.363ABF6913 <at> mailtest.local> Queued mail for delivery)
Jul  4 17:38:25 mailtest postfix/qmgr[9255]: 363ABF6913: removed

Also, logging in to hotmail I can confirm the message was delivered.

After adding the lines suggested I restarted Postfix using the
'/etc/init.d/postfix restart' command. Are there any other
configuration parameters which could have affected this?

Thank you

2009/7/4 Noel Jones <njones <at> megan.vbhcs.org>:

> > This should work... > > # main.cf > # accept anyuser <at> anydomain > relay_domains = static:ALL > # throw it away > smtpd_end_of_data_restrictions = static:discard > # safety net > default_transport = discard > > test before sending it a million messages... > >  -- Noel Jones >
-- -- Srđan Đukić
(Continue reading)

Noel Jones | 4 Jul 15:56

Re: How to backhole mail?

Srdan Dukic wrote:
> The test didn't work. I tried sending a message using the sendmail
> command, going to my hotmail address, and the logs show that it did in
> fact deliver the message to the server:
> 
> Jul  4 17:38:24 mailtest postfix/pickup[9254]: 363ABF6913: uid=1000 from=<srdan>
> Jul  4 17:38:24 mailtest postfix/cleanup[9258]: 363ABF6913:
> message-id=<20090704053824.363ABF6913 <at> mailtest.local>
> Jul  4 17:38:24 mailtest postfix/qmgr[9255]: 363ABF6913:
> from=<srdan <at> mailtest.local>, size=389, nrcpt=1 (queue active)
> Jul  4 17:38:25 mailtest postfix/smtp[9260]: 363ABF6913:
> to=<srdan.dukic <at> hotmail.com>, relay=mx1.hotmail.com[65.55.92.168]:25,
> delay=45, delays=43/0/0.8/0.46, dsn=2.0.0, status=sent (250
> <20090704053824.363ABF6913 <at> mailtest.local> Queued mail for delivery)
> Jul  4 17:38:25 mailtest postfix/qmgr[9255]: 363ABF6913: removed
> 
> 
> Also, logging in to hotmail I can confirm the message was delivered.
> 
> After adding the lines suggested I restarted Postfix using the
> '/etc/init.d/postfix restart' command. Are there any other
> configuration parameters which could have affected this?

Please don't top-post.

Yes, there are several other configuration parameters that can 
"break" this.  In particular, it's intended to discard mail 
submitted via SMTP, not sendmail(1).

In particular, defaults for relayhost, transport_maps, and all 
other smtpd_*_restrictions are required.

> Jul  4 18:18:57 mailtest postfix/smtpd[9623]: warning: specify one of
> (check_client_access, check_helo_access, check_sender_access,
> check_recipient_access, check_etrn_access) before End-of-data
> restriction "static:discard"

Sorry, it should be
smtpd_end_of_data_restrictions =
   check_client_access static:discard

   -- Noel Jones

(Continue reading)

Sahil Tandon | 4 Jul 08:57

Re: How to backhole mail?


On Sat, 04 Jul 2009, Srdan Dukic wrote: > The test didn't work. I tried sending a message using the sendmail > command, going to my hotmail address, and the logs show that it did in > fact deliver the message to the server:
Submitting via sendmail bypasses smtpd_foo_restrictions, so this is not a good test. -- -- Sahil Tandon <sahil <at> tandon.net>
Srdan Dukic | 4 Jul 08:42
Picon

Re: How to backhole mail?

Hi,

I realised that testing with sendmail wasn't the best idea. After
trying it out with an smtp client (thunderbird) I found that the
server returned the following error:

Jul  4 18:18:57 mailtest postfix/smtpd[9623]: warning: specify one of
(check_client_access, check_helo_access, check_sender_access,
check_recipient_access, check_etrn_access) before End-of-data
restriction "static:discard"
Jul  4 18:18:57 mailtest postfix/smtpd[9623]: 4CDD0F6913: reject:
END-OF-MESSAGE from tecra1.local[192.168.10.130]: 451 4.3.5 Server
configuration error; from=<srdan.dukic <at> gmail.com>
to=<srdan.dukic <at> hotmail.com> proto=ESMTP helo=<[192.168.10.130]>

So I guess you can't use the 'static:discard' option with the
'smtpd_end_of_data_restrictions' parameter. I did however manage to
find a solution here[1]. Although this one is more complicated (it
involves creating a 'null' service).

Thank you for your help

[1] http://www.wiredfool.com/2002/06/11/how-to-blackhole-email-server/

2009/7/4 Srdan Dukic <srdan.dukic <at> gmail.com>:

> The test didn't work. I tried sending a message using the sendmail > command, going to my hotmail address, and the logs show that it did in > fact deliver the message to the server: > > Jul  4 17:38:24 mailtest postfix/pickup[9254]: 363ABF6913: uid=1000 from=<srdan> > Jul  4 17:38:24 mailtest postfix/cleanup[9258]: 363ABF6913: > message-id=<20090704053824.363ABF6913 <at> mailtest.local> > Jul  4 17:38:24 mailtest postfix/qmgr[9255]: 363ABF6913: > from=<srdan <at> mailtest.local>, size=389, nrcpt=1 (queue active) > Jul  4 17:38:25 mailtest postfix/smtp[9260]: 363ABF6913: > to=<srdan.dukic <at> hotmail.com>, relay=mx1.hotmail.com[65.55.92.168]:25, > delay=45, delays=43/0/0.8/0.46, dsn=2.0.0, status=sent (250 > <20090704053824.363ABF6913 <at> mailtest.local> Queued mail for delivery) > Jul  4 17:38:25 mailtest postfix/qmgr[9255]: 363ABF6913: removed > > > Also, logging in to hotmail I can confirm the message was delivered. > > After adding the lines suggested I restarted Postfix using the > '/etc/init.d/postfix restart' command. Are there any other > configuration parameters which could have affected this? > > Thank you > > 2009/7/4 Noel Jones <njones <at> megan.vbhcs.org>: >> >> This should work... >> >> # main.cf >> # accept anyuser <at> anydomain >> relay_domains = static:ALL >> # throw it away >> smtpd_end_of_data_restrictions = static:discard >> # safety net >> default_transport = discard >> >> test before sending it a million messages... >> >>  -- Noel Jones >> > > > > -- > Srđan Đukić >
-- -- Srđan Đukić
(Continue reading)

Sahil Tandon | 4 Jul 09:03

Re: How to backhole mail?


On Sat, 04 Jul 2009, Srdan Dukic wrote: > So I guess you can't use the 'static:discard' option with the > 'smtpd_end_of_data_restrictions' parameter. I did however manage to > find a solution here[1]. Although this one is more complicated (it > involves creating a 'null' service). > > Thank you for your help > > [1] http://www.wiredfool.com/2002/06/11/how-to-blackhole-email-server/
Unnecessary creation of null: transport; just use the discard: transport. -- -- Sahil Tandon <sahil <at> tandon.net>

Gmane