mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-11 07:32:57 +03:00
🐛 Bug Report: Audit log always display my Nginx Proxy Manager's IP #284
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @LucasJanin on GitHub.
Reproduction steps
My Pocket-id is installed on an LXC on my Proxmox using Proxmox VE Helper Scripts
I added to my
/opt/pocket-id/backend/.envSet up Nginx Proxy Manager to pocket-id with this Custom Nginx Configuration
However, the IPs shown in the Audit Log are always the Nginx Proxy Manager's IP.
To ensure my Nginx Proxy Manager is set up correctly, I use this Docker:
Setup a new host in Nginx Proxy Manager with that same Custom Nginx Configuration
From my understanding, the Nginx Proxy Manager behaves as expected.
Expected behavior
Display the IP of the client
Actual Behavior
Display the reverse proxy IP (Nginx Proxy Manager)
Version and Environment
v0.43.1
Log Output
@kmendell commented on GitHub:
Is the
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;under the location / section?Edit: Disregard i see it is. Ill see if i can figure this out.
@kmendell commented on GitHub:
I dont see anywhere that this is being handled in the code, so this is most likley a Reverse proxy config issue. The
TRUST_PROXYwont do anything since your disabling caddy so you can remove that. Id be curious to see if you used caddy instead of just nginx if it would show the correct ones, but my guess is nginx is just not forwarding those headers correctly somehow.@LucasJanin commented on GitHub:
To double-check, in Nginx Proxy Manager, I just changed the IP and port of my pocketed configuration to point to the kennethreitz/httpbin container.
I don't know if this means is working or not.
Done. The issue is still present.
Thanks, I will give this a try.
@savely-krasovsky commented on GitHub:
@LucasJanin are you using Docker/Podman for both Nginx and Pocket-ID? If yes, is it rootless or rootful?
@LucasJanin commented on GitHub:
Hi @kmendell
Thanks a lot!
@savely-krasovsky commented on GitHub:
@LucasJanin as far as I am aware, LXC has the same problem as rootless Docker, it's not preserving source IP by default. I am not an LXC expert, so cannot know for sure, but it definitely googles: https://discuss.linuxcontainers.org/t/how-to-get-real-client-ip-when-using-lxd-to-forward-port-80/2079/4
@kmendell commented on GitHub:
i think this is a restriction of proxmox ve LXC containers it doesn't have the required kernel rights since it's shared with the host, i think something like the ipv4 forwarding sysctl parameter should work but it would have to be on the host not the LXC container. i'm just guessing on this i haven't tested to confirm
@DJKatastrof commented on GitHub:
Hey guys, I took this to the maintainer of NPMPlus.
Can you guys look into this thread and maybe work something out?
I
https://github.com/ZoeyVid/NPMplus/discussions/1708
@LucasJanin commented on GitHub:
Pocket-ID and Nginx Proxy Manager are running in separate LXC containers on my Proxmox (no Docker/Podman)
I used the Promox VE Helper-Scripts to deploy them
@kmendell commented on GitHub:
Since this is most likley a issue with the LXC container, and this installation method is not officially support. Im closing this issue.
If you find a solution feel free to update this issue though :)
@kmendell commented on GitHub:
Reopening this issue, as i do belive this is a issue with pocket-id after re-reviewing things.
@kmendell commented on GitHub:
@yourfate @DJKatastrof Can you either of you try this image and see if its fixed? I apologize for the confusion. I do think i figured out a fix though, or at least started too:
ghcr.io/kmendell/pocket-id:clientip@yourfate commented on GitHub:
Hey, I'll try this after the weekend, i'm having guests here at the moment. Thank you for looking into this!
@DJKatastrof commented on GitHub:
Hey, i just tried it but still getting my proxy IP.
Which steps did you take? Maybe I can reproduce what you did
@yourfate commented on GitHub:
How should this be a limitation of LXC? All my other LXC services like immich, nextcloud, paperless, jellyfin can see the real IP of proxied requests just fine. This is 100% a pocket ID problem.
Immich doens't even officially support anything other than docker, yet it just works out of the box there.
@LucasJanin commented on GitHub:
Fantastic!
Unfortunately, I can't test it anymore; I moved to a bare-metal installation on a VM (without Cadd :-)
But I'm sure it will help many other users.
Thanks
@oliverl-21 commented on GitHub:
I have the LXC Setup with Traefik as Reverse Proxy and it works fine for me even in a Dual Stack Environment.
I used NPM in the past and had multiple times problems with the Forwarded-For header
@stonith404 commented on GitHub:
This issue should be fixed in
v1.0.0as Caddy has been removed from the Docker image.@yourfate commented on GitHub:
I tested this version, and the issue still persists.
@LucasJanin commented on GitHub:
I'm now using Caddy in LXC as a Reverse Proxy, and the problem is still present (Dual Stack Environment)
@AIndoria commented on GitHub:
@DJKatastrof
@AIndoria commented on GitHub:
The proxy pass works fine for me. No other configuration besides a cert, proxy_busy_buffers_size and related, and http redirect to https (in another block).
@DJKatastrof commented on GitHub:
@AIndoria Im only getting "An unknown error occurred. Please try to sign in again.".
Is that proxy pass working for you?
do you have any other configuration on pocket-id in nginx?
@AIndoria commented on GitHub:
Updated to 1.0 today. Unfortunately the issue seems to be still present. This is an internal wireguard IP
Domain -> VPS with nginx with wireguard -> (Internal wireguard routing to box with PocketID) -> PocketIDConfiguration seems correct:
@DJKatastrof commented on GitHub:
Mind pasting what you are using? I can't get it to work porperly to test it
@AIndoria commented on GitHub:
@DJKatastrof Really? With similar configuration as mine? wtf. I wonder why mine isn't working.
@DJKatastrof commented on GitHub:
@AIndoria all working here. Seeing different IP's
@savely-krasovsky , No I got everything working.
Im just trying to place pocket-id in front of my hosted Mealie.
A long shot 😅
@savely-krasovsky commented on GitHub:
@DJKatastrof you probably need to set proper
APP_URLenvironment. Otherwise WebAuthn will be broken.