Wednesday, 22 May 2013

SENDMAIL - EMAIL MASQUARADING


Prepared By Sarang Acharya
Email evolutioncage@gmail.com



Verify all the required packages are installed or not.

# rpm -qa |grep -iE "sendmail|m4"

Packages should be
1)sendmail-cf
2)sendmail
3)m4

take a backup of existing mail directory
# tar -cvzf /root/mail_`date +%F`.tar.gz /etc/mail



edit /etc/mail/sendmail.mc and add below lines

Note:- verify if below lines already exists

FEATURE(masquerade_envelope)
FEATURE(genericstable, `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')

edit /etc/mail/genericstable to masquerade local accounts with prefered email accounts as below

root incidents@emailorg.com

execute below command to generate db format

#  cd /etc/mail

#  makemap -r hash genericstable.db < genericstable

edit /etc/mail/genericsdomain to reflect the servers actual FQDN refer below for example.

snaptestdb.
emailorg.
com


Test the setup.

Send a test mail as below

echo "Test mail"|mail -s "testing incidents" incidents@
emailorg.com
,alerts@xnode.com,yourmailaccount@yourorgmai.com

Make sure that you receive mail from this server where from address is incidents@
emailorg.com
and also verify if a incident is generated.