How to configure Nginx as IMAP/POP3 reverse proxy - IBM Lotus Domino Server

Juliana The jul_the at yahoo.com
Wed Sep 29 08:19:41 MSD 2010


Hi..
 
Now the POP3 already running.
But still have problem with IMAP.
 
nginx.conf
 
user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /usr/local/nginx/logs/error.log;
#pid logs/nginx.pid;
pid /usr/local/nginx/logs/nginx.pid;
 
events {
worker_connections 1024;
multi_accept on;
}
mail {
auth_http 127.0.0.1:80/auth;
auth_http_timeout 6000;
smtp_auth plain;
pop3_auth plain;
imap_auth plain;
pop3_capabilities "TOP" "USER";
imap_capabilities "IMAP4rev1" "UIDPLUS";
 
server {
listen 110;
protocol pop3;
proxy on;
}
server {
listen 143;
protocol imap;
proxy on;
}

server {
listen 25;
protocol smtp;
proxy on;
}
}
http {
include mime.types;
default_type application/octet-stream;
perl_modules perl/lib;
perl_require mailauth.pm;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#location /auth {
location /auth {
perl mailauth::handler;
}
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
 
 
mailauth.pm
 
package mailauth;
use nginx;

our $auth_ok;
our $mail_server_ip={"192.168.221.1"};
our $protocol_ports={};
$domino="192.168.221.1";
$protocol_ports->{'pop3'}=110;
$protocol_ports->{'imap'}=143;
$protocol_ports->{'smtp'}=25;

sub handler {
my $r=shift; 
$auth_ok=1;
if ($auth_ok==1){
$r->header_out("Auth-Status", "OK") ;
$r->header_out("Auth-Server", $domino);
$r->header_out("Auth-Port", $protocol_ports->{$r->header_in("Auth-Protocol")});
$r->header_out("Auth Plain",$r->header_in("Auth Plain"));
} else {
$r->header_out("Auth-Status", "Invalid login or password") ;
}

$r->send_http_header("text/html");

return OK;
}

1;


--- On Sun, 9/26/10, Maxim Dounin <mdounin at mdounin.ru> wrote:


From: Maxim Dounin <mdounin at mdounin.ru>
Subject: Re: How to configure Nginx as IMAP/POP3 reverse proxy - IBM Lotus Domino Server
To: nginx at nginx.org
Date: Sunday, September 26, 2010, 11:49 AM


Hello!

On Sun, Sep 26, 2010 at 02:24:21AM -0700, Juliana The wrote:

> 
> Hi all,
> I'm newbie with nginx.
> I have IBM Lotus Domino Server as an email server with IP Address 192.168.221.1
> and Linux installed Nginx as IMAP/POP3 reverse proxy with IP Address 192.168.221.130
> I've configured nginx.conf like below :
> #user nobody;
> worker_processes 1;
> error_log /usr/local/nginx/logs/error.log;
> pid /usr/local/nginx/logs/nginx.pid;
> events {
> worker_connections 1024;
> multi_accept on;
> }
> mail {
> auth_http 192.168.221.1:81; #Domino server with http proxy (81)

This is obviously wrong as there is no URI of auth script.

http://wiki.nginx.org/MailAuthModule

> auth_http_timeout 6000;
> pop3_auth "plain";
> pop3_capabilities "TOP" "USER";
> imap_capabilities "IMAP4rev1" "UIDPLUS";
> server {
> listen 110;
> protocol pop3;
> proxy on;
> }
> server {
> listen 143;
> protocol imap;
> proxy on;
> }
> }
> When I tried telnet from client pc to Nginx, I get this response :
> C:\> telnet 192.168.221.130 110
> +OK POP3 ready
> C:\> telnet 192.168.221.130 143
> +OK IMAP4 ready
> I also can telnet from NGINX server to Domino and get this response :
> [root at centostest ~]# telnet 192.168.221.1 81
> Trying 192.168.221.1...
> Connected to 192.168.221.1 (192.168.221.1).
> Escape character is '^]'.
> [root at centostest ~]# telnet 192.168.221.1 110
> Trying 192.168.221.1...
> Connected to 192.168.221.1 (192.168.221.1).
> Escape character is '^]'.
> +OK Lotus Notes POP3 server version Release 8.5.1 ready on JULMAIL/JTHE.
> [root at centostest ~]# telnet 192.168.221.1 143
> Trying 192.168.221.1...
> Connected to 192.168.221.1 (192.168.221.1).
> Escape character is '^]'.
> * OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39 +1000
>  
> Does anyone can help how to configure nginx to get response like below :
> When I telnet from client to 192.168.221.130 110
> C:\> telnet 192.168.221.130 110
> +OK Lotus Notes POP3 server version Release 8.5.1 ready on JULMAIL/JTHE.
> When I telnet from client to 192.168.221.130 143
> C:\> telnet 192.168.221.130 143
> * OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39 +1000

No, you can't change server greeting lines in nginx.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx at nginx.org
http://nginx.org/mailman/listinfo/nginx



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100928/920df9d8/attachment-0001.html>


More information about the nginx mailing list