Solved

How to keep virtual domain name on outgoing sendmail

Posted on 2013-11-29
6
310 Views
Last Modified: 2014-03-14
I have a host with multiple domain names: thishost.com, thathost.com. My sendmail.mc file has:

MASQUERADE_AS(`thishost.com')
FEATURE(`masquerade_envelope')
FEATURE(`masquerade_entire_domain')

I originally had this setting before adding thathost.com, mainly to prevent the hostname from showing up in the From:  address. e.g. myuser@thishost.com instead of myuser@server.thishost.com.  However, when I added thathost.com to /etc/mail/local-host-names and the line

thisuser@thathost.com          thisuser

to the /etc/virtusertable, I cannot send mail addressed from users on thathost.com. The domain always gets changed to thishost.com. E.g. a message sent by thatuser@thathost.com gets sent as From: thatuser@thishost.com.

I suspect the way to fix this is to remove the MASQUERADE_AS directives in sendmail.mc, but I'd like some confirmation from a expert before I start experimenting.
0
Comment
Question by:jmarkfoley
[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
6 Comments
 
LVL 19

Expert Comment

by:xterm
ID: 39685936
How are you sending the mail?  You should be able to set the return-path with the -f flag to sendmail, and configure any From address you want.
0
 
LVL 78

Expert Comment

by:arnold
ID: 39686196
This only affects emails sent from the shell?  Look at configuring the email client settings to use a
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 39686374
xterm: > You should be able to set the return-path with the -f flag to sendmail, and configure any From address you want.

My email client is mailx 12.4. The option to do what you are describing is -r which sets the From address. That used to work just fine to set whatever address I wanted as the Reply-To:. Since setting /etc/virtusertable and /etc/local-host-names it will set the username part of the address, but always overrides what I specify as the domain. mailx also let's me specifically set From:, Reply-To: and Sender: The domains on all of these settings get overridden.

Arnold:  > Look at configuring the email client settings

Did that, and have had those set and working for years. With mailx you use the -A <account> parameter which looks up e.g.

account mercurey {
    set from="myuser@thathost.com (Mark Foley)"
    set hostname=thathost.com
    set ORGANIZATION="Mercurey Technologies SA, Limited"
}

in the $HOME/,mailrc file. Again, this has always worked until I set the virtusertable and local-host-names.

So, I don't think this is something I can fix from the mail client. I could remove the settings in virtusertable and/or local-host-names, but then this host won't be able to receive mail for thathost.com.

I could remove the MASQUERADE directive in sendmail.mc, but then I'll have the machine name attached to the domain name in the messages.

I'm sure I have some sendmail configuration wrong. Computers host email for multiple domains all the time. I've just never set this up before.

I'm in a quandary!
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 78

Assisted Solution

by:arnold
arnold earned 250 total points
ID: 39686387
I think there are two masquerade, one that masks the name of the server which seems to be what you are looking to do. the other deals with masquerading the sender which seems to be what you have configured.
i.e. user@domain will be converted to user@anotherdomain

not sure why/what the issue you have not reflecting the true name of the server?

the other deals with when the sender is identified as username only, the mydomain will be appended to it.


I prefer other mail server to sendmail.
The following covers the different variations and options.
http://www.sendmail.com/sm/open_source/docs/m4/masquerading.html
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 39698604
I've tried two things, both of which appear to have worked:

1) I removed all MASQUERADE directives in sendmail.mc and put in $HOME/.mailrc e.g.

account thatDomain {
    set from="user@thathost.com (My Name)"
    set hostname=thathost.com
    set ORGANIZATION="Mercurey Technologies SA, Limited"
}

for each account I want to use. The "set from" seems to do the trick. I don't see that the "set hostname" does much.

2) I kept MASQUERADE_AS in sendmail.mc, removed FEATURE(`masquerade_envelope')
(not sure why I had that one set in the first place) and FEATURE(`masquerade_entire_domain'). I then added MASQUERADE_EXCEPTION(`thathost.com')

Both of these seem to work. Probably method 1 is more desirable because I'd have to set a MASQUERADE_EXCEPTION for each domain hosted.

I suppose if I multi-home a dozen different domains I'll have to have the appropriate "set from" in each user's .mailrc file.

Is this the normal way multi-homed hosts set up their email users? Seems highly dependent on the mail client used.
0
 
LVL 13

Accepted Solution

by:
Sandy earned 250 total points
ID: 39876165
yes, method 1 is suggested one.. Not exactly highly dependent on the mail client  used but it requires basic headers value to be filled.

TY/SA
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
In this video we show how to create an email address policy 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 Mail Flow…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

732 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