AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

IPs of a failed login attempt and a successful login don't match on application logs

Open JGeek00 opened this issue 10 months ago • 7 comments

Prerequisites

Platform (OS and CPU architecture)

Linux, AMD64 (aka x86_64)

Installation

Docker

Setup

On one machine

AdGuard Home version

v0.107.71

Action

IPs of a failed login attempt and a successful login don't match. AdGuard Home is running on a Docker container behind Nginx Proxy Manager and Cloudflare proxy. The proxies don't seem to be an issue because when the login is successful, AGH prints the correct public IP.

Expected result

In both cases the IP shown should be the real public IP

2026/01/10 20:11:08.616322 [error] POST agh.domain.com /control/login: from ip 90.130.107.123: invalid username or password
2026/01/10 20:11:23.228003 [info] webapi: successful login user=admin ip=90.130.107.123

Actual result

The real public IP is only shown for successful login attempts

2026/01/10 20:11:08.616322 [error] POST agh.domain.com /control/login: from ip 127.0.0.1: invalid username or password
2026/01/10 20:11:23.228003 [info] webapi: successful login user=admin ip=90.130.107.123

Additional information and/or screenshots

No response

JGeek00 avatar Jan 10 '26 20:01 JGeek00

How are you passing the real IP to AdGuardHome for the successful login to display the correct IP?

tjharman avatar Jan 29 '26 19:01 tjharman

I see the same thing. I have Caddy reverse proxying to AdGuardHome and it sends the IP using the X-Forwarded-For header. If I use the correct password it logs the correct IP, if I use the wrong password it shows the wrong IP. It looks like it's using the connecting IP of the proxy rather than the clients real IP. So I guess in the case of the wrong password it's not parsing the X-Forwarded-For header.

ghost avatar Feb 01 '26 10:02 ghost

Yeah in my case I use Nginx Proxy Manager. What I mean is that if AGH knows the real IP for successful auths, it can also know it for failed auths.

JGeek00 avatar Feb 01 '26 11:02 JGeek00

Thanks I will raise this to the dev team to lookat.

tjharman avatar Feb 10 '26 00:02 tjharman

@JGeek00, good day. Just to be clear, do you set dns.trusted_proxies in your config?

ainar-g avatar Feb 11 '26 12:02 ainar-g

@ainar-g yeah I'm using nginx proxy manager and it's on the same machine as AdGuard Home, both set up with network_mode host on the docker compose.

  trusted_proxies:
    - 127.0.0.0/8
    - ::1/128

JGeek00 avatar Feb 11 '26 23:02 JGeek00

Hello, @JGeek00, we assume, that this bug was fixed in out latest edge release. Could you please check if it works for you?

masterkusok avatar Mar 05 '26 08:03 masterkusok