bunkerity / bunkerweb

🛡️ Open-source and next-generation Web Application Firewall (WAF)
https://www.bunkerweb.io
GNU Affero General Public License v3.0
6.26k stars 350 forks source link

[BUG] Error 500 webui #739

Closed ToXinE closed 11 months ago

ToXinE commented 11 months ago

What happened?

after successfully login, Error 500 in WebUI

even with deleting cookie and reauth, same error.

I'm connecting with 192.168.0.254 on me.example.com/bunkerity for the webui.

How to reproduce?

1) logout from WebUI if connected 2) enter credential in webui 3) error 500

Configuration file(s) (yaml or .env)

version: "3.5"
services:

  heimdall:
    image: lscr.io/linuxserver/heimdall:latest
    container_name: heimdall
    environment:
      - PUID=1000
      - PGID=100
      - UMASK=002
      - APP_DEBUG=false
    volumes:
      - /home/gate/apps/heimdall:/config
    ports:
      - 808:80
      - 4438:443
    restart: unless-stopped
    networks:
      - bw-services

  bunkerweb:
    image: bunkerity/bunkerweb:1.5.2
    ports:
      - 80:8080
      - 443:8443
    labels:
      - "bunkerweb.INSTANCE"
    environment:
      - API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24 192.168.0.254/32
      - MULTISITE=yes
      - SERVER_NAME=me.example.com radarr.example.com sonarr.example.com bazarr.example.com lidarr.example.com jackett.example.com jellyfin.example.com ha.example.com kvm.example.com vm.example.com nas.example.com o.example.com
      - SERVE_FILES=no
      - DISABLE_DEFAULT_SERVER=yes
      - AUTO_LETS_ENCRYPT=yes
      - USE_CLIENT_CACHE=yes
      - USE_GZIP=yes
      - USE_REVERSE_PROXY=yes
      - REVERSE_PROXY_URL=/
      - WHITELIST_IP 192.168.0.254
      # ------------------ PROXY HEADERS
      - USE_REAL_IP=yes
      - USE_PROXY_PROTOCOL=no
      - REAL_IP_FROM=192.168.0.0/16
      - REAL_IP_HEADER=X-Forwarded-For
      # ------------------ sites
      # me.example.com
      - me.example.com_USE_UI=yes
      - me.example.com_SERVE_FILES=no
      - me.example.com_USE_REVERSE_PROXY=yes
      - me.example.com_REVERSE_PROXY_URL=/bunkerity # replace with another url
      - me.example.com_REVERSE_PROXY_HOST=http://bw-ui:7000
      - me.example.com_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504
      # radarr
      - radarr.example.com_REVERSE_PROXY_HOST=http://192.168.100.100:7878
      - radarr.example.com_USE_CLIENT_CACHE=yes
      - radarr.example.com_MAX_CLIENT_SIZE=50m
      - radarr.example.com_REVERSE_PROXY_WS=yes                     # websocket is needed
      - radarr.example.com_ALLOWED_METHODS=GET|POST|HEAD|DELETE|PUT # more info at https://radarr.video/docs/api/
      - radarr.example.com_LIMIT_REQ_URL_1=^/api/                   # Increase request rate for API endpoints
      - radarr.example.com_LIMIT_REQ_RATE_1=10r/s                   # Increase request rate for API endpoints
      # sonarr
      - sonarr.example.com_REVERSE_PROXY_HOST=http://192.168.100.100:8989
      - sonarr.example.com_REVERSE_PROXY_WS=yes                     # websocket is needed
      - sonarr.example.com_LIMIT_REQ_URL_1=^/api/                   # Increase request rate for API endpoints
      - sonarr.example.com_LIMIT_REQ_RATE_1=10r/s                   # Increase request rate for API endpoints
      # bazarr
      - bazarr.example.com_REVERSE_PROXY_HOST=http://192.168.100.100:6767
      - bazarr.example.com_REVERSE_PROXY_WS=yes                     # websocket is needed
      - bazarr.example.com_LIMIT_REQ_URL_1=^/api/                   # Increase request rate for API endpoints
      - bazarr.example.com_LIMIT_REQ_RATE_1=10r/s                   # Increase request rate for API endpoints
      # lidarr
      - lidarr.example.com_REVERSE_PROXY_HOST=http://192.168.100.100:8686
      - lidarr.example.com_REVERSE_PROXY_WS=yes                     # websocket is needed
      - lidarr.example.com_LIMIT_REQ_URL_1=^/api/                   # Increase request rate for API endpoints
      - lidarr.example.com_LIMIT_REQ_RATE_1=10r/s                   # Increase request rate for API endpoints
      # jackett
      - jackett.example.com_REVERSE_PROXY_HOST=http://192.168.100.100:9117
      # jellyfin
      - jellyfin.example.com_REVERSE_PROXY_HOST=https://192.168.100.21:8096
      # ha
      - ha.example.com_REVERSE_PROXY_HOST=http://192.168.100.12:8123
      # kvm
      - kvm.example.com_REVERSE_PROXY_HOST=http://192.168.100.36
      # vm
      - vm.example.com_REVERSE_PROXY_HOST=https://192.168.100.200
      # nas
      - nas.example.com_REVERSE_PROXY_HOST=https://192.168.100.10
      # o
      - o.example.com_REVERSE_PROXY_HOST=https://192.168.100.3:4438
    networks:
      - bw-universe
      - bw-services

  bw-scheduler:
    image: bunkerity/bunkerweb-scheduler:1.5.2
    depends_on:
      - bunkerweb
      - bw-docker-proxy
    environment:
      - DOCKER_HOST=tcp://bw-docker-proxy:2375
    volumes:
      - bw-data:/data
    networks:
      - bw-universe
      - bw-docker

  bw-docker-proxy:
    image: tecnativa/docker-socket-proxy:nightly
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - CONTAINERS=1
      - LOG_LEVEL=warning
    networks:
      - bw-docker

  bw-ui:
    image: bunkerity/bunkerweb-ui:1.5.2
    depends_on:
      - bw-docker-proxy
    environment:
      - DOCKER_HOST=tcp://bw-docker-proxy:2375
      - ADMIN_USERNAME=mlkqsdjmflkjqsoiejrM321sqd354*.
      - ADMIN_PASSWORD=passwordVeryComplex01*32154qsdf21q3s2d1f6q54sdf0.
    volumes:
      - bw-data:/data
    networks:
      - bw-universe
      - bw-docker      

