Mail Proxy for two domains nehind NAT

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Mail Proxy for two domains nehind NAT

Olaf van der Spek
Hello,

I tried to setup NGiNX as a Mail Proxy for two domains behind NAT.  Users
will be diverted to the right server base on domain (eg./ [hidden email]
will be diverted to Server A and [hidden email] will be diverted to Server
B).

When I test the nginx.conf it gives me the following:

"nginx: [emerg] duplicate "0.0.0.0:143" address and port pair ..."

After some digging, I know that the listen directive need to have different
address:port pair but reuseport option is not allow in mail context.

Is there a way to overcome or achieve that?  Please Help!  TIA!


Regards,
YSC

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278489,278489#msg-278489

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Mail Proxy for two domains nehind NAT

Maxim Dounin
Hello!

On Sun, Feb 11, 2018 at 08:57:04PM -0500, entpneur wrote:

> Hello,
>
> I tried to setup NGiNX as a Mail Proxy for two domains behind NAT.  Users
> will be diverted to the right server base on domain (eg./ [hidden email]
> will be diverted to Server A and [hidden email] will be diverted to Server
> B).
>
> When I test the nginx.conf it gives me the following:
>
> "nginx: [emerg] duplicate "0.0.0.0:143" address and port pair ..."
>
> After some digging, I know that the listen directive need to have different
> address:port pair but reuseport option is not allow in mail context.
>
> Is there a way to overcome or achieve that?  Please Help!  TIA!

If you want to distinguish different clients based on what they
provide during authentication, you have to use single server{} block
for this, and then introduce required distinction at
authentication level in your auth_http script.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Mail Proxy for two domains nehind NAT

Olaf van der Spek
Thanks Maxim, how should I put all in one server block because I thought the
logic will be as follow:

mail {
        auth_http                127.0.0.1/auth.php;

        imap_capabilities    "IMAP4rev1" "UIDPLUS";

        server {
                listen                  0.0.0.0:143;
                server_name      mail.domainA.com;
                protocol              imap;
                proxy                  on;
        }

        server {
                listen                  0.0.0.0:143;
                server_name      mail.domainB.com;
                protocol              imap;
                proxy                  on;
        }

}


Thanks for helping.

Regards,
YSC

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278489,278698#msg-278698

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx