-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the Bug
Setting the APP_PROXIES
to *
allows the Audit Log
of BookStack
to display the real IP address of the user.
In the security-topic documentation we can see:
An option is available to log failed login events to a log file which is useful to identify users having trouble logging in, track malicious login attempts or to use with tools such as Fail2Ban.
This option is LOG_FAILED_LOGIN_MESSAGE
(set, as advised, to "Failed login for %u"
).
So one could logically think - as Fail2Ban
is only effective if it has access to the IP address of the attacker - that APP_PROXIES
and LOG_FAILED_LOGIN_MESSAGE
are the perfect combo to track repeated failed login attempts.
That is not the case. The APP_PROXIES
option works for Audit Log
(as advertized in the BookStack 21.10 release notes), and the LOG_FAILED_LOGIN_MESSAGE
option yields a message in the NGinx error.log
as expected:
2022/08/03 22:55:12 [error] 226#226: *6 FastCGI sent in stderr: "PHP message: Failed login for john.doe@gmail.com" while reading response header from upstream, client: 172.23.0.1, server: _, request: "POST /login HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "book.myserver.org", referrer: "https://book.myserver.org/login"
But they do not yield an NGinx
error message which can be used by Fail2Ban
, as 172.23.0.1
is a Docker bridge
interface IP address, not the user real address.
Steps to Reproduce
- In the
docker-compose.yml
file, setAPP_PROXIES
to*
- In the
docker-compose.yml
file, setLOG_FAILED_LOGIN_MESSAGE
to"Failed login for %u"
- Generate and start your containers (
BookStack
andMariaDB
) - Try to log in with bad credentials into
BookStack
- Have a look at the
NGinx error.log
file
Expected Behaviour
Setting both APP_PROXIES
and LOG_FAILED_LOGIN_MESSAGE
should yield a message with the real IP address of the user in the NGinx error.log
file.
We could also imagine that beside the %u
variable in the failed login message, there could also be a %i
variable for the IP address.
Screenshots or Additional Context
No response
Browser Details
Firefox 103.0 (64-bit) - Windows 11 Home (10.0.22000)
Exact BookStack Version
22.07.1 (LinuxServer.io 22.07.1-ls29)
PHP Version
7.4.26
Hosting Environment
- Synology DS218+ DSM 6.2.4-25556 Update 6
- DSM NGinx 1.16.1 (https://book.myserver.org -> http://localhost:9580)
- DSM Docker 20.10.3: docker-compose.yml:
- services: image: lscr.io/linuxserver/bookstack, ports: 9580:80, networks: bookstack_mariadb
- services: image: lscr.io/linuxserver/mariadb, ports: 3306:3306, networks: bookstack_mariadb
- networks: bookstack_mariadb, driver: bridge