Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

No more blah, blah, blah! -- Kirk, "Miri", stardate 2713.6


computers / comp.mail.sendmail / Re: Using sendmail as front end for cloud M365: access control

SubjectAuthor
* Using sendmail as front end for cloud M365: access controlOtto J. Makela
+* Re: Using sendmail as front end for cloud M365: access controlMarco Moock
|`- Re: Using sendmail as front end for cloud M365: access controlOtto J. Makela
+- Re: Using sendmail as front end for cloud M365: access controlJ.O. Aho
`- Re: Using sendmail as front end for cloud M365: access controlClaus Aßmann

1
Using sendmail as front end for cloud M365: access control

<87o7thn3nz.fsf@tigger.extechop.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=637&group=comp.mail.sendmail#637

  copy link   Newsgroups: comp.mail.sendmail
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: om...@iki.fi (Otto J. Makela)
Newsgroups: comp.mail.sendmail
Subject: Using sendmail as front end for cloud M365: access control
Date: Tue, 08 Nov 2022 12:25:52 +0200
Organization: Games and Theory
Lines: 31
Message-ID: <87o7thn3nz.fsf@tigger.extechop.net>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="82aa3e6f59f378c8cb90e2ea89d569c0";
logging-data="4089193"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/u46b7GC1qGSyQfC9V7lp5"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:u9zVgvZxzmr+oxkMs7sbc++xZV4=
sha1:niqVDlOz6lvvYSGkzy+/9NBLxNo=
X-Face: 'g'S,X"!c;\pfvl4ljdcm?cDdk<-Z;`x5;YJPI-cs~D%;_<\V3!3GCims?a*;~u$<FYl@"E
c?3?_J+Zwn~{$8<iEy}EqIn_08"`oWuqO$#(5y3hGq8}BG#sag{BL)u8(c^Lu;*{8+'Z-k\?k09ILS
Mail-Copies-To: never
X-URL: http://www.iki.fi/om/
 by: Otto J. Makela - Tue, 8 Nov 2022 10:25 UTC

I have a situation where I need to use our sendmail-based frontend
(authoritive to our domains) to relay outgoing emails originating from
cloud-based M365 mailbox servers. In practice this means that the
sendmail installation needs to accept incoming emails originating from
rather large swathes of Microsoft net space and forward them onwards to
their final recepients.

Unfortunately M365 does not seem to support any (standard) method of
authentication for the outgoing mail server, it's a direct connection to
port 25 and that's pretty much it. Color me surprised.

Parking an email domain on the M365 system involves some verification
steps (including checking that the domain has not already been
registered), so ostensibly nobody else would be able to send out emails
from there using our domain(s).

However, in theory it would be possible that a spammer operation could
set up their own domain on M365 and configure it to use our outgoing
email server, as my only access control currently is the IP netblocks.
This could be prevented if I only accepted from those neblocks emails
that also originate from our own domain(s).

Before this, I've never had the need to combine IP address + originating
email address checks on sendmail, and my google-fu just isn't sufficient
here. How would one typically do this kind of limitations?

--
/* * * Otto J. Makela <om@iki.fi> * * * * * * * * * */
/* Phone: +358 40 765 5772, ICBM: N 60 10' E 24 55' */
/* Mail: Mechelininkatu 26 B 27, FI-00100 Helsinki */
/* * * Computers Rule 01001111 01001011 * * * * * * */

Re: Using sendmail as front end for cloud M365: access control

<tkdc26$3rj4f$14@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=638&group=comp.mail.sendmail#638

  copy link   Newsgroups: comp.mail.sendmail
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: mo0...@posteo.de (Marco Moock)
Newsgroups: comp.mail.sendmail
Subject: Re: Using sendmail as front end for cloud M365: access control
Date: Tue, 8 Nov 2022 11:46:30 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tkdc26$3rj4f$14@dont-email.me>
References: <87o7thn3nz.fsf@tigger.extechop.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 8 Nov 2022 10:46:30 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="96979fdac1d57269d41de9c0b9a1d287";
logging-data="4050063"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+z32B+WCGl78Vd0vi6SKn3"
Cancel-Lock: sha1:bEEhqdkNC5ViMeXbpZeF8dJHTig=
 by: Marco Moock - Tue, 8 Nov 2022 10:46 UTC

