• contact
  • linkblog
Home

redirect all outgoing email to a single account with postfix

rene — Wed, 01/28/2009 - 22:10

Lab environments can get fairly messy if not maintained and the gentle hand of a sysadmin is routinely applied. Security compliance is generally the last thing on a developers mind whilst hacking away at projects still in the development stage. Having lab databases filled with unobfuscated customer data which is never a good idea, is unfortunately common.

Im not condoning having real customer data in a lab environment, though it does happen and there is a real potential for a disaster to occur such as testing out your latest 'mass email 2.0' code on your lab database not realising that your lab data is actually a production data set. Oh yer, you also forgot to firewall outbound port 25/tcp aswell as well as having recursion available within your internal BIND9 view. Doh!@#

Heck, having your lab have any access to the intertubes is just a plain bad idea.. period.

Again, im not condoning this though you may want to catch all outgoing emails and redirect them to a single email account which can be viewed by fellow engineers and developers as a means of testing your features that can generate email.

Postfix can be setup to redirect all outgoing email to a single account. As long as your code hands email off to your MTA, this hack will do what you need. Your main.cf will need to look a bit like this.

relayhost = 223.1.2.1
bounce_queue_lifetime = 0
maximal_queue_lifetime = 0
always_bcc = rene@localhost

relayhost lets postfix know what is the next host to relay outgoing email through. For this hack, set relayhost to a bogus address. Setting this to a bogus IP address will force postfix to keep the email in its delivery queue without it actually reaching its next hop.

bounce_queue_lifetime defines the amount of time a bounce message is queued before it is considered undeliverable. Postfix will only attempt to deliver the bounce message once if bounce_queue_lifetime is set to 0.

maximal_queue_lifetime is the maximal time a message is queued before it is sent back as undeliverable. Again, 0 forces postfix to only attempt once.

Finally, always_bcc is the email account that will catch all mail. This account will also catch Non-Delivery Notifcation's which may become annoying though a little procmail fu will fix that.


photos im taking

photo.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgSpiderman!photo.jpgJazz night the RSLChinese new year in melbournephoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpg

connect with me

search rene.bz

what im reading

  • It’s going to take five years - six words that can save your startup
  • 5 Types of Emails You Should be Automatically Filtering
  • Google CEO Eric Schmidt Circa 1986
  • When CEOs Have Warren Buffett In Their Boardroom
  • How NodeJS saved my web application
  • Want more startup hubs? Show us your faces
  • Notes from a production MongoDB deployment
  • Debian refuses to package the embedded PHP library. Reason ? "it's a rotten language whose use should not be encouraged". WTF ?
  • MySQL and Memcached: End of an Era?
  • People Don't Hate Change - They Hate You Trying to Change Them
  • The Data Deluge
  • Palm Says Revenue Will Be Lower Than Expected, Cites Slow Sales
  • Do You Follow Too Many People On Twitter? Use ManageTwitter.
  • Future iPads To Have Front-facing Cameras, Flash (Bulbs, Not Software)
  • PHOTO: In "Life, below 600px," Paddy Donnelly talks
  • 5 Ways to Stop Second Guessing Yourself
  • I Don’t Want a Freaking Computer
  • Man Checks-In Everywhere But Foursquare Rehab
  • How to Kill a Radical Idea
  • MEETorDIE Quantifies The Cost Of Wasteful Meetings
more

what im bookmarking

  • VMware KB: Timekeeping best practices for Linux guests
  • Linux installation kickstart for Oracle database - Oracle Wiki
  • IBM developerWorks: Wikis - Linux for Power Architecture - RHEL5 - Root on dm-multipath device
  • jQuery: » The Official jQuery Podcast – Episode 13 – David Walsh
  • BBC - BBC World Service Programmes - Digital Planet, 16/02/2010
  • gdgt weekly 074 - gdgt
  • PXE virtual network with Virtualbox and Cobbler | number 9
  • bootstrapping Puppet from Cobbler | number 9
  • willypick @ MindSay double NAT
  • BBC iPlayer rejects open source plugins, takes Flash-only path • The Register
  • Puppet Red Hat Centos – puppet
  • Augeas — Main
  • IT Conversations | StackOverflow | Episode 84
  • IT Conversations | O'Reilly Media Gov 2.0 Summit | Panel: John Markoff, Vinton Cerf, Jack Dorsey, Tim Sparapani
  • Shot of Jaq » Jaqback, Issue 4
  • Shot of Jaq » Developing The Devop
  • TWiST #40 Bonus Interview with Penn State | This Week in Startups (TWiST)
  • The Pipeline 3: Jason Fried | 5 by 5
  • Risky Business #140 -- Former NSA tech director, info assurance, Brian Snow | Risky Business
  • TWiST #42 with Michael Robertson
more

podcasts im listening to

  • jQuery: » The Official jQuery Podcast – Episode 13 – David Walsh
  • BBC - BBC World Service Programmes - Digital Planet, 16/02/2010
  • gdgt weekly 074 - gdgt
  • IT Conversations | StackOverflow | Episode 84
  • IT Conversations | O'Reilly Media Gov 2.0 Summit | Panel: John Markoff, Vinton Cerf, Jack Dorsey, Tim Sparapani
more
  • contact
  • linkblog