### Expected behaviour
IP is banned after 15 404 attempts and is banned on mail domain (xxx.com) but also on subdomains (git.xxx.com, blog.xxx.com, etc)
### Actual behaviour
IP is blocked on main domain but not on any subdomains. Logs show bad IP on subdomains but access isn't blocked.
### Steps to reproduce
1. Setup as described above.
2. Access either main domain or subdomain 15 times to get banned.
3. Access main domain and see ban
4. access subdomain and see that IP isn't banned
### Docker info
```text
Client: Docker Engine - Community
Version: 24.0.5
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.20.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 27
Running: 18
Paused: 0
Stopped: 9
Images: 160
Server Version: 24.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
runc version: v1.1.8-0-g82f18fe
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 5.10.103-v7l+
Operating System: Raspbian GNU/Linux 10 (buster)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 3.326GiB
Name: himalia
ID: 4e93fb7f-268a-46cc-a223-edb2f65e2bfc
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Support guidelines
I've found a bug and checked that ...
Description
Setup:
fail2ban in docker
jail.d/jail.local:
[traefik-general-forceful-browsing] enabled = true filter = traefik-general-forceful-browsing
ignoreip = 127.0.0.0/8 192.168.10.0/16 logpath = /var/log/traefik/access.log
chain = DOCKER-USER action = action-ban-docker-forceful-browsing
maxretry = 15 findtime = 60 bantime = 600
[INCLUDES]
[Definition]
fail regex based on traefik JSON access logs with enabled user agent logging
failregex = ^{"ClientAddr":". ","ClientHost":"","ClientPort":". ","ClientUsername":". ","DownstreamContentSize":. ,"DownstreamStatus":. ,"Duration":. ,"OriginContentSize":. ,"OriginDuration":. ,"OriginStatus":(405|404|403|402|401),"Overhead":. ,"RequestAddr":". ","RequestContentSize":. ,"RequestCount":. ,"RequestHost":". ","RequestMethod":". ","RequestPath":". ","RequestPort":". ","RequestProtocol":". ","RequestScheme":". ","RetryAttempts":. ,."StartLocal":". ","StartUTC":". ","TLSCipher":". ","TLSVersion":". ","entryPointName":". ","level":". ","msg":". ",("request_User-Agent":". ",){0,1}?"time":".* "}$
custom date pattern for traefik JSON access logs
based on https://github.com/fail2ban/fail2ban/issues/2558#issuecomment-546738270
datepattern = "StartLocal"\s:\s"%%Y-%%m-%%d[T]%%H:%%M:%%S.%%f\d*(%%z)?",
ignore common errors like missing media files or JS/CSS/TXT/ICO stuff
ignoreregex = ^{"ClientAddr":". ","ClientHost":"","ClientPort":". ","ClientUsername":". ","DownstreamContentSize":. ,"DownstreamStatus":. ,"Duration":. ,"OriginContentSize":. ,"OriginDuration":. ,"OriginStatus":(405|404|403|402|401),"Overhead":. ,"RequestAddr":". ","RequestContentSize":. ,"RequestCount":. ,"RequestHost":". ","RequestMethod":". ","RequestPath":".(.png|.txt|.jpg|.ico|.js|.css|.ttf|.woff|.woff2)(/)? ","RequestPort":". ","RequestProtocol":". ","RequestScheme":". ","RetryAttempts":. ,."StartLocal":". ","StartUTC":". ","TLSCipher":". ","TLSVersion":". ","entryPointName":". ","level":". ","msg":". ",("request_User-Agent":". ",){0,1}?"time":". "}$
[Definition]
actionban = iptables -I DOCKER-USER -m string --algo bm --string 'X-Forwarded-For:' -j DROP
actionunban = iptables -D DOCKER-USER -m string --algo bm --string 'X-Forwarded-For:' -j DROP
Docker Compose config
Logs
Additional info
No response