Sendmail 8.15 on a RHEL 8 system. I am able to send mail out, but when I receive it on the other end, the 'from' address is user@FQDN instead of user@MASQUARADE_AS
what we get: user@realhosname.realdomain.com
what we want: user@somedomain.com.au
sendmail.mc config contains these among other macros:
MASQUERADE_AS(`somedomain.com.au')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
EXPOSED_USER(`root')dnl
FEATURE(masquerade_envelope)dnl
MASQUERADE_DOMAIN(somedomain.com.au)dnl
we do want the root user exposed as from the FQDN for management reasons, but we want all other users to show as user@MASQUERADE_AS
Testing the configuration, thing appear as they ought:
> =SHdrFromL
R< @ > MAILER-DAEMON
R@ < @ $* > MAILER-DAEMON
R$+ $: $> AddDomain $1
R$* $: $> MasqHdr $1
> /tryflags HS
> /try local user
Trying header sender address user for mailer local
canonify input: user
Canonify2 input: user
Canonify2 returns: user
canonify returns: user
1 input: user
1 returns: user
HdrFromL input: user
AddDomain input: user
AddDomain returns: user < @ *LOCAL* >
MasqHdr input: user < @ *LOCAL* >
MasqHdr returns: user < @ somedomain . com . au . >
HdrFromL returns: user < @ somedomain . com . au . >
final input: user < @ somedomain . com . au . >
final returns: user @ somedomain . com . au
Rcode = 0, addr = user@somedomain.com.au
> /try esmtp user
Trying header sender address user for mailer esmtp
canonify input: user
Canonify2 input: user
Canonify2 returns: user
canonify returns: user
1 input: user
1 returns: user
HdrFromSMTP input: user
PseudoToReal input: user
PseudoToReal returns: user
MasqSMTP input: user
MasqSMTP returns: user < @ *LOCAL* >
MasqHdr input: user < @ *LOCAL* >
MasqHdr returns: user < @ somedomain . com . au . >
HdrFromSMTP returns: user < @ somedomain . com . au . >
final input: user < @ somedomain . com . au . >
final returns: user @ somedomain . com . au
Rcode = 0, addr = user@somedomain.com.au
>
Scratching my head, here. Are the other config directives I need to be looking at?
And, yes, I did run 'make' after editing the sendmail.mc file. :)
somedomain.com.au is an MX for the externally visible exit point for our mail (spf records, etc.).
============================
FIX:
So...we finally resolved it this way:
sendmail.mc:
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_AS(`somedomain.com.au')dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(`otherdomain.com')dnl
MASQUERADE_DOMAIN(`somehost.otherdoamin.com')dnl
submit.mc:
dnl define(`confDIRECT_SUBMISSION_MODIFIERS',`C')dnl
then recompiled and restarted and now we get the desired behavior: external users see our mail as coming from somdomain.com.au