Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WGDashboard constantly throws you to the authorization page #562

Closed
ozels opened this issue Dec 26, 2024 · 10 comments · Fixed by #563 or #566
Closed

WGDashboard constantly throws you to the authorization page #562

ozels opened this issue Dec 26, 2024 · 10 comments · Fixed by #563 or #566
Labels
bug Something isn't working resolved-please-verify Issue has been resolved or added. Request verification by issuer.

Comments

@ozels
Copy link

ozels commented Dec 26, 2024

Describe The Problem
Hello, after a while, the WGDashboard constantly throws you to the authorization page. If you click "back (arrow)" on the authorization page in the browser, it continues to work, but after a while it throws you back to the authorization page.
How to fix this? Please help.

Expected Error / Traceback

[2024-12-26 15:47:10 +0300] [77210] [INFO] Starting gunicorn 23.0.0
[2024-12-26 15:47:10 +0300] [77210] [INFO] Listening at: http://192.168.220.160:10086 (77210)
[2024-12-26 15:47:10 +0300] [77210] [INFO] Using worker: gthread
[2024-12-26 15:47:10 +0300] [77212] [INFO] Booting worker with pid: 77212
[WGDashboard] Background Thread #1 Started
[WGDashboard] Background Thread #2 Started
[2024-12-26 15:48:15,198] ERROR in app: Exception on /api/getWireguardConfigurationInfo [GET]
Traceback (most recent call last):
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask_cors/extension.py", line 194, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 2253, in API_getConfigurationInfo
    return ResponseObject(data={
           ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 54, in ResponseObject
    response = Flask.make_response(app, {
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 1231, in make_response
    rv = self.json.response(rv)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/json/provider.py", line 214, in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/json/provider.py", line 179, in dumps
    return json.dumps(obj, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 74, in default
    return o.toJson()
           ^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 1184, in toJson
    self.getShareLink()
  File "/srv/WGDashboard/src/dashboard.py", line 1286, in getShareLink
    self.ShareLink = AllPeerShareLinks.getLink(self.configuration.Name, self.id)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 410, in getLink
    self.__getSharedLinks()
  File "/srv/WGDashboard/src/dashboard.py", line 405, in __getSharedLinks
    allLinks = sqlSelect("SELECT * FROM PeerShareLinks WHERE ExpireDate IS NULL OR ExpireDate > datetime('now', 'localtime')").fetchall()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 1628, in sqlSelect
    with sqldb:
SystemError: error return without exception set

Raspberry Pi 3
OS Information:

  • OS: Raspbian12 PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
  • Python Version: Python 3.12.5

Sample of your .conf file

[Interface]
Address = 33.33.33.1/24
DNS = 127.0.0.1
PostUp = iptables -I INPUT -p udp --dport 34728 -j ACCEPT
PostUp = iptables -I FORWARD -i eth0 -o wg0 -j ACCEPT
PostUp = iptables -I FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostUp = ip rule add from `ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | grep -v "inet6" | head -n 1 | awk '/inet/ {print $2}' | awk -F/ '{print $1}'` table main
PostDown = iptables -D INPUT -p udp --dport 34728 -j ACCEPT
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PostDown = ip rule del from `ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | grep -v "inet6" | head -n 1 | awk '/inet/ {print $2}' | awk -F/ '{print $1}'` table main
ListenPort = 34728
FwMark = 0xca6c
PrivateKey = ABCD...

[Peer]
PublicKey = EuKyomV9f2nK/FPXt+5OUla3IKON6Nn/3WtYPv1zcVo=
AllowedIPs = 33.33.33.111/32, 0.0.0.0/0
Endpoint = x.x.x.x:53628

[Peer]
PublicKey = M+bGYfx6NNhRnTyJgLZ1NTaS5Mzr1hE4b07cy1exxF0=
AllowedIPs = 33.33.33.2/32, 192.168.5.0/24
Endpoint = x.x.x.x:44582
@ozels ozels added the bug Something isn't working label Dec 26, 2024
@donaldzou donaldzou mentioned this issue Dec 26, 2024
@donaldzou donaldzou linked a pull request Dec 26, 2024 that will close this issue
@DaanSelen DaanSelen added the resolved-please-verify Issue has been resolved or added. Request verification by issuer. label Dec 27, 2024
@DaanSelen
Copy link
Collaborator

@ozels if you are able can you try again with the latest code once that's merged?

donaldzou added a commit that referenced this issue Dec 28, 2024
Fix #562, and mysterious Jobs disappear issue
@donaldzou
Copy link
Owner

@ozels The new update should fix the issue :) You can update it by doing ./wgd.sh update

@ozels
Copy link
Author

ozels commented Dec 30, 2024

Hello, sorry for the long response, I'm sick.
After the update the problem remained :(. New log after the update.

root@gatewey-vpn:/srv/WGDashboard/src# cat ./log/error_2024_12_30_14_20_14.log
[2024-12-30 14:20:14 +0300] [87221] [INFO] Starting gunicorn 23.0.0
[2024-12-30 14:20:14 +0300] [87221] [INFO] Listening at: http://192.168.220.160:10086 (87221)
[2024-12-30 14:20:14 +0300] [87221] [INFO] Using worker: gthread
[2024-12-30 14:20:14 +0300] [87223] [INFO] Booting worker with pid: 87223
[WGDashboard] Background Thread #1 Started
[WGDashboard] Background Thread #2 Started
[2024-12-30 14:24:13,488] ERROR in app: Exception on /api/getWireguardConfigurationInfo [GET]
Traceback (most recent call last):
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask_cors/extension.py", line 194, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 2253, in API_getConfigurationInfo
    return ResponseObject(data={
           ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 54, in ResponseObject
    response = Flask.make_response(app, {
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 1231, in make_response
    rv = self.json.response(rv)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/json/provider.py", line 214, in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/json/provider.py", line 179, in dumps
    return json.dumps(obj, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 74, in default
    return o.toJson()
           ^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 1184, in toJson
    self.getShareLink()
  File "/srv/WGDashboard/src/dashboard.py", line 1286, in getShareLink
    self.ShareLink = AllPeerShareLinks.getLink(self.configuration.Name, self.id)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 410, in getLink
    self.__getSharedLinks()
  File "/srv/WGDashboard/src/dashboard.py", line 405, in __getSharedLinks
    allLinks = sqlSelect("SELECT * FROM PeerShareLinks WHERE ExpireDate IS NULL OR ExpireDate > datetime('now', 'localtime')").fetchall()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 1628, in sqlSelect
    with sqldb:
sqlite3.OperationalError: cannot commit - no transaction is active

@DaanSelen
Copy link
Collaborator

Perhaps the timezone?

@DaanSelen DaanSelen reopened this Dec 30, 2024
@ozels
Copy link
Author

ozels commented Dec 30, 2024

Perhaps the timezone?

The time on the server is correct.

@ozels ozels closed this as completed Dec 30, 2024
@donaldzou donaldzou linked a pull request Dec 30, 2024 that will close this issue
@donaldzou donaldzou reopened this Dec 30, 2024
@donaldzou
Copy link
Owner

Let me merge a changes to main and hope this works :(

@donaldzou
Copy link
Owner

@ozels Could you please update and try again?

@ozels
Copy link
Author

ozels commented Jan 4, 2025

After the update the problem remained. New log after the update.

[2025-01-04 14:10:33 +0300] [198832] [INFO] Starting gunicorn 23.0.0
[2025-01-04 14:10:33 +0300] [198832] [INFO] Listening at: http://192.168.220.160:10086 (198832)
[2025-01-04 14:10:33 +0300] [198832] [INFO] Using worker: gthread
[2025-01-04 14:10:33 +0300] [198834] [INFO] Booting worker with pid: 198834
[WGDashboard] Background Thread #1 Started
[WGDashboard] Background Thread #2 Started
[2025-01-04 14:15:06,880] ERROR in app: Exception on /api/getWireguardConfigurationInfo [GET]
Traceback (most recent call last):
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask_cors/extension.py", line 194, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 2253, in API_getConfigurationInfo
    return ResponseObject(data={
           ^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 54, in ResponseObject
    response = Flask.make_response(app, {
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/app.py", line 1231, in make_response
    rv = self.json.response(rv)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/json/provider.py", line 214, in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/venv/lib/python3.11/site-packages/flask/json/provider.py", line 179, in dumps
    return json.dumps(obj, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 74, in default
    return o.toJson()
           ^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 1184, in toJson
    self.getShareLink()
  File "/srv/WGDashboard/src/dashboard.py", line 1286, in getShareLink
    self.ShareLink = AllPeerShareLinks.getLink(self.configuration.Name, self.id)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 410, in getLink
    self.__getSharedLinks()
  File "/srv/WGDashboard/src/dashboard.py", line 405, in __getSharedLinks
    allLinks = sqlSelect("SELECT * FROM PeerShareLinks WHERE ExpireDate IS NULL OR ExpireDate > datetime('now', 'localtime')").fetchall()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/WGDashboard/src/dashboard.py", line 1628, in sqlSelect
    with sqldb:
sqlite3.OperationalError: cannot commit - no transaction is active

@donaldzou
Copy link
Owner

Hi, can you please update with git pull in the directory? I don't think you update it successfully

@ozels
Copy link
Author

ozels commented Jan 5, 2025

Hi, can you please update with git pull in the directory? I don't think you update it successfully

Yes, you were right. I updated the repository branch and did more just in case ./wgd.sh update, during the hour of the panel's operation, there was not a single departure. Thank you so much for your help and for your hard work. Good luck with everything.
👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved-please-verify Issue has been resolved or added. Request verification by issuer.
Projects
None yet
3 participants