I/Intro
As previous document I intro to you Iredmail as mail server in linux with full-featured (/Postfix/Dovecot/Amavisd/ClamAV/SpamAssassin/RoundCube/iRedAdmin/
postfixadmin).But With this document I will intro iredmail as mail gateway(because By default iredmail config /Amavisd/ClamAV/SpamAssassin/greylisting for anti spam and mail anti-virus).
II/Install Iredmail
Install iredmail as normal But only choose phpmyadmin(for managed greylisting easier) and Awstats
III/Remove some services not use
Because we setup iredmail as Mail gateway so We not use some services:dovecot,pysieved
IV/Change some config
1/Edit /etc/postfix/main.cf
mydestination =
local_recipient_maps =
local_transport =error:local mail delivery disabled
relay_recipient_maps = hash:/etc/postfix/relay_recipients
relay_domains = test.vn
transport_maps = hash:/etc/postfix/transport
comments all line with mysql_* or ldap_*
2/ edit /etc/postfix/master.cf
comment line
#local unix - n n - - local
3/edit /etc/postfix/transport
test.vn smtp:192.168.22.233 #with 192.168.22.233(IP mail server backend as exchange...)
4/create /etc/postfix/relay_recipients
u1@test.vn OK
u2@test.vn OK
ug@test.vn OK
u3@test.vn OK
u4@test.vn OK
5/hashing Databases
postmap /etc/postfix/transport
postmap /etc/postfix/relay_recipients
V/Populating relay_recipients from Active Directory
Note that this script requires perl and Net::LDAP(you need install perl-ldap by yum). However, this does NOT have to be on your email gateway.
Edit the script so that values below are correct:
$VALID = "/etc/postfix/relay_recipients";
$dc1="dc1.test.vn";
$dc2="dc2.test.vn";
$hqbase="cn=Users,dc=test,dc=vn";
$user="cn=user,cn=Users,dc=test,dc=vn";
$passwd="password";
If You have any problem script perl please send mail to quan.hoa@conheotiensinh.co.cc.I will edit for you
VI/Create Bash shell automatic update relay_recipients from Active directory
create bash shell /opt/ad.sh with info:
cd /etc/postfix ; ./getadsmtp.pl && /usr/sbin/postmap relay_recipients
use crontab run as your schedule
Beside you can use iredmail for multi domain(can get relay_recipients from Multi Active directory).
Thanks
quan.hoa@conheotiensinh.co.cc