0

Our email domain is hosted in Google Apps, (@contoso.com) and we only use Postfix as an email relay for our internal services to send out with.

Our Postfix configuration is fairly bare-bones, it's just slightly tweaked from an out of the box Ubuntu configuration as "Internet Site with Smarthost" and I'll post the postconf -n below.

The problem I am having, is that I am putting the Postfix servers into a load balancer, and the load balancer is checking for availibility of the server by trying to succesfully send email. I don't really want to collect any of these emails - and what I am seeing often used is people sending the mail to /dev/null which is what I'm trying to do but have been unsuccesfull. I have tried editing my /etc/aliases file and have attempted to do virtual_alias_maps but haven't gotten it to work - I know it's possible but my implementation has obviously been incorrect. Right now I've undone my attempts and just made it how it was prior to trying this, so here is my configuration as it stands right now:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = mail.contoso.com, localhost.localdomain, localhost
myhostname = mail.contoso.com
mynetworks = 10.0.0.0/8 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = smtp-relay.gmail.com
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_helo_restrictions = warn_if_reject check_helo_access static:reject
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

Any help in getting this working would be appreciated - remember this Postfix server is only used as a mail relay, and a load balancer is trying to send email say from load-balancer@contoso.com to (insert any email address here, ex:) devnull@contoso.com. When the Postfix server processes this, instead of relaying that message to the internet I want it to send it locally to /dev/null.

Thanks in advance!

1

You should have this in your /etc/alias file:

devnull:    /dev/null

So email sent to devnull@contoso.com is sent to /dev/null. If you have virtual domains setup, then you will have to do something like this in the virtual domain mapping:

<user>@contoso.com  devnull

Where devnull is the user that you set up in your /etc/aliases file.

Make sure after updating /etc/aliases that you rebuild the file:

sudo newaliases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.