Am 08.11.2022 um 12:25:52 Uhr schrieb Otto J. Makela:

> However, in theory it would be possible that a spammer operation could
> set up their own domain on M365 and configure it to use our outgoing
> email server, as my only access control currently is the IP netblocks.
> This could be prevented if I only accepted from those neblocks emails
> that also originate from our own domain(s).

And that isn't sufficient because the attacker could (if MS allows it)
set the MAIL FROM: to whatever they want.

They only way to avoid this is to use auth or make sure your mails come
from IP addresses that are only assigned to you and can't be used by
anybody else.

With IPv6 this should be possible if MS provides such a service.

Re: Using sendmail as front end for cloud M365: access control

<jsv2esFj32gU2@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=639&group=comp.mail.sendmail#639

  copy link   Newsgroups: comp.mail.sendmail
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: use...@example.net (J.O. Aho)
Newsgroups: comp.mail.sendmail
Subject: Re: Using sendmail as front end for cloud M365: access control
Date: Tue, 8 Nov 2022 14:04:28 +0100
Lines: 38
Message-ID: <jsv2esFj32gU2@mid.individual.net>
References: <87o7thn3nz.fsf@tigger.extechop.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net PRLbNVJ6jSDU6YMRba0ecA7xzH27j4zlTKyiijKWDQwogXK2vM
Cancel-Lock: sha1:Mx+sd5BTLq2+RnvB1UCxg0y8ma0=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Content-Language: en-US-large
In-Reply-To: <87o7thn3nz.fsf@tigger.extechop.net>
 by: J.O. Aho - Tue, 8 Nov 2022 13:04 UTC

On 08/11/2022 11.25, Otto J. Makela wrote:
> Unfortunately M365 does not seem to support any (standard) method of
> authentication for the outgoing mail server, it's a direct connection to
> port 25 and that's pretty much it. Color me surprised.
>
> However, in theory it would be possible that a spammer operation could
> set up their own domain on M365 and configure it to use our outgoing
> email server, as my only access control currently is the IP netblocks.
> This could be prevented if I only accepted from those neblocks emails
> that also originate from our own domain(s).

I would have looked at using dkim to verify if the mail is from an
authenticated sender from your mail domain, you would first need to
enable dkim in ms365
https://learn.microsoft.com/en-us/microsoft-365/security/office-365-security/use-dkim-to-validate-outbound-email?view=o365-worldwide

Then the sendmail would need to use mimedefang (or something similar) to
filter mail, only allow mail that has a valid dkim and it's from your
domain. Even if someone else would fake your domain, they will still
need to have the private key to sign the dkim, which I would assume they
don't and those do not have a valid dkim.

Of course things feels a bit brittle, a small error and anyone would be
able to user your sendmail as open relay.

I have no experience of this at all, just something that felt more
secure than allowing a big span of ip's.

Not sure about the ms-365 connectors, it looks like you could have one
from ms-365 to your sendmail, not sure if this will include outgoing
mail or not.
https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/use-connectors-to-configure-mail-flow/set-up-connectors-to-route-mail

--

//Aho

Re: Using sendmail as front end for cloud M365: access control

<87k045mrt0.fsf@tigger.extechop.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=640&group=comp.mail.sendmail#640

  copy link   Newsgroups: comp.mail.sendmail
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: om...@iki.fi (Otto J. Makela)
Newsgroups: comp.mail.sendmail
Subject: Re: Using sendmail as front end for cloud M365: access control
Date: Tue, 08 Nov 2022 16:42:03 +0200
Organization: Games and Theory
Lines: 20
Message-ID: <87k045mrt0.fsf@tigger.extechop.net>
References: <87o7thn3nz.fsf@tigger.extechop.net>
<tkdc26$3rj4f$14@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="82aa3e6f59f378c8cb90e2ea89d569c0";
logging-data="4132101"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MJOiWBkHgfndJyE82Aqv8"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:L6zR3BBn1CsHIxcC78YhlLOQl9c=
sha1:+ewG10+faObpScUhZkgd5+N6eu8=
Mail-Copies-To: never
X-URL: http://www.iki.fi/om/
X-Face: 'g'S,X"!c;\pfvl4ljdcm?cDdk<-Z;`x5;YJPI-cs~D%;_<\V3!3GCims?a*;~u$<FYl@"E
c?3?_J+Zwn~{$8<iEy}EqIn_08"`oWuqO$#(5y3hGq8}BG#sag{BL)u8(c^Lu;*{8+'Z-k\?k09ILS
 by: Otto J. Makela - Tue, 8 Nov 2022 14:42 UTC

Marco Moock <mo01@posteo.de> wrote:

> Am 08.11.2022 um 12:25:52 Uhr schrieb Otto J. Makela:
>> However, in theory it would be possible that a spammer operation
>> could set up their own domain on M365 and configure it to use our
>> outgoing email server, as my only access control currently is the IP
>> netblocks. This could be prevented if I only accepted from those
>> neblocks emails that also originate from our own domain(s).
>
> And that isn't sufficient because the attacker could (if MS allows it)
> set the MAIL FROM: to whatever they want.

As I earlier said, as far as I know, this M365 cloud version of Exchange
will only allow domains you have registered as your own in the MAIL FROM
and email message From fields. This of course is 2nd hand knowledge.
--
/* * * Otto J. Makela <om@iki.fi> * * * * * * * * * */
/* Phone: +358 40 765 5772, ICBM: N 60 10' E 24 55' */
/* Mail: Mechelininkatu 26 B 27, FI-00100 Helsinki */
/* * * Computers Rule 01001111 01001011 * * * * * * */

Re: Using sendmail as front end for cloud M365: access control

<tke7fq$pdd$1@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=641&group=comp.mail.sendmail#641

  copy link   Newsgroups: comp.mail.sendmail
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.veps.esmtp.org!not-for-mail
From: INVALID_...@esmtp.org (Claus Aßmann)
Newsgroups: comp.mail.sendmail
Subject: Re: Using sendmail as front end for cloud M365: access control
Date: Tue, 8 Nov 2022 13:34:34 -0500 (EST)
Organization: MGT Consulting
Sender: <ml+sendmail(-no-copies-please)@esmtp.org>
Message-ID: <tke7fq$pdd$1@news.misty.com>
References: <87o7thn3nz.fsf@tigger.extechop.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 8 Nov 2022 18:34:34 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="veps.esmtp.org:155.138.203.148";
logging-data="26029"; 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)
 by: Claus Aßmann - Tue, 8 Nov 2022 18:34 UTC

Otto J. Makela wrote:

> This could be prevented if I only accepted from those neblocks emails
> that also originate from our own domain(s).

Seems you need to write your own custom ruleset.
If you want something like this:
if client ip matches a certain range
then
envelope sender must have @your.domain
Correct?

See cf/README about Local_check_mail:
These rules are called with the original arguments of the corresponding
check_* ruleset. ...
.... Return values that do not start
with $# are ignored, i.e., normal processing continues.

So use
LOCAL_RULESETS
SLocal_check_mail
# add client address to workspace
R$* $: $&{client_addr} $| $1

then you can use an existing ruleset:

### A: LookUpAddress -- search for host address in access database
### <$1> -- key (dot quadded host address)
### <$2> -- default (what to return if not found in db)
### <$3> -- mark (must be <(!|+) single-token>)
### <$4> -- passthru (additional data passed through)
dnl returns: <default> <passthru>
dnl <result> <passthru>

if there is no match, return.
otherwise get rid of the address
R$* $| $* $: $1
and look up just the address, e.g., using
### D: LookUpDomain -- search for domain in access database

see cf/m4/proto.m4 for details and how to call those
rulesets.

--
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.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor