Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed IP addresses in the log behind nginx-proxy #675

Open
rucksman opened this issue Jul 30, 2024 · 5 comments
Open

Mixed IP addresses in the log behind nginx-proxy #675

rucksman opened this issue Jul 30, 2024 · 5 comments
Labels
question Further information is requested

Comments

@rucksman
Copy link

rucksman commented Jul 30, 2024

I am running Gotify since quite a long time in a Docker container behind an nginx-proxy. Recently I often get banned from my fail2ban. This has never happend before, and I did not make any changes in both docker-compose files. I am on the most recent versions.

When I look into the gotify log (which is clearly the cause of the problem), I see mixed IP addresses, which confuses me. I see a lot of 172.xxx.xxx.xxx entries which originate from the nginx-proxy, but I also see normal IP addresses. I would expect to see only either the proxy address or the real addresses.

The problem is that the proxy address (172) is banned by fail2ban. and whitelisting the address is obviously not a good idea. So my goal would of course be to see only real addresses in the gotify log. Why is it that I see both proxy and real IP addresses in the log?

Honestly I am not sure if this is a gotify issue or a proxy issue, but I try my luck here first.

@rucksman rucksman added the question Further information is requested label Jul 30, 2024
@eternal-flame-AD
Copy link
Member

@rucksman My first intuition is your gotify trusted proxies settings are too strict or too lax. Are the private IP addresses you see within the range of your trusted proxy setting?

Without looking at your actual setup I can't be sure what exactly is happening. If the above is not your case could you show:

  • the trusted proxies settings in gotify config
  • the NetworkSettings section of your nginx and gotify container with docker inspect
  • the docker-compose files for nginx and gotify

@rucksman
Copy link
Author

rucksman commented Aug 5, 2024

I just discovered the (undocumented) setting trustedproxies in one of the commits. That seems to do the trick. Is there a variation of this setting as an environment variable in docker-compose.yml? I tried "GOTIFY_SERVER_TRUSTEDPROXIES", but that did not work.

@jmattheis
Copy link
Member

GOTIFY_SERVER_TRUSTEDPROXIES should work fine. I've updated the docs. Your original issue mentions that you get 172.x.x.x ips and normal ips. This shouldn't happen, you should receive either one or the other if the users are all routed through the reverse proxy.

@jmattheis
Copy link
Member

You need to put brackets around.

GOTIFY_SERVER_TRUSTEDPROXIES=[172.24.0.1]

https://gotify.net/docs/config

@kirides
Copy link

kirides commented Sep 7, 2024

Got it, somehow I overlooked that syntax and just blatantly assumed it would be just comma separated (like in other software, e.g. key cloak)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

4 participants