How to backhole mail?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to backhole mail?

Srdan Dukic
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ć
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Noel Jones-2
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@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
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Srdan Dukic
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=<[hidden email]>
Jul  4 17:38:24 mailtest postfix/qmgr[9255]: 363ABF6913:
from=<[hidden email]>, size=389, nrcpt=1 (queue active)
Jul  4 17:38:25 mailtest postfix/smtp[9260]: 363ABF6913:
to=<[hidden email]>, 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
<[hidden email]> 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 <[hidden email]>:

>
> This should work...
>
> # main.cf
> # accept anyuser@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ć
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Srdan Dukic
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=<[hidden email]>
to=<[hidden email]> 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 <[hidden email]>:

> 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=<[hidden email]>
> Jul  4 17:38:24 mailtest postfix/qmgr[9255]: 363ABF6913:
> from=<[hidden email]>, size=389, nrcpt=1 (queue active)
> Jul  4 17:38:25 mailtest postfix/smtp[9260]: 363ABF6913:
> to=<[hidden email]>, 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
> <[hidden email]> 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 <[hidden email]>:
>>
>> This should work...
>>
>> # main.cf
>> # accept anyuser@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ć
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Sahil Tandon
In reply to this post by Srdan Dukic
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 <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Sahil Tandon
In reply to this post by Srdan Dukic
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 <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Barney Desmond
In reply to this post by Srdan Dukic
2009/7/4 Srdan Dukic <[hidden email]>:

> 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to backhole mail?

Noel Jones-2
In reply to this post by Srdan Dukic
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=<[hidden email]>
> Jul  4 17:38:24 mailtest postfix/qmgr[9255]: 363ABF6913:
> from=<[hidden email]>, size=389, nrcpt=1 (queue active)
> Jul  4 17:38:25 mailtest postfix/smtp[9260]: 363ABF6913:
> to=<[hidden email]>, 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
> <[hidden email]> 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