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.