Solved

sendmail: how to masquerade aliased To: address

Posted on 2014-12-02
11
150 Views
Last Modified: 2015-01-08
I have an email header where the recipient sees:
From: HPRS Batch <ohprs@ohprs.org>
To: <benefits@webserver.hprs.local>, <StatenS1@aetna.com>

Open in new window

The local domain name is hprs.local and the ID "benefits" is in the /etc/mail/aliases file routing to various users. The external domain name is ohprs.org. I would like the To: line to read "To: <benefits@ohprs.org" instead of having the local domain name. Obviously, an external recipient would not be able to reply to that address.

in my sendmail.mc file I have

MASQUERADE_AS(`ohprs.org')
FEATURE(`masquerade_envelope')
FEATURE(`masquerade_entire_domain')

so why is this address not getting masqueraded?

Slackware 13.37, kernel 2.6.37.6, sendmail 8.14.4
0
Comment
Question by:jmarkfoley
  • 6
  • 5
11 Comments
 
LVL 20

Expert Comment

by:carlmd
ID: 40486902
In your sendmail.cf file you will see a DM entry, it should be set like this.

# who I masquerade as (null for no masquerading) (see also $=M)
# DM
DMohprs.org

refresh or restart sendmail

That should solve your problem
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40487739
carlmd: > In your sendmail.cf file you will see a DM entry, ...

I do have that set as you've shown. Note that the sender is being sent from the same hprs.local domain *is* masqueraded:

From: HPRS Batch <ohprs@ohprs.org>
To: <benefits@webserver.hprs.local>, <StatenS1@aetna.com>

The 1st recipient is in the /etc/aliases/file as:

benefits:       webadmin,user1@ohprs.org,user2@ohprs.org,user3@ohprs.org

The email is *to* those recipients, but instead of To: benefits@ohprs.org it shows  To: benefits@hprs.local. That's the one I want to fix. The mail command in the script is:

 mutt -e 'set content_type="text/html"' -s "subject line"  benefits StatenS1@aetna.com

Any way to fix this?
0
 
LVL 20

Expert Comment

by:carlmd
ID: 40491241
You can try the following, one at a time. In sendmail.cf set

DJohprs.org

Depending upon your mc options your sendmail.cf may have a section like...

#########################
#   Format of headers   #
#########################

H?P?Return-Path: <$g>
# HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
HReceived: $?sfrom ohprs.org (smtp.ohprs.org [put your ip address here])
        $.$?{auth_type}(authenticated$?{auth_ssf} (${auth_ssf} bits)$.)
        $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
        (using ${tls_version} with cipher ${cipher} (${cipher_bits} bits) verifi
ed ${verify})$.$?u

I changed it to show your ohprs.org so you can try doing that as well.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40498424
Ah ha! This is apparently not a sendmail thing. When I send to a test alias using mail (mailx) it shows the To: address correctly:

testme@webserver.ohprs.org

When I send using mutt it shows: To: testme@webserver.hprs.local

Odd, because `hostname -f` gives: webserver.ohprs.org. The mutt variation is one of the aliases in /etc/hosts:
192.168.0.3             webserver.ohprs.org webserver.ohprs.local webserver

Open in new window


I assume, therefore, I need some setting in ~/.muttrc. Do you happen to know what that would be? I'll investigate too.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40499009
No luck finding a mutt setting to fix this. Any ideas? Is this just something I'll have to live with with mutt?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 20

Accepted Solution

by:
carlmd earned 500 total points
ID: 40500163
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40500656
Thanks, but the problem is the recipient's email, not sender's. Don't know where mutt is getting the webserver.hprs.local domain name other than arbitrarily picking the 2nd alias in the /etc/hosts file:
192.168.0.3             webserver.ohprs.org webserver.ohprs.local webserver

Open in new window

It does the same thing if I send mail to a real local recipient. Doesn't even have to be an alias name.

Seems odd. This must be fairly common for all mutt users. hostname gives:
$ hostname -f
webserver.ohprs.org

Open in new window

so how is mutt determining the local domain name?
0
 
LVL 20

Expert Comment

by:carlmd
ID: 40502389
Since mutt is an email client to sendmail, it is obviously overriding the sendmail options, since sendmail does it correctly on it's own.

Have you tried defining mutt aliases in addition to those in sendmail? Look at the section on aliases in:

http://www.mutt.org/doc/manual/manual-3.html

Also try the following...

HOW-TO 3: Send email with a customized sender name and email address
# The .muttrc file is Mutt's configuration file. It's default location is the $HOME directory.
# If you locate it elsewhere, specify its location with the '-F' flag.
# Add the following to the .muttrc file:
set realname="Joe Bloggs"
set from="noreply@jb.com"
set use_from=yes
#
# where:
# realname => Sender's name as it appears in the recipient's mail inbox.
# from => the "reply-to" address
#
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40514357
carlmd: > Have you tried defining mutt aliases in addition to those in sendmail?

I've looked at that, but I think having aliases in both /etc/mail/aliases and mutt aliases might confuse my eventual successor beyond what the inconvenience of fooped recipient addresses presents. Mutt is only used when encoding html in messages -- not often. Other non-interactive mode messages are sent using mail(x).

I've tried switching the order of alias names in /etc/hosts from

192.168.0.3             webserver.ohprs.org webserver.ohprs.local webserver

to

192.168.0.3             webserver.ohprs.local webserver.ohprs.org webserver

thinking mutt was getting the domain from there, but no difference. `hostname -f` gives "webserver.ohprs.org" and the contents of /etc/HOSTNAME is "webserver.ohprs.org".
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40514362
OK, I think I've found a solution. `mutt -D` dumps config settings. This dumps:

hostname="webserver.hprs.local"

The user has no .muttrc to override, but there is a /etc/mutt/Muttrc. Searching that shows not hostname set. I uncommented the hostname setting and made it:

hostname="webserver.ohprs.org"

That finally worked! I have no clue where mutt has been getting webserver.ohprs.local. Even when I removed this alias entirely from the /etc/hosts file it still picked up that FQDN.

I'd be interested if you have a theory on why mutt gets that odd FDQN, other than that, I think my issue is solved.
0
 
LVL 20

Expert Comment

by:carlmd
ID: 40516364
Not sure if this is the issue, but take a look at:

http://dev.mutt.org/trac/ticket/3298#comment:37

Also, if you google "mutt fqdn" there is a lot to read.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now