Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sendmail config

1 view
Skip to first unread message

Thomas Schweikle

unread,
Feb 11, 2006, 2:07:50 PM2/11/06
to
Hi!

What macro for FreeBSD sendmal configuration do I have to change to
have sendmail rewrite all outgoing mail to a given dns-name?

I'd like to have the local domain "xyz.local" rewritten to
"abc.def.example". What macro do I have to touch? I do know what to
change inside the sendmail config file to have this done, but since
I am not really firm with m4 macros I am a bit lost with the
"`hostname`.mc" file and the definitions inside it.

--
Thomas

Conrad J. Sabatier

unread,
Feb 11, 2006, 3:09:56 PM2/11/06
to

MASQUERADE_AS(`domain.name')

--
Conrad J. Sabatier <con...@cox.net> -- "In Unix veritas"

Giorgos Keramidas

unread,
Feb 11, 2006, 5:17:03 PM2/11/06
to

What you are trying to do is called ``address masquerading''.

To get this to work correctly, you have to use something like this
(copied straight from my personal Sendmail config file here):

dnl Address masquerading.
dnl
dnl Making sure that all email that passes through my laptop's Sendmail
dnl installation is masqueraded as coming from `flame.pc', even if its
dnl original address is something slightly different (i.e. `ftp.pc' or
dnl `mail.pc'), is ok here. It ensures that address rewriting and
dnl translation through `genericstable' will also work for all `*.pc'
dnl host names.
dnl
dnl To make sure that remote hosts don't get a MAIL FROM address from a
dnl hostname that doesn't resolve, envelope addresses are masqueraded too,
dnl and then get rewritten by `genericstable' to real-world addresses,
dnl i.e. `kera...@ceid.upatras.gr'.
dnl
MASQUERADE_AS(`flame.pc')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')

Change `flame.pc' with the address of the `abc.def.example' domain.

Note that this masquerades the *host* address part only. If you also need to
change the usernames of the email addresses used by your local users, you may
also need to enable the `genericstable' feature.

dnl Address rewriting for outgoing messages.
dnl
dnl Rewriting the envelope-from address of all outgoing messages through a
dnl `genericstable' lookup, ensures that envelope-from addresses seen by
dnl relay hosts are real, i.e. `kera...@ceid.upatras.gr' instead of the
dnl default envelope-from of `kera...@flame.pc' that Sendmail would use.
dnl This is required some times, to avoid getting bounces for messages
dnl from ISP mail relays that are misconfigured or are too strict about
dnl what can appear in a MAIL FROM command.
dnl
FEATURE(`genericstable', `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN(`flame.pc')
FEATURE(`generics_entire_domain')

After you enable the `genericstable' feature, you have to create the file
`/etc/mail/genericstable' and map the local user addresses to what their
rewritten address should be, using something like:

# cd /etc/mail
# cat genericstable
kera...@flame.pc kera...@ceid.upatras.gr
ro...@flame.pc kera...@ceid.upatras.gr

Run the makemap(1) utility on `genericstable':

# cd /etc/mail
# makemap hash genericstable < genericstable

Install the new sendmail.cf file:

# cd /etc/mail
# make
# make install

Restart the sendmail daemons:

# cd /etc/mail
# make restart

And you should be set to go.

If you do use the `genericstable' feature, please remember to re-run
makemap(1) when you change `/etc/mail/genericstable' to update the
`genericstable.db' file.

Have fun with your new Sendmail setup,

- Giorgos

Thomas Schweikle

unread,
Feb 12, 2006, 10:01:44 AM2/12/06
to
Giorgos Keramidas wrote:
> On Sat, 11 Feb 2006 20:07:50 +0100, Thomas Schweikle <t...@vr-web.de> wrote:

Thanks for the detailed description! It was really helpful!

--
Thomas

Thomas Schweikle

unread,
Feb 12, 2006, 10:04:12 AM2/12/06
to

Just setting MASQUERADE_AS did not do the work as expected: the
envelope had the original host showing up --- but this wasn't desired.

But anyway: thanks for the Hint!

--
Thomas

Warren Block

unread,
Feb 12, 2006, 11:39:11 AM2/12/06
to

See FEATURE(`masquerade_envelope'). There are lots of other masquerade
settings also.

--
Warren Block * Rapid City, South Dakota * USA

Per Hedeland

unread,
Feb 12, 2006, 2:56:16 PM2/12/06
to
In article <868xshr...@flame.pc> Giorgos Keramidas
<kera...@ceid.upatras.gr> writes:

[snip a lot of good advice]

>Run the makemap(1) utility on `genericstable':
>
> # cd /etc/mail
> # makemap hash genericstable < genericstable

Actually, on FreeBSD, there is no need for this - a 'make' in the
/etc/mail directory will take care of it (too).

>If you do use the `genericstable' feature, please remember to re-run
>makemap(1) when you change `/etc/mail/genericstable' to update the
>`genericstable.db' file.

See above.

--Per Hedeland
p...@hedeland.org

Giorgos Keramidas

unread,
Feb 12, 2006, 8:19:48 PM2/12/06
to

Both true; thanks for the help :)

I keep forgetting if all the maps are handled in FreeBSD, because I also
use Sendmail on Solaris and other UNIX systems.

Giorgos Keramidas

unread,
Feb 12, 2006, 8:22:43 PM2/12/06
to

You also need `masquerade_envelope'. This is why I added the lines noted
with '+' below, but I didn't really make it clear why they were
there... sorry.

dnl Address masquerading.
dnl
dnl Making sure that all email that passes through my laptop's Sendmail

dnl installation is masqueraded as coming from `flame.mc', evenif its
dnl original address is something slightly different (i.e. `ftp.mc' or
dnl `mail.mc'), is ok here. It ensures that address rewriting and
dnl translation through `genericstable' will also work for all `*.mc'
dnl host names.
dnl
+ dnl To make sure that remote hosts don't get a MAIL FROM address from a
+ dnl hostname that doesn't resolve, envelope addresses are masqueraded
+ dnl too, and then get rewritten by `genericstable' to real-world
+ dnl addresses, i.e. `kera...@ceid.upatras.gr'.


MASQUERADE_AS(`flame.pc')
FEATURE(`masquerade_entire_domain')

+ FEATURE(`masquerade_envelope')

Adding the `masquerade_envelope' feature will also masquerade the
envelope-from address, which seems to be what you need to do now :)

- Giorgos

0 new messages