Welcome! Log In Create A New Profile

Advanced

how to get remote_addr in ngix for POP/IMAP with perl module

October 28, 2010 10:59AM
hi
i am running ngnix with perl module for IMAP/POP, but i am not getting the source remote address from where user is authenticating.
[b]my conf:[/b]
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

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 /var/log/nginx/access.log main;
perl_modules perl/lib;
perl_require mailauth.pm;
server {
listen 8880;
location /auth {
perl mailauth::handler;
}
}
}

mail {
auth_http 127.0.0.1:8880/auth;
auth_http_timeout 6000;

pop3_capabilities "TOP" "USER";
imap_capabilities "IMAP4rev1" "UIDPLUS";

server {
listen 110;
protocol pop3;
proxy on;
auth_http_header X-Auth-Port 110;
}
server {
listen 143;
protocol imap;
proxy on;
auth_http_header X-Auth-Port 143;
}
}

[b]my mailauth.pm handler function on nginx server 192.168.1.1:[/b]
sub handler {
my $r = shift;
$r->header_out("Auth-Status", "OK");
$r->header_out("Auth-Server", '192.168.1.2');
$r->header_out("Auth-Port", '143');
$r->send_http_header("text/html");
warn 'H: ',$r->remote_addr;
return OK;
}

[b]from 192.168.1.3[/b]
telnet 192.168.1.1 143
. login user1 pass1
. OK [CAPABILITY IMAP4 IMAP4rev1 logged in

[b]on 192.168.1.1 tail -f /var/log/nginx/error_log[/b]
H: [b]127.0.0.1[/b] at /usr/share/nginx/perl/lib/mailauth.pm line 59.

actually i have to get 192.168.1.3
how to get this remote_addr can u plz help me.
Subject Author Posted

Is there a problem with my nginx.conf?

sastro August 25, 2010 02:06PM

Re: Is there a problem with my nginx.conf?

Igor Sysoev August 25, 2010 02:26PM

how to get remote_addr in ngix for POP/IMAP with perl module

moorthi October 28, 2010 10:59AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

moorthi October 29, 2010 03:57AM

telnet imap not showing existing emails thru nginx

moorthi November 01, 2010 04:21AM

Re: telnet imap not showing existing emails thru nginx

moorthi November 01, 2010 05:03AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

moorthi October 09, 2013 07:08AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

moorthi October 09, 2013 07:17AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

Maxim Dounin October 28, 2010 11:22AM

Re: telnet imap not showing existing emails thru nginx

Maxim Dounin November 01, 2010 04:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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