• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

How to keep virtual domain name on outgoing sendmail

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
jmarkfoley
Asked:
jmarkfoley
2 Solutions
 
xtermCommented:
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
 
arnoldCommented:
This only affects emails sent from the shell?  Look at configuring the email client settings to use a
0
 
jmarkfoleyAuthor Commented:
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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
arnoldCommented:
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
 
jmarkfoleyAuthor Commented:
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
 
SandyCommented:
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now