# Mail proxy to 3rd party using ssl

**URL:** <https://www.ruby-forum.com/t/mail-proxy-to-3rd-party-using-ssl/246135>\
**Category:** NGINX\
**Created:** [September 3, 2013, 7:22am UTC](https://www.ruby-forum.com/t/mail-proxy-to-3rd-party-using-ssl/246135 "2013-09-03T07:22:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [September 3, 2013, 7:22am UTC](https://www.ruby-forum.com/t/mail-proxy-to-3rd-party-using-ssl/246135/1 "2013-09-03T07:22:59Z")

</div>

I am setting up nginx as POP3 mail proxy to two 3rd party mail servers.  
Different domains, one of them uses SSL.

Since I do not have that 3rd party’s SSL certificate I use my own  
company  
certificate in nginx. That cert is properly signed but obviousy belongs  
to  
another domain (our domain).

If I connect to the non-ssl server through nginx all works fine (port  
110 on  
nginx and 3rd party server).

If I connect to the ssl domain through nginx (port 995 on nginx and 3rd  
party server) I seem to not get a response from the 3rd party server.  
The  
authentication routine on connection establishment is properly called by  
nginx (correct uname/pw) and it returns that the user is OK (correct 3rd  
party IP address is returned as well).

Using the email client without proxy works fine, meaning: uname/pw are  
correct.

Questions:

- Is such configuration possible at all (ssl to 3rd party server without  
having that server’s certificate installed on nginx)?
- Is nginx in this configurtion a man-in-the middle? Could that be a  
problem?
- Any idea how to further debug?

Thanks,  
Rick

Posted at Nginx Forum:

> **[mail proxy to 3rd party using ssl](https://forum.nginx.org/read.php?2,242473,242473#msg-242473)**
>
> I am setting up nginx as POP3 mail proxy to two 3rd party mail servers. Different domains, one of them uses SSL. Since I do not have that 3rd party's SSL certificate I use my own company certificate in nginx. That cert is properly signed but obviousy...

---

<div class="post-metadata">

**Author:** ![rmombassa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e480ec/32.png) [@rmombassa](https://www.ruby-forum.com/u/rmombassa)\
**Post date:** [September 3, 2013, 2:02pm UTC](https://www.ruby-forum.com/t/mail-proxy-to-3rd-party-using-ssl/246135/2 "2013-09-03T14:02:01Z")

</div>

Hello!

On Tue, Sep 03, 2013 at 01:22:36AM -0400, rmombassa wrote:

> If I connect to the ssl domain through nginx (port 995 on nginx and 3rd  
> having that server’s certificate installed on nginx)?
> 
> - Is nginx in this configurtion a man-in-the middle? Could that be a  
> problem?
> - Any idea how to further debug?

The main problem you are facing right now is that nginx doesn’t  
support SSL mail backends.

And as far as I understand the description of what you are trying to  
do, it’s a MITM, and it’s not going to work unless you control  
clients and can convince them to accept your certificate. But  
it’s likely not a problem as you already have everything working  
with non-ssl backends.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**
