I've seen someone asking for postfix TCP_TABLE support on centos at mailing list.Actually that was easy to achieved.I'm gonna explain how to build postfix rpm package with TCP_TABLE support.There's great tutorial on how to build postfix RPM package maintain by Simon J Mudd.
I'm gonna used Simon J mud's postfix source RPM package to build the binary.
First download the latest postfix SRPM package
$ rpm -Uvh postfix-2.6.5-1.src.rpm $ cd `rpm --eval '%{_sourcedir}'` $ export POSTFIX_SMTPD_MULTILINE_GREETING=1 $ export POSTFIX_LDAP=1 $ export POSTFIX_MYSQL_REDHAT=1 $ export POSTFIX_PCRE=1 $ export POSTFIX_PGSQL=1 $ export POSTFIX_RBL_MAPS=1 $ export POSTFIX_SASL=2 $ export POSTFIX_TLS=1 $ export POSTFIX_VDA=1 $ export POSTFIX_DB=4
You can customize to whatever options you like. here's the references.
$ sh `rpm --eval '%{_sourcedir}'`/make-postfix.spec $ cd `rpm --eval '%{_specdir}'` $ vi postfix.spec
Search for CCARGS variable (line 376)
Default value is empty.
modify to this:
CCARGS="-DSNAPSHOT"
$ rpmbuild -ba postfix.spec $ rpm -Uvh `rpm --eval '%{_rpmdir}'`/i386/postfix-...i386.rpm
done.
Now test if tcp is compiled with postconf -m
$ postconf -m btree cdb cidr environ hash ldap mysql nis pcre pgsql proxy regexp static tcp unix
Good luck 🙂
Hello,
What changes are required to compile postfix with TCP support in CentOS 6? Have tried by making a few changes but no gain.
Thanks!
actually, when using latest postfix TCP support is anable by default. what RPM source are you using? simon’s RPM source?what kind of error?
Installing by Virtualmin.
you can build postfix from rpm source easily, download source rpm from http://ftp.wl0.org/official/2.9/SRPMS/
follow building from rpm source here:
http://postfix.wl0.org/en/building-rpms/
I could do this as well as the random IP script works. But after using the tcp_maps in main.cf the incoming mails have stopped working. The users are not recognized anymore and the sender of emails are sent bounce back message the user does not exist.
Just when I comment out transport_maps part from main.cf, again incoming email works fine.
Can you suggest something for this?
you can make exception in perl script, such as..
virtual user:
After making these changes, I am getting the following error in logs:
Sep 20 14:22:28 m1 postfix/trivial-rewrite[9229]: warning: tcp:[127.0.0.1]:2527 lookup error for “xxx@example.com”
Sep 20 14:22:28 m1 postfix/trivial-rewrite[9229]: warning: transport_maps lookup failure
Also, this error line:
Sep 20 14:34:34 m1 postfix/trivial-rewrite[11459]: warning: read TCP map reply from [127.0.0.1]:2527: malformed reply: Array found where operator expected at /etc/postfix/random.pl line 29, at end of line
can you post you full script here?
#!/usr/bin/perl -w
# author: Hari Hendaryanto
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
#
# our transports array, we will define this in master.cf as transport services
#
our @array = (
'rotate1:',
'rotate2:',
'rotate3:'
);
#
# Initalize and open syslog.
#
openlog('postfix/randomizer','pid','mail');
#
# Autoflush standard output.
#
select STDOUT; $|++;
while () {
chomp;
@array = shuffle @array;
my $random_index = rand @array;
my $random_smtp = $array[$random_index];
trim($random_smtp);
if (/^get\s+(.+)$/i) {
my $rcpt_domain = $1;
if ($rcpt_domain =~ m/example.com/) {
print "200 virtual:\n";
} else {
print "200 $random_smtp\n";
syslog("info","using transport: service for: ", $random_smtp, $rcpt_domain);
}
next;
}
print "200 smtp:\n";
}
and you are using virtual user? domain example.com has to be changed into your real/actual domain.
Yes using a virtual user. Domain has been written as actual domain only on the server. It is just here that I changed actual to example.com for the code.
i have to admit, when i first design this randomize transport, it’s for outgoing relay smtp only, but i’ve heard somesone , somewhere in this blog says, he/she can do both randomizing and receiving in the same box. patch i gave you, i’ve never tested it before, that’s only logic i have in mind at that time.theoriticaly it should be make exception, when transport_maps asking about your virtual user. any@example.com goes to virtual: , other domains, randomized.
i’ve rechecked you script, look at random.pl line 29
is it
or
?
i am getting an error that i can’t resolve, is something like TCP, but i don’t know why is not configured with postfix, that’s is going me crazy, i have 2 days trying to solve it.
Error is:
postmap: fatal: unsupported dictionary type: tcp
Any help?
your postfix not supporting tcp_table, try postconf -m , you’ll see what lookup table types supported on your installation.
what version of postfix dou yo have?
Hi friend, im running zpanel and centos 6, because zpanel cant install on centos 5
i cant recompile the postfix for use TCP tables
show this erros, is there any way to get running on centos 6???
thanks in advance, look the error below:
If this procedure does not allow you to produce a working package, please
let me know.
ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.xSmlrZ (%prep)
RPM build errors:
line 144: prereq is deprecated: PreReq: chkconfig, initscripts, shadow-utils
line 145: prereq is deprecated: PreReq: /etc/init.d, /sbin/service, chkconfig >= 1.3
Bad exit status from /var/tmp/rpm-tmp.xSmlrZ (%prep)
try commented out PreReq in postfix.spec