Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #412: Radial Telemetry Infiltration


comp / comp.mail.sendmail / How to know local IP on which mail was received on

SubjectAuthor
* How to know local IP on which mail was received onAMM
`* Re: How to know local IP on which mail was received onClaus Aßmann
 `* Re: How to know local IP on which mail was received onAMM
  `* Re: How to know local IP on which mail was received onClaus Aßmann
   `- Re: How to know local IP on which mail was received onGrant Taylor

1
Subject: How to know local IP on which mail was received on
From: AMM
Newsgroups: comp.mail.sendmail
Organization: A noiseless patient Spider
Date: Wed, 11 Dec 2024 05:29 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anon.amish@gmail.com (AMM)
Newsgroups: comp.mail.sendmail
Subject: How to know local IP on which mail was received on
Date: Wed, 11 Dec 2024 10:59:30 +0530
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <vjb7vq$1d3e2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Dec 2024 06:30:00 +0100 (CET)
Injection-Info: dont-email.me; posting-host="776ffbd3c8f26c25077b1d1a2fe4ef95";
logging-data="1478082"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/82f9tfFAPiuuzjGRocXvQyI8gWW2Xaec="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:5+mYKgKFR0kQkKbjWWR6hY28Sxk=
Content-Language: en-US
View all headers

Hello

So I have two IPs configured on my mail server (acting as MX for my domain).

Say public IPs are 1.2.3.4 (eth1) and 5.6.7.8 (eth2)

When I receive email, system logs sender IP but does not log on what IP
the email was received on.

Log line looks like this:

Dec 11 08:26:48 foo1 sm-mta[1707322]: STARTTLS=server,
relay=mail-ed1-f41.google.com [209.85.208.41], version=TLSv1.3,
verify=NOT, cipher=TLS_AES_256_GCM_SHA384, bits=256/256

How do I know if email came on 1.2.3.4 (eth1) or 5.6.7.8 (eth2)?

I want to debug some issue which requires to know local IP the email
came on.

Please do let me know, how to check the same.

Thank you,

AMM

Subject: Re: How to know local IP on which mail was received on
From: Claus Aßmann
Newsgroups: comp.mail.sendmail
Organization: MGT Consulting
Date: Wed, 11 Dec 2024 06:31 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!panix!weretis.net!feeder9.news.weretis.net!news.misty.com!.POSTED.veps.esmtp.org!not-for-mail
From: INVALID_NO_CC_REMOVE_IF_YOU_DO_NOT_POST_ml+sendmail(-no-copies-please)@esmtp.org (Claus Aßmann)
Newsgroups: comp.mail.sendmail
Subject: Re: How to know local IP on which mail was received on
Date: Wed, 11 Dec 2024 01:31:39 -0500 (EST)
Organization: MGT Consulting
Sender: <ml+sendmail(-no-copies-please)@esmtp.org>
Message-ID: <vjbbkb$pgt$1@news.misty.com>
References: <vjb7vq$1d3e2$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 11 Dec 2024 06:31:39 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="veps.esmtp.org:155.138.203.148";
logging-data="26141"; mail-complaints-to="abuse@misty.com"
Mail-Copies-To: never
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: ca@x2.esmtp.org (Claus Assmann)
View all headers

AMM wrote:

> How do I know if email came on 1.2.3.4 (eth1) or 5.6.7.8 (eth2)?

What do you currently use for DaemonPortOptions?

you could use multiple DaemonPortOptions and specify
Name User-definable name for the daemon (defaults to "Daemon#")
Addr Address mask (defaults INADDR_ANY)

see doc/op/op.*

Or you could add some custom log entry via a ruleset
using the syslog map and log
${daemon_addr}
The IP address the daemon is listening on for connections.
together with the queue id.

--
Note: please read the netiquette before posting. I will almost never
reply to top-postings which include a full copy of the previous
article(s) at the end because it's annoying, shows that the poster
is too lazy to trim his article, and it's wasting the time of all readers.

Subject: Re: How to know local IP on which mail was received on
From: AMM
Newsgroups: comp.mail.sendmail
Organization: A noiseless patient Spider
Date: Wed, 11 Dec 2024 13:55 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anon.amish@gmail.com (AMM)
Newsgroups: comp.mail.sendmail
Subject: Re: How to know local IP on which mail was received on
Date: Wed, 11 Dec 2024 19:25:21 +0530
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <vjc5l8$1ik53$1@dont-email.me>
References: <vjb7vq$1d3e2$1@dont-email.me> <vjbbkb$pgt$1@news.misty.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 11 Dec 2024 14:55:52 +0100 (CET)
Injection-Info: dont-email.me; posting-host="776ffbd3c8f26c25077b1d1a2fe4ef95";
logging-data="1659043"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pB34eEqeNBlG1eN8YSrZ8fm6mQMDYulM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:RRTJ16NKkBAQLLYhtSXaSBxhft8=
In-Reply-To: <vjbbkb$pgt$1@news.misty.com>
Content-Language: en-US
View all headers

On 11/12/24 12:01 pm, Claus Aßmann wrote:
> AMM wrote:
>
> What do you currently use for DaemonPortOptions?
> you could use multiple DaemonPortOptions and specify
> Name User-definable name for the daemon (defaults to "Daemon#")
> Addr Address mask (defaults INADDR_ANY)
>
> see doc/op/op.*

O DaemonPortOptions=Name=MTA-v4, Family=inet

I do not want to change INADDR_ANY because I use standard sendmail.mc
for many mail servers and do not want to customize it for each server.

> Or you could add some custom log entry via a ruleset
> using the syslog map and log
> ${daemon_addr}
> The IP address the daemon is listening on for connections.
> together with the queue id.

Can you provide more help with this? I could not find much help in
doc/op/op.*

I would like change log entry at two places in syslog (systemd journal)

I want to change log entry:
Dec 11 08:26:43 foo1 sm-mta[1707322]: NOQUEUE: connect from
mail-ed1-f41.google.com [209.85.208.41]

to:
Dec 11 08:26:43 foo1 sm-mta[1707322]: NOQUEUE: connect from
mail-ed1-f41.google.com [209.85.208.41] on [1.2.3.4]

And another log entry:
Dec 11 08:26:51 foo1 sm-mta[1707322]: 4AA2uhPr123456:
from=<foo@gmail.com>, size=27668, class=0, nrcpts=1, msgid=<...>,
proto=ESMTPS, daemon=MTA-v4, relay=mail-ed1-f41.google.com [209.85.208.41]

to:
Dec 11 08:26:51 foo1 sm-mta[1707322]: 4AA2uhPr123456:
from=<foo@gmail.com>, size=27668, class=0, nrcpts=1, msgid=<...>,
proto=ESMTPS, daemon=MTA-v4, relay=mail-ed1-f41.google.com
[209.85.208.41], daemonaddr=[1.2.3.4]

Can this be made the default in future versions of sendmail, as in my
opinion it is an important piece of information to detect connection issues.

OR can the logging be made easier without touching / modifying ruleset?

Thank you and regards

AMM

Subject: Re: How to know local IP on which mail was received on
From: Claus Aßmann
Newsgroups: comp.mail.sendmail
Organization: MGT Consulting
Date: Wed, 11 Dec 2024 19:45 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.quux.org!weretis.net!feeder9.news.weretis.net!news.misty.com!.POSTED.veps.esmtp.org!not-for-mail
From: INVALID_NO_CC_REMOVE_IF_YOU_DO_NOT_POST_ml+sendmail(-no-copies-please)@esmtp.org (Claus Aßmann)
Newsgroups: comp.mail.sendmail
Subject: Re: How to know local IP on which mail was received on
Date: Wed, 11 Dec 2024 14:45:05 -0500 (EST)
Organization: MGT Consulting
Sender: <ml+sendmail(-no-copies-please)@esmtp.org>
Message-ID: <vjcq41$hkp$1@news.misty.com>
References: <vjb7vq$1d3e2$1@dont-email.me> <vjbbkb$pgt$1@news.misty.com> <vjc5l8$1ik53$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 11 Dec 2024 19:45:05 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="veps.esmtp.org:155.138.203.148";
logging-data="18073"; mail-complaints-to="abuse@misty.com"
Mail-Copies-To: never
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: ca@x2.esmtp.org (Claus Assmann)
View all headers

