Compile postfix with TLS And SASL for Sendgrid :-

Configure Postfix tar package for sendgrid & Compile postfix with TLS And SASL.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* Download these tar files cyrus-sasl-2.1.15.tar.gz, pfixtls-0.8.16-2.0.15-0.9.7b.tar.gz, postfix-2.0.15.tar.gz.
tar -xzvf cyrus-sasl-2.1.15.tar.gz
ls
cd cyrus-sasl-2.1.15
ls
./configure –enable-login=yes –with-dblib=none -disable-krb4 –disable-gssapi
make
make install
sh -c “echo pwcheck_method: saslauthd >/usr/local/lib/sasl2/smtpd.conf”
chmod 777 /usr/local/lib/sasl2/smtpd.conf
if already you installed sasl then move it has old or some other name
mv /usr/lib/sasl2 /usr/lib/sasl2.apple
After this execute below Command,
ln -s /usr/local/lib/sasl2 /usr/lib/sasl2
cd ..
hash -r
Compile the Tls With Postfix :-
———————————-
tar -xzvf pfixtls-0.8.16-2.0.15-0.9.7b.tar.gz
ls
tar -xzvf postfix-2.0.15.tar.gz
ls
patch -p0 < pfixtls-0.8.16-2.0.15-0.9.7b/pfixtls.diff
Installing Postfix :-
———————
cd postfix-2.0.15
yum install db4-devel.x86_64 (For DB)
make makefiles CCARGS=”-DUSE_SASL_AUTH -I/usr/local/include/sasl \
-DHAS_SSL -I/usr/local/include/openssl” AUXLIBS=”-L/usr/local/lib \
-R/usr/local/lib -lsasl2 -lssl -lcrypto”
make install (follow the instructions for configuration and install of the postfix)
ldd /usr/libexec/postfix/smtpd
the output is like
——————————-
linux-vdso.so.1 => (0x00007fff9f7c9000)
libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003fafa00000)
libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000372ce00000)
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x000000372c600000)
libdb-4.7.so => /lib64/libdb-4.7.so (0×0000003737600000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003729e00000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003726e00000)
libc.so.6 => /lib64/libc.so.6 (0×0000003725200000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003725a00000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003727a00000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x000000372b200000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0×0000003729200000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0×0000003728600000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x0000003728e00000)
libz.so.1 => /lib64/libz.so.1 (0x0000003725e00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0×0000003725600000)
/lib64/ld-linux-x86-64.so.2 (0x0000003724a00000)
libfreebl3.so => /lib64/libfreebl3.so (0x0000003727e00000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0×0000003729600000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0×0000003728200000)
libselinux.so.1 => /lib64/libselinux.so.1 (0×0000003726600000)
—————————
Default Postfix conf. files are installed to /etc/postfix/*
Create the CA Certificate :-
—————————–
cd /etc/pki/tls/certs
hostname
make hostname.pem
Follow the instructions and give the details to create the CA Certificate.
ls
cp hostname.pem /etc/postfix/
#vim /etc/postfix/main.cf (In this my local system IP is (192.168.1.1))
————————————————————————–
inet_interfaces = 192.168.1.1 (Ex: 192.168.1.1 this is my local IP)
inet_interfaces = all
mydestination = $myhostname, 192.168.1.1.$mydomain, 192.168.1.1
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
inet_protocols = ipv4
smtp_sasl_security_options = noanonymous
relayhost = [smtp.sendgrid.net]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
smtp_tls_CAfile = /etc/postfix/hostname.pem
#vim master.cf
——————
smtps inet n – n – – smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
——————
mkdir /etc/postfix/sasl/
#vim /etc/postfix/sasl/passwd
————————————
[smtp.sendgrid.net]:587 sendgridusername:sendgridpassword
————————————
chmod 600 /etc/postfix/sasl/passwd
postmap /etc/postfix/sasl/passwd
Reload or start the postfix
postfix reload or postfix start
To see the what are all the ports opened on our server.
netstat -tpln
see the log file for more details (for Mail status)
tail -f /var/log/maillog
#################################
Test Mail
mailx yourmailid@dot.com
subject:any thing
body
. ( for Exit)
after this check the logs “tail -f /var/log/maillog” Status should be sent like “status=sent”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: