?
Solved

How to Masquerade the Domain

Posted on 2003-03-29
5
Medium Priority
?
2,484 Views
Last Modified: 2013-12-17
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/sendmail-cf/m4/cf.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.provider')
define(`confDEF_USER_ID',``8:12'')dnl
undefine(`UUCP_RELAY')dnl
undefine(`BITNET_RELAY')dnl
define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')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,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `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')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -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_recipients')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_unresolvable_domains')dnl
dnl FEATURE(`relay_based_on_MX')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
Cwlocalhost.localdomain
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')
FEATURE(`masquerade_envelope')
GENERICS_DOMAIN(`myserver')
GENERICS_DOMAIN(`myserver.mydomain.com')
GENERICS_DOMAIN(`localhost')
GENERICS_DOMAIN(`localhost.localdomain')
MASQUERADE_AS(`mydomain.com')
MASQUERADE_DOMAIN(`myserver.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!
0
Comment
Question by:netmach
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:samri
ID: 8237686
hi netmach,

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',`hash -  /etc/mail/genericstable.db')dnl
FEATURE(`masquerade_envelope')dnl
GENERICS_DOMAIN(`myserver')dnl
GENERICS_DOMAIN(`myserver.mydomain.com')dnl
GENERICS_DOMAIN(`localhost')dnl
GENERICS_DOMAIN(`localhost.localdomain')dnl
MASQUERADE_AS(`mydomain.com')dnl
MASQUERADE_DOMAIN(`mydomain.com')dnl
0
 
LVL 15

Accepted Solution

by:
samri earned 2000 total points
ID: 8237691
hi netmach,

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',`hash -  /etc/mail/genericstable.db')dnl
FEATURE(`masquerade_envelope')dnl
GENERICS_DOMAIN(`myserver')dnl
GENERICS_DOMAIN(`myserver.mydomain.com')dnl
GENERICS_DOMAIN(`localhost')dnl
GENERICS_DOMAIN(`localhost.localdomain')dnl
MASQUERADE_AS(`mydomain.com')dnl
MASQUERADE_DOMAIN(`mydomain.com')dnl
0
 

Author Comment

by:netmach
ID: 8257887
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"...
0
 

Author Comment

by:netmach
ID: 8257898
Samri had me double-check my configuration and it paid off. Well done!
0
 
LVL 15

Expert Comment

by:samri
ID: 8258717
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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question