[SOLVED] X-Real-IP in Log

Freemind

Member
Feb 2, 2013
8
0
21
Hi,

we use nginx reverse proxy before proxmox, now in the daemon log there is always 127.0.0.1(localhost) as user. I need the real ip there for fail2ban to work properly. Have looked in the Code but couldnt manage to fix it on my own, it needs to look for the "X-Real-IP" in the header and use this IP as the client ip. Could someone please help me integrate this? I tracked it down to /usr/share/perl5/PVE/HTTPServer.pm Line #1234:

$auth = PVE::REST::auth_handler($self->{rpcenv}, $reqstate->{peer_host}, $method,
$rel_uri, $ticket, $token);

The "$reqstate->{peer_host}" is used as client-ip, which variable do I need to insert there to get the X-Real-IP?

thanks alot beforehand for any help!

kind regards,
freemind
 
so thats no solution, how to access the X-Real-IP in HTTPServer.pm? That would be a solution
 
if ($r->header('X-Forwarded-For')) {
$reqstate->{peer_host} = $r->header('X-Forwarded-For');
}

before the auth_handler request did it.
 
For anyone coming across this thread in the future, I also ran into the same issue, but it doesn't seem to be solvable in this configuration. I've detailed my findings in this proxmox forum thread.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!