Want unqualified domain

Want unqualified domain

am 18.04.2008 18:19:49 von Tiaan van Aardt

Hi,

I'm trying to figure out how to convince sendmail to NOT qualify the
domain I'm sending to.

It's for an internal system (i.e. won't go out to the internet) that
cannot parse mail with a FQDN attached in the "To:" field.

Something tells me I should look at where $j is being added in the .cf
file (both submit.cf and sendmail.cf), but having modified/removed every
single instance of $j, the FQDN still gets added to the "To:" header.

Example:

I'm sending to person1234@blah.domain.com (sent directly by invoking
sendmail -f).

Currently sendmail adds the header "To: person1234@blah.domain.com" to
the message, but I only want "To: person1234".

Anybody have any ideas?

Thanks,
-Tiaan.

Re: Want unqualified domain

am 19.04.2008 02:17:14 von Bill Cole

In article ,
Tiaan van Aardt wrote:

> Hi,
>
> I'm trying to figure out how to convince sendmail to NOT qualify the
> domain I'm sending to.
>
> It's for an internal system (i.e. won't go out to the internet) that
> cannot parse mail with a FQDN attached in the "To:" field.

This implies that it is qualifying local addresses with a domain that it
does not recognize as local, which is something I cannot think of a way
to do, since it should be using $j for the qualification and should
always recognize user@$j as local.


> Something tells me I should look at where $j is being added in the .cf
> file (both submit.cf and sendmail.cf), but having modified/removed every
> single instance of $j, the FQDN still gets added to the "To:" header.

It is usually a far better idea to use the m4 build system and .mc files
rather than to hand-modify .cf files. The more you screw around in the
..cf files, the harder it will be when you come back a year later needing
some new minor tweak that interacts with your adjustments.

Using the .mc files also makes it possible for you to share something
that is broadly comprehensible when you are seeking help from the wider
world. As it is, people reading your post can only guess what your
actual configuration is. Posting a hand-modified .cf would not help
much, but posting a .mc from which your .cf is bhuilt would.

> Example:
>
> I'm sending to person1234@blah.domain.com (sent directly by invoking
> sendmail -f).
>
> Currently sendmail adds the header "To: person1234@blah.domain.com" to
> the message, but I only want "To: person1234".
>
> Anybody have any ideas?

The above does not make sense. Are you trying to get sendmail to strip
off the domain you say you are using when sending the mail?

What exactly is your sendmail command line? The -f flag isn't really
relevant, and your description of what is happening does not match
normal sendmail behavior.

--
Now where did I hide that website...

Re: Want unqualified domain

am 21.04.2008 10:58:00 von Tiaan van Aardt

Hi,

Bill Cole wrote:

> It is usually a far better idea to use the m4 build system and .mc
> files rather than to hand-modify .cf files. The more you screw around
> in the .cf files, the harder it will be when you come back a year
> later needing some new minor tweak that interacts with your
> adjustments.

Agreed - The info I was getting from Google involved direct edits. I was
(and still am) not sure how to begin addressing the issue using the m4
build files.

> Posting a hand-modified .cf would not help much, but posting a .mc
> from which your .cf is bhuilt would.

The .mc I'm using at the moment is part of the slackware distribution so
it's pretty close to normal. Here are links to the ones I'm using right now:

submit.mc:
http://pastebin.com/m1c8394bc

sendmail.mc:
http://pastebin.com/m7e13fce7

>> Currently sendmail adds the header "To: person1234@blah.domain.com"
>> to the message, but I only want "To: person1234".

> The above does not make sense. Are you trying to get sendmail to
> strip off the domain you say you are using when sending the mail?

I have a machine called foo.mydomain.com. I submit a message like this:

/usr/sbin/sendmail -f 'sourceaddr/SERVER' 'destaddr@bar.mydomain.com'

The content is piped via stdin and only the following headers are supplied:

---snip---
Date: Mon, 21 Apr 2008 08:38:52 GMT
From: vsmsc/TYPE=PLMN
Subject: test MMS
To: destaddr
Message-ID: foo.mydomain.com-qf136-7132.1.x830.79
MIME-Version: 1.0
Content-Type: multipart/related;
boundary=_boundary_1135458692_1208767134_D_f_bd1984393562
Sender: sourceaddr/SERVER

--_boundary_1135458692_1208767134_D_f_bd1984393562
Content-Disposition: attachment; filename="Logo.gif"
....etc


---snip---

When doing a tcpdump on the wire to the other server, the message is
sent out exactly the same, except that the "To:" and "From:" field is
now fully qualified with "destaddr@bar.mydomain.com" and
"sourceaddr/SERVER@foo.mydomain.com".

How can I prevent these fields from becoming fully qualified? (in other
words, I don't want sendmail to touch the "To:" and "From:" fields).

Thanks!
Tiaan.

Re: Want unqualified domain

am 21.04.2008 15:36:40 von Bill Cole

In article <480C5718.7050109@wantnospam.truteq.com>,
Tiaan van Aardt wrote:

> Hi,
>
> Bill Cole wrote:
>
> > It is usually a far better idea to use the m4 build system and .mc
> > files rather than to hand-modify .cf files. The more you screw around
> > in the .cf files, the harder it will be when you come back a year
> > later needing some new minor tweak that interacts with your
> > adjustments.
>
> Agreed - The info I was getting from Google involved direct edits. I was
> (and still am) not sure how to begin addressing the issue using the m4
> build files.
>
> > Posting a hand-modified .cf would not help much, but posting a .mc
> > from which your .cf is bhuilt would.
>
> The .mc I'm using at the moment is part of the slackware distribution so
> it's pretty close to normal. Here are links to the ones I'm using right now:
>
> submit.mc:
> http://pastebin.com/m1c8394bc
>
> sendmail.mc:
> http://pastebin.com/m7e13fce7
>
> >> Currently sendmail adds the header "To: person1234@blah.domain.com"
> >> to the message, but I only want "To: person1234".

Your sendmail.mc has:

FEATURE(`always_add_domain')dnl

Guess what that does?

--
Now where did I hide that website...

Re: Want unqualified domain

am 22.04.2008 01:04:47 von Tiaan van Aardt

Hi again,

Bill Cole wrote:

> Your sendmail.mc has:
>
> FEATURE(`always_add_domain')dnl
>
> Guess what that does?

It does seem a logical option to remove! :-) However, removing that
option from sendmail.mc, doing a ./Build and copying the resulting
sendmail.cf file to /etc/mail and restarting sendmail did not change
it's behaviour.

It still adds the FQDN to both the To: and From: fields in the body.

I note that there's no such option in submit.mc - is this not where my
troubles lie?

(I checked that the correct .cf file is being processed by also adding a
greet-pause option which resulted in the expected delay when telnetting
to port 25).

Regards,
-Tiaan.

Re: Want unqualified domain

am 22.04.2008 20:09:55 von unknown

Post removed (X-No-Archive: yes)

Re: Want unqualified domain

am 23.04.2008 00:57:47 von Tiaan van Aardt

Hi,

Bill Cole wrote:

> FEATURE(`always_add_domain')dnl

I did some more testing and I don't understand what's happening.
Removing the above feature makes absolutely no difference:

---snip---
root@foo:~# sendmail -f 'root@foo.domain.co.za' 'tva@foo.domain.co.za'
From: hooligan
To: tva
Subject: test3

hello3

..
---snip---

Examining the /var/spool/mail/tva file reveals the following:

---snip---
From root@foo.domain.co.za Wed Apr 23 00:32:28 2008
Return-Path:
Received: from foo.domain.co.za (localhost [127.0.0.1])
by foo.domain.co.za (8.13.4/8.13.4) with ESMTP id m3MMWSwA000690
for ; Wed, 23 Apr 2008 00:32:28 +0200
Received: (from root@localhost)
by foo.domain.co.za (8.13.4/8.13.4/Submit) id m3MMVte6000651
for tva@foo.domain.co.za; Wed, 23 Apr 2008 00:31:55 +0200
Date: Wed, 23 Apr 2008 00:31:55 +0200
Message-Id: <200804222231.m3MMVte6000651@foo.domain.co.za>
From: hooligan@foo.domain.co.za
To: tva@foo.domain.co.za
Subject: test3

hello3
---snip---


The same happens for a delivery to a non-local machine (eg.
bar.domain.co.za).

A diff between a .cf file without and with the feature shows the following:

---snip---
> R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
> R$+ $@ $1 < @ *LOCAL* > add local qualification
---snip---


I've gone through all the features listed here:
http://www.sendmail.org/m4/features.html

But I can't see any other feature to control qualifying of the domain.

Is sendmail.cf used with local mail delivery?

Tiaan.

Re: Want unqualified domain

am 24.04.2008 13:35:42 von Tiaan van Aardt

Hi Ralf,

Ralf Döblitz wrote:

>> It still adds the FQDN to both the To: and From: fields in the body.

> Try
> FEATURE(`nocanonify')dnl
> to disable canonification of hostnames.

Thanks for the suggestion, but the result is still the same. It seems
that there is not really a way of controlling when the domain gets added
in the .mc file.

I've had better success modifying the .cf file directly and removing the
$j directive in some of the lines of the .cf file. I am not sure what I
am doing and I don't really know how it works, but I have managed to get
the domains removed, although I'm still stuck with and "@." like this:

From: foo@.
To: bar@.

Anybody know how to get those last bits removed?

Regards,
-Tiaan.

Re: Want unqualified domain

am 24.04.2008 15:56:07 von Tiaan van Aardt

> From: foo@.
> To: bar@.

I managed to get it configured correctly. It involved a substantial
amount of changes to the sendmail.cf and submit.cf files.:

Here's what was removed from sendmail.cf:
-----------------------------------------
688,690c688,690
< R$* < @ localhost > $* $: $1 < @ $j . > $2
no domain at all
< R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
< R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
---
> R$* < @ localhost > $* $: $1 < @ . > $2
no domain at all
> R$* < @ localhost . $m > $* $: $1 < @ . > $2 local
domain
> R$* < @ localhost . UUCP > $* $: $1 < @ . > $2 .UUCP
domain
694c694
< R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
---
> R$* < @@ $=w > $* $: $1 < @ . > $3
self-literal
735c735
< R$* < @ *LOCAL* > $* $1 < @ $j > $2
---
> R$* < @ *LOCAL* > $* $1 < @ > $2
974c974
< R$* < @ *LOCAL* > $@ $1 < @ $j . >
---
> R$* < @ *LOCAL* > $@ $1 < @ . >
981c981
< R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
---
> R$* < @ *LOCAL* > $* $: $1 < @ . > $2
1704,1705d1703
< R$+ $: $>AddDomain $1 add local domain if needed
< R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1713d1710
< R$+ $@ $1 < @ *LOCAL* > add local qualification
1733d1729
< R$+ $@ $1 < @ *LOCAL* > add local
qualification
1764d1759
< R$* $: $>MasqSMTP $1 qualify
unqual'ed names
1774,1775c1769
< R$+ $: $>MasqSMTP $1 qualify
unqual'ed names
< R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
---
> R$* < @ *LOCAL* > $* $: $1 < @ . > $2
1787d1780
< R$* $: $>MasqSMTP $1 qualify
unqual'ed names


Here's what was removed from submit.cf:
---------------------------------------
1319,1320c1319,1320
< R$+ $: $>AddDomain $1 add local domain if needed
< R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
---
> #R$+ $: $>AddDomain $1 add local domain if needed
> #R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
1345c1345
< R$+ $@ $1 < @ *LOCAL* > add local
qualification
---
> #R$+ $@ $1 < @ *LOCAL* > add local
qualification
1398c1398
< R< @ $* > $* $@ < @ $1 > $2 pass route-addr
through
---
> #R< @ $* > $* $@ < @ $1 > $2 pass route-addr
through


So it all had to do with qualification (all over the place) and the
Masquerading.

Thanks to all who offered suggestions!

Tiaan.