Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Mail: allow auth to the proxy without auth to the backend

Arnout Engelen
September 19, 2023 01:00PM
On Tue, Sep 19, 2023, at 18:34, Maxim Dounin wrote:
> On Tue, Sep 19, 2023 at 12:28:49PM +0200, Arnout Engelen wrote:
> > # HG changeset patch
> > # User Arnout Engelen <arnout@bzzt.net>
> > # Date 1695027670 -7200
> > # Mon Sep 18 11:01:10 2023 +0200
> > # Node ID 9606e589b9537495c0457383048ac6888be0e7b4
> > # Parent daf8f5ba23d8e9955b22782d945f9c065f4b6baa
> > Mail: allow auth to the proxy without auth to the backend
> >
> > Currently, when the client authenticates itself to the nginx
> > mail proxy, the mail proxy also authenticates itself to the
> > backend.
> >
> > I encountered a situation where I wanted the proxy to require
> > authentication, and forward the mail to a (local/firewalled)
> > mailserver that does not have authentication configured. I
> > created the patch below to support that.
> >
> > I'm providing this patch primarily for feedback at this point:
> > while it does work for my scenario and pass the nginx-tests,
> > it likely needs additional cleanup and testing. I'd like your
> > thoughs on whether this change makes sense in the first place,
> > and whether this is generally a reasonable approach - if so I'll
> > clean up the patch further.
> >
> > My approach is to allow the authentication server to return a
> > 'Auth-Method: none' header, in which case the proxy will not
> > attempt to authenticate to the backend but instead wait for
> > the 'MAIL FROM' from the client.
> >
> > You'll notice I've added a 'proxy_auth_method'. The reason I didn't
> > overwrite 'auth_method' is that 'auth_method' is also used to determine
> > whether to confirm the authentication to the client. Is that acceptable
> > from a binary compatibility perspective?
> >
> > Looking forward to hearing your thoughts!
>
> From the description it is not clear why "proxy_smtp_auth off;"
> (which is the default and implies that nginx won't try to
> authenticate against SMTP backends) does not work for you. Could
> you please elaborate?

Ah, indeed I didn't describe that: I have two different backends, and the HTTP authentication server decides based on the account whether to proxy the mail to one (which requires authentication) or the other (which doesn't allow authentication).

This does make me wonder whether adding that 'proxy_auth_method' field was really necessary, though, as you'd expect the "proxy_smtp_auth off" code path should need something similar. I'll look into that.


Kind regards,

Arnout_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Mail: allow auth to the proxy without auth to the backend

Arnout Engelen 293 September 19, 2023 06:30AM

Re: [PATCH] Mail: allow auth to the proxy without auth to the backend

Maxim Dounin 86 September 19, 2023 12:36PM

Re: [PATCH] Mail: allow auth to the proxy without auth to the backend

Arnout Engelen 109 September 19, 2023 01:00PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready