netmach
asked on
How to Masquerade the Domain
This server is sending email successfully aS user@myserver.mydomain.com . However, I'm trying to masqurade user@myserver.mydomain.com as user@mydomain.com using the MASQUERADE_AS parameter. I have not been successful.
This is the /etc/mail/sendmail.mc as it stands at the moment:
========================== ========== ========== ====
divert(-1)
dnl This is the sendmail macro config file. If you make changes to this file,
dnl you need the sendmail-cf rpm installed and then have to generate a
dnl new /etc/sendmail.cf by running the following command:
dnl
dnl m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
dnl
include(`/usr/share/sendma il-cf/m4/c f.m4')
VERSIONID(`linux setup for Red Hat Linux')dnl
OSTYPE(`linux')
dnl Uncomment and edit the following line if your mail needs to be sent out
dnl through an external mail server:
dnl define(`SMART_HOST',`smtp. your.provi der')
define(`confDEF_USER_ID',` `8:12'')dn l
undefine(`UUCP_RELAY')dnl
undefine(`BITNET_RELAY')dn l
define(`confAUTO_REBUILD') dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LI ST',true)d nl
define(`confDONT_PROBE_INT ERFACES',t rue)dnl
define(`PROCMAIL_MAILER_PA TH',`/usr/ bin/procma il')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS' , `authwarnings,novrfy,noexp n,restrict qrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl TRUST_AUTH_MECH(`DIGEST-MD 5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISM S', `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN ', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',` dnl')dnl
FEATURE(`smrsh',`/usr/sbin /smrsh')dn l
FEATURE(`mailertable',`has h -o /etc/mail/mailertable.db') dnl
FEATURE(`virtusertable',`h ash -o /etc/mail/virtusertable.db ')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain) dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl The '-t' option will retry delivery if e.g. the user runs over his quota.
FEATURE(local_procmail,`', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db',`hash -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipie nts')dnl
EXPOSED_USER(`root')dnl
dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
DAEMON_OPTIONS(`Port=smtp, Addr=127.0 .0.1, Name=MTA')
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl a kernel patch
dnl DAEMON_OPTIONS(`port=smtp, Addr=::1, Name=MTA-v6, Family=inet6')
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not have 24x7 DNS do need this.
FEATURE(`accept_unresolvab le_domains ')dnl
dnl FEATURE(`relay_based_on_MX ')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
Cwlocalhost.localdomain
FEATURE(`genericstable',`h ash -o /etc/mail/genericstable.db ')
FEATURE(`masquerade_envelo pe')
GENERICS_DOMAIN(`myserver' )
GENERICS_DOMAIN(`myserver. mydomain.c om')
GENERICS_DOMAIN(`localhost ')
GENERICS_DOMAIN(`localhost .localdoma in')
MASQUERADE_AS(`mydomain.co m')
MASQUERADE_DOMAIN(`myserve r.mydomain .com')
========================== ========== ========== ==
I have generated the sendmail.cf file using m4 /etc/mail/sendmail.mc > /etc/sendmail.cf.
I have hashed the /etc/mail/genericstable table successfully, repeatedly.
Testing with sendmail -bt, 0 seems to indicate everything is ok.
The only log I know to review for possible errors is /var/log/maillog.
As I said, it's working, but it's really not a valid domain.
Not being a Sendmail expert, I have reconfigured it many times now, and barring a few typos, nothing I configure seems to make the slightest difference in the result. Any help would be greatly appreciated!
Thanks!
This is the /etc/mail/sendmail.mc as it stands at the moment:
==========================
divert(-1)
dnl This is the sendmail macro config file. If you make changes to this file,
dnl you need the sendmail-cf rpm installed and then have to generate a
dnl new /etc/sendmail.cf by running the following command:
dnl
dnl m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
dnl
include(`/usr/share/sendma
VERSIONID(`linux setup for Red Hat Linux')dnl
OSTYPE(`linux')
dnl Uncomment and edit the following line if your mail needs to be sent out
dnl through an external mail server:
dnl define(`SMART_HOST',`smtp.
define(`confDEF_USER_ID',`
undefine(`UUCP_RELAY')dnl
undefine(`BITNET_RELAY')dn
define(`confAUTO_REBUILD')
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LI
define(`confDONT_PROBE_INT
define(`PROCMAIL_MAILER_PA
define(`ALIAS_FILE', `/etc/aliases')dnl
dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS'
define(`confAUTH_OPTIONS',
dnl TRUST_AUTH_MECH(`DIGEST-MD
dnl define(`confAUTH_MECHANISM
dnl define(`confTO_QUEUEWARN',
dnl define(`confTO_QUEUERETURN
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',`
FEATURE(`smrsh',`/usr/sbin
FEATURE(`mailertable',`has
FEATURE(`virtusertable',`h
FEATURE(redirect)dnl
FEATURE(always_add_domain)
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl The '-t' option will retry delivery if e.g. the user runs over his quota.
FEATURE(local_procmail,`',
FEATURE(`access_db',`hash -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipie
EXPOSED_USER(`root')dnl
dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
DAEMON_OPTIONS(`Port=smtp,
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl a kernel patch
dnl DAEMON_OPTIONS(`port=smtp,
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not have 24x7 DNS do need this.
FEATURE(`accept_unresolvab
dnl FEATURE(`relay_based_on_MX
MAILER(smtp)dnl
MAILER(procmail)dnl
Cwlocalhost.localdomain
FEATURE(`genericstable',`h
FEATURE(`masquerade_envelo
GENERICS_DOMAIN(`myserver'
GENERICS_DOMAIN(`myserver.
GENERICS_DOMAIN(`localhost
GENERICS_DOMAIN(`localhost
MASQUERADE_AS(`mydomain.co
MASQUERADE_DOMAIN(`myserve
==========================
I have generated the sendmail.cf file using m4 /etc/mail/sendmail.mc > /etc/sendmail.cf.
I have hashed the /etc/mail/genericstable table successfully, repeatedly.
Testing with sendmail -bt, 0 seems to indicate everything is ok.
The only log I know to review for possible errors is /var/log/maillog.
As I said, it's working, but it's really not a valid domain.
Not being a Sendmail expert, I have reconfigured it many times now, and barring a few typos, nothing I configure seems to make the slightest difference in the result. Any help would be greatly appreciated!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OHMYGOSH, IT WORKED!!!
I would swear I tried that combination in sendmail.mc 5 times! But Good for you! Thanks!
Now I need to masquerade the user to "resu"...
I would swear I tried that combination in sendmail.mc 5 times! But Good for you! Thanks!
Now I need to masquerade the user to "resu"...
ASKER
Samri had me double-check my configuration and it paid off. Well done!
no. prob.
There are scenario (personal exp) where sendmail doesn't fully restart. And sometime, i had to do "pkill -9 sendmail", very rude - but should ensure all are killed.
Anyway, glad to hear that it worked -- auto"magically".
cheers
There are scenario (personal exp) where sendmail doesn't fully restart. And sometime, i had to do "pkill -9 sendmail", very rude - but should ensure all are killed.
Anyway, glad to hear that it worked -- auto"magically".
cheers
please check the location of your sendmail.cf, is it in /etc or /etc/mail
Did you restart sendmail after generating a new cf file.
And how about adding dnl at the end of these lines
FEATURE(`genericstable',`h
FEATURE(`masquerade_envelo
GENERICS_DOMAIN(`myserver'
GENERICS_DOMAIN(`myserver.
GENERICS_DOMAIN(`localhost
GENERICS_DOMAIN(`localhost
MASQUERADE_AS(`mydomain.co
MASQUERADE_DOMAIN(`mydomai