volumes:
  bw-data:

networks:
  bw-services:
    name: bw-services
  bw-universe:
    name: bw-universe
    ipam:
      driver: default
      config:
        - subnet: 10.20.30.0/24
  bw-docker:
    name: bw-docker

Relevant log output

gate-bw-ui-1            | 2023-10-28T22:37:57.045968341Z 192.168.0.254 - - [28/Oct/2023:22:37:57 +0000] "GET /bunkerity/ HTTP/1.0" 302 219 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
gate-bunkerweb-1        | 2023-10-28T22:37:57.046874550Z www.example.com 192.168.0.254 - - [28/Oct/2023:22:37:57 +0000] "GET /bunkerity/ HTTP/2.0" 302 219 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
gate-bunkerweb-1        | 2023-10-28T22:37:57.221020848Z www.example.com 192.168.0.254 - - [28/Oct/2023:22:37:57 +0000] "GET /bunkerity/login HTTP/2.0" 302 217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
gate-bw-ui-1            | 2023-10-28T22:37:57.221377442Z 192.168.0.254 - - [28/Oct/2023:22:37:57 +0000] "GET /bunkerity/login HTTP/1.0" 302 217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"
gate-bw-ui-1            | 2023-10-28T22:37:58.021831594Z [2023-10-28 22:37:58 +0000] [7] [❌] Error handling request /bunkerity/home
gate-bw-ui-1            | 2023-10-28T22:37:58.021846582Z Traceback (most recent call last):
gate-bw-ui-1            | 2023-10-28T22:37:58.021848676Z   File "/usr/share/bunkerweb/deps/python/gunicorn/workers/base_async.py", line 55, in handle
gate-bw-ui-1            | 2023-10-28T22:37:58.021850399Z     self.handle_request(listener_name, req, client, addr)
gate-bw-ui-1            | 2023-10-28T22:37:58.021851822Z   File "/usr/share/bunkerweb/deps/python/gunicorn/workers/ggevent.py", line 128, in handle_request
gate-bw-ui-1            | 2023-10-28T22:37:58.021853225Z     super().handle_request(listener_name, req, sock, addr)
gate-bw-ui-1            | 2023-10-28T22:37:58.021854487Z   File "/usr/share/bunkerweb/deps/python/gunicorn/workers/base_async.py", line 108, in handle_request
gate-bw-ui-1            | 2023-10-28T22:37:58.021855819Z     respiter = self.wsgi(environ, resp.start_response)
gate-bw-ui-1            | 2023-10-28T22:37:58.021857061Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021858304Z   File "/usr/share/bunkerweb/deps/python/flask/app.py", line 2213, in __call__
gate-bw-ui-1            | 2023-10-28T22:37:58.021859606Z     return self.wsgi_app(environ, start_response)
gate-bw-ui-1            | 2023-10-28T22:37:58.021860839Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021862071Z   File "/usr/share/bunkerweb/ui/src/ReverseProxied.py", line 68, in __call__
gate-bw-ui-1            | 2023-10-28T22:37:58.021863344Z     return self.app(environ, start_response)
gate-bw-ui-1            | 2023-10-28T22:37:58.021864556Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021865758Z   File "/usr/share/bunkerweb/deps/python/flask/app.py", line 2193, in wsgi_app
gate-bw-ui-1            | 2023-10-28T22:37:58.021867020Z     response = self.handle_exception(e)
gate-bw-ui-1            | 2023-10-28T22:37:58.021868253Z                ^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021869485Z   File "/usr/share/bunkerweb/deps/python/flask/app.py", line 2190, in wsgi_app
gate-bw-ui-1            | 2023-10-28T22:37:58.021870767Z     response = self.full_dispatch_request()
gate-bw-ui-1            | 2023-10-28T22:37:58.021871970Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021873212Z   File "/usr/share/bunkerweb/deps/python/flask/app.py", line 1486, in full_dispatch_request
gate-bw-ui-1            | 2023-10-28T22:37:58.021874514Z     rv = self.handle_user_exception(e)
gate-bw-ui-1            | 2023-10-28T22:37:58.021887369Z          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021888741Z   File "/usr/share/bunkerweb/deps/python/flask/app.py", line 1484, in full_dispatch_request
gate-bw-ui-1            | 2023-10-28T22:37:58.021890124Z     rv = self.dispatch_request()
gate-bw-ui-1            | 2023-10-28T22:37:58.021891316Z          ^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021892558Z   File "/usr/share/bunkerweb/deps/python/flask/app.py", line 1469, in dispatch_request
gate-bw-ui-1            | 2023-10-28T22:37:58.021893881Z     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
gate-bw-ui-1            | 2023-10-28T22:37:58.021895173Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021896436Z   File "/usr/share/bunkerweb/deps/python/flask_login/utils.py", line 290, in decorated_view
gate-bw-ui-1            | 2023-10-28T22:37:58.021897758Z     return current_app.ensure_sync(func)(*args, **kwargs)
gate-bw-ui-1            | 2023-10-28T22:37:58.021899401Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021900744Z   File "/usr/share/bunkerweb/ui/main.py", line 368, in home
gate-bw-ui-1            | 2023-10-28T22:37:58.021901986Z     instances = app.config["INSTANCES"].get_instances()
gate-bw-ui-1            | 2023-10-28T22:37:58.021903259Z                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021904491Z   File "/usr/share/bunkerweb/ui/src/Instances.py", line 131, in get_instances
gate-bw-ui-1            | 2023-10-28T22:37:58.021905773Z     env_variables = {
gate-bw-ui-1            | 2023-10-28T22:37:58.021906935Z                     ^
gate-bw-ui-1            | 2023-10-28T22:37:58.021908188Z   File "/usr/share/bunkerweb/ui/src/Instances.py", line 132, in <dictcomp>
gate-bw-ui-1            | 2023-10-28T22:37:58.021909671Z     x[0]: x[1]
gate-bw-ui-1            | 2023-10-28T22:37:58.021910863Z           ~^^^
gate-bw-ui-1            | 2023-10-28T22:37:58.021912035Z IndexError: list index out of range
gate-bw-ui-1            | 2023-10-28T22:37:58.021916203Z 10.20.30.2 - - [28/Oct/2023:22:37:58 +0000] "GET /bunkerity/home HTTP/1.0" 500 0 "-" "-"
gate-bunkerweb-1        | 2023-10-28T22:37:58.035350049Z www.example.com 192.168.0.254 - - [28/Oct/2023:22:37:58 +0000] "GET /bunkerity/home HTTP/2.0" 500 703592 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"

BunkerWeb version

1.5.2

What integration are you using?

Docker

Linux distribution (if applicable)

Ubuntu server 22.04 LTS

Removed private data

Code of Conduct

TheophileDiot commented 11 months ago

Hi @ToXinE, thank you for opening this issue, I'll have a look and let you know !

TheophileDiot commented 11 months ago

The last commit should fix the issue 😁

fl0ppy-d1sk commented 11 months ago

Hello @ToXinE,

It should be fixed in version 1.5.3, don't hesitate to open a new issue if needed.