Dec 062010

This time i’ll show you how to randomize your smtp outbound’s IP addresses. This can be done via transport map. But, since ordinary Postfix lookup tables store information as (key, value) pairs. it will provide static value only. we need someting that can manipulate the value (right hand side) of a lookup table. In order to answer random transport value.

first come to mind was tcp_tables, tcp_tables lookup table gives some flexibility for us to execute our tiny perl script that will randomizing transport. that’s the basic idea.

Ok, here’s the first part, create perl script call, anyway this script only provide answer in “catch-all” manner. so it will randomized, all outgoing mail.

# cd /etc/postfix
# vi
#!/usr/bin/perl -w
# author: Hari Hendaryanto <hari.h -at->

use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);

# our transports array, we will define this in as transport services

our @array = (

# Initalize and open syslog.

# Autoflush standard output.
select STDOUT; $|++;

while (<>) {
        # randomizing transports array
        my $random_smtp = int(rand(scalar(@array)));
        if (/^get\s(.+)$/i) {
                print "200 $array[$random_smtp]\n";
                syslog("info","Using: %s Transport Service", $random_smtp);

	print "200 smtp:";

Continue reading »