Welcome! Log In Create A New Profile

Advanced

Imap proxy doesn't work

Posted by peanky 
Imap proxy doesn't work
February 27, 2018 06:49AM
Hello!

Start using nginx as smtp/imap proxy.

Smtp proxy works (but on the real smtp server I have to allow redirects from nginx IP).

Problem is IMAP proxy. It doesn't works at all. No differ - SSL or Startssl. Mail client - Thunderbird.

I run nginx on CentOS 7, IP:1.2.3.4, ports 25,143,993.
Target IMAP: outlook.office365.com.
If directly connect (no nginx), Thunderbird works fine with IMAP outlook.office365.com, SSL/TLS, port 993.
Via nginx nothing happens (IMAP: 1.2.3.4, SSL/TLS, port 993 or STARTTLS/143).
Thunderbird says: server 1.2.3.4 has disconnected. The server may have gone down...

Nginx mail config:

mail {
server_name 1.2.3.4;
auth_http 127.0.0.1:80/auth;

xclient off;

proxy_pass_error_message on;

ssl on;
ssl_prefer_server_ciphers on;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

imap_capabilities "IMAP4rev1" "UIDPLUS" "IDLE" "LITERAL+" "QUOTA";
smtp_capabilities "SIZE 10485760" "ENHANCEDSTATUSCODES" "8BITMIME" "DSN";

server {
listen 25;
protocol smtp;
smtp_auth login plain cram-md5;
}

server {
listen 993;
protocol imap;
imap_auth login plain cram-md5;
}

server {
listen 143;
protocol imap;
imap_auth login plain cram-md5;
}
}

There are no errors in /var/log/nginx/error.log.

How to trace where is the issue?
Re: Imap proxy doesn't work
February 27, 2018 06:55AM
access log:

...
127.0.0.1 - - [27/Feb/2018:11:53:58 +0000] "GET /auth HTTP/1.0" 200 0 "-" "-" "-"
127.0.0.1 - - [27/Feb/2018:11:53:58 +0000] "GET /auth HTTP/1.0" 200 0 "-" "-" "-"
Re: Imap proxy doesn't work
February 28, 2018 07:03AM
A little bit testing, error.log while try to connect:

recv() failed (111: Connection refused) while reading response from upstream, client: 19.177.26.18, server: 0.0.0.0:993, login: "user@domain.com", upstream: 2.3.4.5:143

19.177.26.18 - my ip
2.3.4.5 - backend IMAP server

What its can be? Backend server rejects connection?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 183
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