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

Sendmail - genericstable not working (outbound rewriting)

1,700 views
Skip to first unread message

Ewald Jenisch

unread,
Mar 10, 2003, 3:35:41 AM3/10/03
to
Hi,


I want to rewrite outgoing email. To be specific email coming from user
"ej" should be rewritten to say "Ewald....@ooo.at". However things
don't work as expected.:-(

First, here's what I've got:

1) Sendmail 8.12.8

2) My local machine is "mymachine.ooo.co.at" (incl. corresponing DNS A-,
PTR-record)

3) /etc/genericstable:
ej Ewald....@ooo.at

4) my ".mc"-file:
divert(-1)
# comments
OSTYPE(linux)dnl
define(`SMART_HOST',`mailrelay1.ooo.co.at')dnl
FEATURE(`genericstable')dnl
FEATURE(virtusertable,`hash -o /etc/mail/virtusertable')dnl
FEATURE(local_procmail,/usr/bin/procmail)dnl
FEATURE(`access_db')dnl
FEATURE(`always_add_domain')dnl
FEATURE(masquerade_envelope)dnl
MAILER(local)dnl
MAILER(smtp)dnl

5) My sendmail.cf (built by m4/Build) then has this (excerpts):

Cwlocalhost
# Generics table (mapping outgoing addresses)
Kgenerics hash /etc/mail/genericstable
# Virtual user table (maps incoming users)
Kvirtuser hash -o /etc/mail/virtusertable


However when I send email from user "ej" (e.g. via the normal "mail"
command) "from:" ends up in "e...@mymachine.ooo.co.at instead of being
rewritten to "Ewald....@ooo.at" :-(

Next I tried with "sendmail -bt" to test what's going on: (see "Virtunal
Hosting with Sendmail" on sendmail.org)

# sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> $=w
mymachine
mymachine.ooo
mymachine.ooo.co.at
localhost.localdomain
localhost
[localhost.localdomain]
[192.168.219.219]
[127.0.0.1]
> /map generics ej
map_lookup: generics (ej) returns Ewald....@ooo.at (0)
>

So to me it looks like the address is very well expanded - however when
I send email it isn't :-(.

I've also checked permissions of /etc/mail/*.db - and have set them 644
in order to have them readable by everyone - didn't help either. Email
from "ej" still comes out as "e...@mymachine.ooo.co.at"


So here are my questions:

1) What's wrong with my outbound-rewriting-setup? Anything needed
besides "genericstable" in my setup?

2) What are the correct permissions for all the *.db-files in /etc/mail?
Must they really be 644?


Thanks much in advance for any clue
-ewald

Andrzej Filip

unread,
Mar 10, 2003, 7:24:51 AM3/10/03
to

You have not used GENERICS_DOMAIN_FILE

http://www.sendmail.org/virtual-hosting.html
Points 6 & 7

> 2) What are the correct permissions for all the *.db-files in /etc/mail?
> Must they really be 644?

NO

--
Andrzej [pl>en: Andrew] Adam Filip http://www.polbox.com/a/anfi/

Ewald Jenisch

unread,
Mar 11, 2003, 5:02:10 AM3/11/03
to
Andrzej Filip wrote:

>> 1) What's wrong with my outbound-rewriting-setup? Anything needed
>> besides "genericstable" in my setup?
>
>
> You have not used GENERICS_DOMAIN_FILE
>

Hi all,

I did as you wrote (see http://www.sendmail.org/virtual-hosting.html pts
6+7).


Now I've got the generics_domain_file in place:
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
and
[root@aurora mail]# ls -l generics-domains
-rw-r--r-- 1 root root 19 Mar 11 10:16 generics-domains
[root@aurora mail]#

which is:

[root@aurora mail]# cat generics-domains
ooo.at
ooo.co.at
[root@aurora mail]#


Still however it doesn't work - when sending mail from user "ej" still
the email comes from "e...@aurora.ooo.co.at" :-(

I've again done a check with sendmail -bt and here the rewriting seems
to take place:

[root@aurora mail]# sendmail -bt


ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>

> /tryflags s
> /try smtp ej
Trying envelope sender address ej for mailer smtp
canonify input: ej
Canonify2 input: ej
Canonify2 returns: ej
canonify returns: ej
1 input: ej
1 returns: ej
EnvFromSMTP input: ej
PseudoToReal input: ej
PseudoToReal returns: ej
MasqSMTP input: ej
MasqSMTP returns: ej < @ *LOCAL* >
MasqEnv input: ej < @ *LOCAL* >
MasqHdr input: ej < @ *LOCAL* >
canonify input: Ewald . Jenisch @ ooo . at
Canonify2 input: Ewald . Jenisch < @ ooo . at >
Canonify2 returns: Ewald . Jenisch < @ ooo . at . >
canonify returns: Ewald . Jenisch < @ ooo . at . >
MasqHdr returns: Ewald . Jenisch < @ ooo . at . >
MasqEnv returns: Ewald . Jenisch < @ ooo . at . >
EnvFromSMTP returns: Ewald . Jenisch < @ ooo . at . >
final input: Ewald . Jenisch < @ ooo . at . >
final returns: Ewald . Jenisch @ ooo . at
Rcode = 0, addr = Ewald....@ooo.at
>


I even tried this in my .mc-file

LOCAL_DOMAIN(`ooo.co.at ooo.at')dnl

Didn't change anything :-(


So the situation is:

o) when running sendmail -bt local "ej" correctly becomes
"ewald....@ooo.at"

o) when sending email from user "ej" it has "e...@aurora.ooo.co.at" as
sender-address

Any idea what could be wrong here?

Any additional debug,...-flags that might help in finding out what's
going on here?

Thanks much in advance for any clue,
-ewald

Andrzej Filip

unread,
Mar 11, 2003, 1:56:03 PM3/11/03
to
> [...]

> final returns: Ewald . Jenisch @ ooo . at
> Rcode = 0, addr = Ewald....@ooo.at
>
> I even tried this in my .mc-file
>
> LOCAL_DOMAIN(`ooo.co.at ooo.at')dnl
>
> Didn't change anything :-(
>
>
> So the situation is:
>
> o) when running sendmail -bt local "ej" correctly becomes
> "ewald....@ooo.at"
>
> o) when sending email from user "ej" it has "e...@aurora.ooo.co.at" as
> sender-address
>
> Any idea what could be wrong here?
>
> Any additional debug,...-flags that might help in finding out what's
> going on here?

Standard question: have you restarted sendmail daemon ?
[another way is to send HUP signal ]
The daemon remembers sendmail.cf as it was when the daemon was started.

--
Andrzej [pl>en: Andrew] Adam Filip http://www.polbox.com/a/anfi/

*Random epigram* :
A man can have two, maybe three love affairs while he's married. After
that it's cheating.
-- Yves Montand

Per Hedeland

unread,
Mar 11, 2003, 5:11:10 PM3/11/03
to
In article <3E6DB422...@jenisch.at> Ewald Jenisch <a...@jenisch.at> writes:
>Andrzej Filip wrote:
>
>>> 1) What's wrong with my outbound-rewriting-setup? Anything needed
>>> besides "genericstable" in my setup?
>>
>>
>> You have not used GENERICS_DOMAIN_FILE
>>
>
>Hi all,
>
>I did as you wrote (see http://www.sendmail.org/virtual-hosting.html pts
>6+7).
>
>
>Now I've got the generics_domain_file in place:
>GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
>and
>[root@aurora mail]# ls -l generics-domains
>-rw-r--r-- 1 root root 19 Mar 11 10:16 generics-domains
>[root@aurora mail]#
>
>which is:
>
>[root@aurora mail]# cat generics-domains
>ooo.at
>ooo.co.at
>[root@aurora mail]#
>
>
>Still however it doesn't work - when sending mail from user "ej" still
>the email comes from "e...@aurora.ooo.co.at" :-(

The generics-domains file should list the domains that you want
genericstable to apply to (of course). Try adding aurora.ooo.co.at to it.

>I've again done a check with sendmail -bt and here the rewriting seems
>to take place:
>
>[root@aurora mail]# sendmail -bt
>ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
>Enter <ruleset> <address>
> > /tryflags s
> > /try smtp ej

To verify the above:

> /try smtp e...@aurora.ooo.co.at

Depending on your MUA, it may pass the sender address to sendmail as
just "ej" or "e...@aurora.ooo.co.at" (or something else that the user has
configured).

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

Ewald Jenisch

unread,
Mar 12, 2003, 10:02:58 AM3/12/03
to
>
> The generics-domains file should list the domains that you want
> genericstable to apply to (of course). Try adding aurora.ooo.co.at to it.
>

This was in err! Thanks much for the tip. I've added my local hostname
to the file and - bingo - it works like a charm.

Thanks to you all for your help!

-ewald

0 new messages