Custom container/access log file (fail2ban) #54
-
Is it possible to specify a custom log file location? I'd like to put baikal under the eye of fail2ban, so I need a log to scan and apply some rules to avoid brute force attacks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @Glareascum , do you use Nginx or Apache and can you use the container logs, or do you need the actual access log files? Assuming fail2ban can not consume container logs out of the box, I can think of three solutions: Consume container JSON log filesThe access log is printed to the container logs, are stored in The container id changes every time you start a new one, so I don't know if you can just consume all container logs and filter in fail2ban, or if fail2ban has an overall better way of consuming Docker container logs. Mount log folderIf you don't need the access log in the container logs, I would mount Log to multiple filesIf you want to keep the container logs and additionally output access logs to a separate file, you need to do the following:
On Apache you might get away with mounting a new configuration file in
Failed login attemps (updated from replies)Baikal version 0.9.1 (and earlier versions probably too) logs and returns HTTP status 200 codes even when logins fail, so the access logs by themselves cannot be used to detect failed logins. I think this would require a code change in Core/Frameworks/BaikalAdmin/WWWRoot/index.php#L65-L66 to set the HTTP status code to something like 403. |
Beta Was this translation helpful? Give feedback.
Hi @Glareascum , do you use Nginx or Apache and can you use the container logs, or do you need the actual access log files?
Assuming fail2ban can not consume container logs out of the box, I can think of three solutions:
Consume container JSON log files
The access log is printed to the container logs, are stored in
/var/lib/docker/containers/<container id>/<container id>-json.log
unless you changed your logging driver, e.g. to journald (something I would personally actually recommend, it helps with disk space filling up with log files).The container id changes every time you start a new one, so I don't know if you can just consume all container logs and filter in fail2ban, or if fail2ban…