Login failed log the IP of the Docker Network Gateway #3379
-
DescriptionWhen using Caddy as reverse proxy for Paperless, a failed login would log the IP of the Docker network gateway instead of the IP of the client. I use fail2ban for security installed on the host. If I access Paperless via HTTP on port 8000, the IP of the failing client is logged correctly. Steps to reproduceHere is my Caddy reverse proxy config: https://paperless.office.domain.com:443 {
reverse_proxy paperless.office.domain.com:8000
tls /etc/caddy/letsencrypt.fullchain /etc/caddy/letsencrypt.key
@denied not remote_ip private_ranges
abort @denied Accessing Paperless via https://paperless.office.domain.com work without issue... excluding that in case of failed login the IP logged is the Docker network gateway. I tried different combination of Caddy setting header_up X-Real-IP {remote}
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-For {remote}
header_up Host {host}
header_up X-Forwarded-Host {host}
and adding some env variable to Paperless PAPERLESS_USE_X_FORWARD_HOST=true
PAPERLESS_PROXY_SSL_HEADER='["HTTP_X_FORWARDED_PROTO", "https"]' ....but I don't get anywhere For your info my Fail2Ban conf is # /etc/fail2ban/filter.d/paperless.conf
[Definition]
failregex = Login failed for user `.*` from (?:IP|private IP) `<HOST>\.`$
ignoreregex =
#/etc/fail2ban/jail.d/00_docker-paperless.local
[paperless]
enabled = true
filter = paperless
logpath = /srv/paperless/docker-data/data/log/paperless.log # Need to be adjusted for your Docker setup
chain = DOCKER-USER
maxretry = 5
bantime = 1h
port = 8000 Webserver logs[2023-05-10 20:03:23,874] [INFO] [paperless.auth] Login failed for user `sdf` from private IP `10.6.53.1.`
[2023-05-10 20:04:03,693] [INFO] [paperless.auth] Login failed for user `sdfasd` from private IP `10.6.53.1.`
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
I don't see any mention of setting You can see the precedence ordering the library used for getting the client ip here. |
Beta Was this translation helpful? Give feedback.
-
This discussion has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns. |
Beta Was this translation helpful? Give feedback.
I've switched over to the newer library, which appears to work. If you can test, the image is tagged as
docker pull ghcr.io/paperless-ngx/paperless-ngx:feature-pr-3382
. It's currently roughly v1.14, but it's probably best to test in an isolated way