bunkerity / bunkerity/bunkerweb
[BUG] BAN does not seem to be applied on stream services
- Dominant language
- Python
- Stars
- 11k
- Forks
- 642
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 42
Description
### What happened?
Hi,
After rechecking, country filtering works correctly on stream services (following #3107), and blacklist/whitelist also behave as expected:
- when an IP is blacklisted, the deny is visible in the logs and the connection is blocked;
- when an IP is whitelisted, the allow is visible in the logs and the connection succeeds.
However, when **I ban an IP**, I do not see any corresponding deny log on the stream service, and the **connection is not rejected**. This suggests that the BAN mechanism may not be enforced properly for stream services, or at least not logged consistently.
More generally, for IPs that do not match any specific filtering rule (no ban, no blacklist, no whitelist), the lack of stream-related security logs makes it difficult to verify whether all expected checks are actually applied, unlike on HTTP services where visibility is clearer.
This gives me the impression that other filtering mechanisms might also be ignored on stream services, although this is only a suspicion, especially in light of the current issue and #3107 regarding stream behavior.
### How to reproduce?
_All three following sections are based on the exact same request flow involving 192.168.1.100 and 91.180.140.117_
#### 1. Whitelist works
Whitelist:
- `192.168.1.0/24`
- `91.180.140.0/24`
Logs:
```log
2026/05/10 22:57:45 [notice] ... [PREREAD] whitelist returned status 0 : IP is whitelisted (info : ip) ..., client: 91.180.140.117, server: 0.0.0.0:21116
2026/05/10 22:57:45 [notice] ... [PREREAD] whitelist returned status 0 : IP is in cached whitelist (info : ip) ..., udp client: 91.180.140.117, server: 0.0.0.0:21116
2026/05/10 22:57:45 [notice] ... [PREREAD] whitelist returned status 0 : IP is in cached whitelist (info : ip) ..., client: 192.168.1.100, server: 0.0.0.0:21116
2026/05/10 22:57:46 [notice] ... [PREREAD] whitelist returned status 0 : IP is whitelisted (info : ip) ..., client: 192.168.1.100, server: 0.0.0.0:21117
```
The service work.
#### 2. Blacklist works
Whitelist:
- `192.168.1.0/24`
Blacklist:
- `91.180.140.0/24`
Logs:
```log
2026/05/10 23:00:08 [warn] ... [PREREAD] denied preread from blacklist : IP is blacklisted (info : ip) ..., client: 91.180.140.117, server: 0.0.0.0:21116
2026/05/10 23:00:08 [warn] ... [PREREAD] denied preread from blacklist : IP is in cached blacklist (info : ip) ..., udp client: 91.180.140.117, server: 0.0.0.0:21116
2026/05/10 23:00:11 [notice] ... [PREREAD] whitelist returned status 0 : IP is whitelisted (info : ip) ..., udp client: 192.168.1.100, server: 0.0.0.0:21116
```
Client side: broken pipe, so blacklist is correctly enforced.
#### 3. BAN does not appear to work
Whitelist:
- `192.168.1.0/24`
Ban:
- `91.180.140.117`
Logs:
```log
2026/05/10 23:02:06 [notice] ... [PREREAD] whitelist returned status 0 : IP is in cached whitelist (info : ip) ..., client: 192.168.1.100, server: 0.0.0.0:21116
2026/05/10 23:02:07 [notice] ... [PREREAD] whitelist returned status 0 : IP is whitelisted (info : ip) ..., client: 192.168.1.100, server: 0.0.0.0:21117
```
I do not see any ban-related deny log for the banned IP on the stream service. The service continue to work even for the banned IP.
### Configuration file(s) (yaml or .env)
```YAML
IS_DRAFT=no
SERVER_NAME=rustdesk.21116
SERVER_TYPE=stream
USE_UDP=yes
LISTEN_STREAM_PORT=21116
USE_BAD_BEHAVIOR=no
BLACKLIST_IP=185.177.0.0/16
BLACKLIST_ASN=12876
WHITELIST_COUNTRY=FR
INTERCEPTED_ERROR_CODES=
GZIP_PROXIED=expired no-cache no-store private auth
REMOVE_HEADERS=
KEEP_UPSTREAM_HEADERS=
STRICT_TRANSPORT_SECURITY=
COOKIE_AUTO_SECURE_FLAG=no
CONTENT_SECURITY_POLICY=
REFERRER_POLICY=
PERMISSIONS_POLICY=
X_CONTENT_TYPE_OPTIONS=
COOKIE_FLAGS=
LIMIT_REQ_URL_3=/login.*
SERVE_FILES=no
HTTP2=no
HTTP3=no
HTTP3_ALT_SVC_PORT=
LISTEN_HTTP=no
OPEN_FILE_CACHE_ERRORS=no
USE_MODSECURITY=no
USE_MODSECURITY_CRS=no
USE_MODSECURITY_CRS_PLUGINS=no
MODSECURITY_SEC_REQUEST_BODY_LIMIT=10m
REMOTE_PHP_PORT=
REAL_IP_HEADER=
REAL_IP_RECURSIVE=no
USE_REVERSE_PROXY=yes
REVERSE_PROXY_INTERCEPT_ERRORS=no
REVERSE_PROXY_HOST=192.168.1.666:21116
REVERSE_PROXY_WS=yes
REVERSE_PROXY_BUFFERING=no
REVERSE_PROXY_REQUEST_BUFFERING=no
REVERSE_PROXY_HIDE_HEADERS=
REVERSE_PROXY_CONNECT_TIMEOUT=600s
REVERSE_PROXY_READ_TIMEOUT=600s
REVERSE_PROXY_SEND_TIMEOUT=600s
REVERSE_PROXY_PASS_REQUEST_BODY=no
AUTO_REDIRECT_HTTP_TO_HTTPS=no
SSL_CIPHERS_LEVEL=old
WHITELIST_IP=192.168.1.0/24 192.168.27.0/24
WHITELIST_RDNS_GLOBAL=no
```
### Relevant log output
```shell
```
### BunkerWeb version
1.6.10rc6
### What integration are you using?
Linux
### Linux distribution (if applicable)
Docker
### Removed private data
- [x] I have removed all private data from the configuration file and the logs
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.