AMM wrote:

> > Or you could add some custom log entry via a ruleset

> Can you provide more help with this? I could not find much help in
> doc/op/op.*

"It's complicated" - you could do some online search for this.
Here's something completely untested:
Klog syslog
SLocal_check_relay
R$+ $| $+ $: $(log daemon_addr=$&{daemon_addr} $)

> I would like change log entry at two places in syslog (systemd journal)

Logging from the binary would need code changes.

> Can this be made the default in future versions of sendmail, as in my
> opinion it is an important piece of information to detect connection issues.

The simplest approach is to use multiple DaemonPortOptions,
anything else is (significantly) more complicated.
It shouldn't be hard to write a script which takes the local
network configuration and creates the proper mc entries.

> OR can the logging be made easier without touching / modifying ruleset?

No - see above: code or ruleset.

--
Note: please read the netiquette before posting. I will almost never
reply to top-postings which include a full copy of the previous
article(s) at the end because it's annoying, shows that the poster
is too lazy to trim his article, and it's wasting the time of all readers.

Subject: Re: How to know local IP on which mail was received on
From: Grant Taylor
Newsgroups: comp.mail.sendmail
Organization: TNet Consulting
Date: Thu, 12 Dec 2024 03:13 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.198.18.1.11!not-for-mail
From: gtaylor@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.mail.sendmail
Subject: Re: How to know local IP on which mail was received on
Date: Wed, 11 Dec 2024 21:13:47 -0600
Organization: TNet Consulting
Message-ID: <vjdkdb$89l$1@tncsrv09.home.tnetconsulting.net>
References: <vjb7vq$1d3e2$1@dont-email.me> <vjbbkb$pgt$1@news.misty.com>
<vjc5l8$1ik53$1@dont-email.me> <vjcq41$hkp$1@news.misty.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 12 Dec 2024 03:13:47 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="198.18.1.11";
logging-data="8501"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <vjcq41$hkp$1@news.misty.com>
View all headers

On 12/11/24 13:45, Claus Aßmann wrote:
> The simplest approach is to use multiple DaemonPortOptions, anything
> else is (significantly) more complicated.

That's what I do.

Though I do wonder if it might be possible to have an abstraction
hostname that is referenced via /etc/hosts on each system.

Presuming that all systems had two IPs and that there is a way to use a
name abstraction; maybe something like this:

DAEMON_OPTIONS(`Family=inet, Address=ip-place-holder-A,
Name=MTA-v4-IP-A')dnl
DAEMON_OPTIONS(`Family=inet, Address=ip-place-holder-B,
Name=MTA-v4-IP-B')dnl

Then have entries like the following in the /etc/hosts file on host1

192.0.2.11 ip-place-holder-A
192.0.2.12 ip-place-holder-B

And similar entries in the /etc/hosts file on host2

192.0.2.21 ip-place-holder-A
192.0.2.22 ip-place-holder-B

This is predicated on if ip-place-holder-A type thing would work in the
config. I don't know.

I've presented the mc (m4) syntax which provides some flexibility to do
some interpretation when compiling the mc (m4) into the cf file. As in
I think you could get m4 to run commands and extract the necessary
information to place in the compiled cf output.

If you do this in the cf file directly, it would be predicated on if if
Sendmail will resolve a hostname in this type of situation or not. I
don't know of this is possible or not.

Both of these would be a change from the current configuration. But
name resolution would allow consistent config files across multiple
systems with the differences being contained in the /etc/hosts file
which already probably has some host specific things like loghost, etc.

--
Grant. . . .

1

rocksolid light 0.9.8
clearnet tor