Sunday, February 17, 2008

Sendmail How to masquarate from user@host.domain.com to user@domain.com

root@:/etc/mail # diff sendmail.cf sendmail.cf.save
986,987c986
< #R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
< R$* < @ *LOCAL* > $* $: $1 < @ $M . > $2
---
> R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
root@:/etc/mail #


add the line shown below
--------------
###################################################################
### Ruleset 94 -- convert envelope names to masqueraded form ###
###################################################################

SMasqEnv=94
#R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2 <--------------- this line commented
R$* < @ *LOCAL* > $* $: $1 < @ $M . > $2 <--------------- this line added


----------
Testing masquerading
sendmail's address test mode makes it easy to test masquerading.
====================================================

# sendmail -bt
/tryflags HS (to test the header sender address; other tryflags values would be ES, HR, and ER, for envelope sender, header recipient, and envelope recipient, respectively)
/try esmtp email_address_to_test

Example:
sendmail -bt
> /tryflags ES
> /try esmtp user@host.domain.com
Trying envelope sender address user@host.domain.com for mailer esmtp

(many lines omitted)

final returns: user @ domain . com
Rcode = 0, addr = user@domain.com

No comments:

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...