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

clicking WG0 Settings keeps loading for ever #102

Closed
nicedevil007 opened this issue Nov 19, 2021 · 11 comments
Closed

clicking WG0 Settings keeps loading for ever #102

nicedevil007 opened this issue Nov 19, 2021 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@nicedevil007
Copy link

nicedevil007 commented Nov 19, 2021

Describe The Problem
I click on the WG0 Connection to open the settings for this connection. WGDashboard starts loading forever from now on.

Expected Error / Traceback

[2021-11-19 06:28:34,099] ERROR in app: Exception on /get_config/wg0 [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "dashboard.py", line 779, in get_conf
    "peer_data": get_peers(config_name, search, sort),
  File "dashboard.py", line 327, in get_peers
    get_all_peers_data(config_name)
  File "dashboard.py", line 269, in get_all_peers_data
    search = db.search(peers.id == i['PublicKey'])
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 233, in search
    docs = [doc for doc in self if cond(doc)]
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 233, in <listcomp>
    docs = [doc for doc in self if cond(doc)]
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 603, in __iter__
    for doc_id, doc in self._read_table().items():
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 653, in _read_table
    tables = self._storage.read()
  File "/usr/local/lib/python3.7/dist-packages/tinydb/storages.py", line 125, in read
    return json.load(self._handle)
  File "/usr/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4504 (char 4503)
10.7.0.3 - - [19/Nov/2021 06:28:34] "GET /get_config/wg0?search= HTTP/1.1" 500 -
10.7.0.3 - - [19/Nov/2021 06:28:34] "GET /static/img/logo.png HTTP/1.1" 200 -
User not loggedin - Attemped access: get_conf
10.0.5.17 - - [19/Nov/2021 06:28:49] "GET /get_config/wg0?search= HTTP/1.1" 302 -
10.0.5.17 - - [19/Nov/2021 06:28:49] "GET /signin HTTP/1.1" 200 -
10.0.5.17 - - [19/Nov/2021 06:28:49] "GET /static/css/dashboard.css HTTP/1.1" 200 -
10.0.5.17 - - [19/Nov/2021 06:28:49] "GET /static/js/jquery.min.js HTTP/1.1" 200 -
10.0.5.17 - - [19/Nov/2021 06:28:49] "GET /static/js/bootstrap.bundle.js HTTP/1.1" 200 -
10.0.5.17 - - [19/Nov/2021 06:28:50] "GET /static/js/tools.js HTTP/1.1" 200 -
[2021-11-19 06:29:34,197] ERROR in app: Exception on /get_config/wg0 [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "dashboard.py", line 779, in get_conf
    "peer_data": get_peers(config_name, search, sort),
  File "dashboard.py", line 327, in get_peers
    get_all_peers_data(config_name)
  File "dashboard.py", line 269, in get_all_peers_data
    search = db.search(peers.id == i['PublicKey'])
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 233, in search
    docs = [doc for doc in self if cond(doc)]
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 233, in <listcomp>
    docs = [doc for doc in self if cond(doc)]
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 603, in __iter__
    for doc_id, doc in self._read_table().items():
  File "/usr/local/lib/python3.7/dist-packages/tinydb/table.py", line 653, in _read_table
    tables = self._storage.read()
  File "/usr/local/lib/python3.7/dist-packages/tinydb/storages.py", line 125, in read
    return json.load(self._handle)
  File "/usr/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4504 (char 4503)
10.7.0.3 - - [19/Nov/2021 06:29:34] "GET /get_config/wg0?search= HTTP/1.1" 500 -

To Reproduce
It is running on a raspberry pi 4. It is installed with all recommendations/guidelines provided from this github wiki/installation instructions.

OS Information:

  • OS: dietpi 7.8.2
  • Python Version: 3.7.3

Sample of your .conf file

[Interface]
Address = 10.7.0.1/24
SaveConfig = true
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
PrivateKey = [SNIP]

[Peer]
PublicKey = [SNIP]
PresharedKey = [SNIP]
AllowedIPs = 10.7.0.2/32
Endpoint = [SNIP]:60308

[Peer]
PublicKey = [SNIP]
PresharedKey = [SNIP]
AllowedIPs = 10.7.0.3/32
Endpoint = [SNIP]:63366

[Peer]
PublicKey = [SNIP]
PresharedKey = [SNIP]
AllowedIPs = 10.7.0.4/32

[Peer]
PublicKey = [SNIP]
AllowedIPs = 10.7.0.10/32
@nicedevil007 nicedevil007 added the bug Something isn't working label Nov 19, 2021
@donaldzou
Copy link
Owner

donaldzou commented Nov 19, 2021

Hi, did you gave permission to read /etc/wireguard? Typically you will need 644, or you can run it with sudo

@donaldzou donaldzou self-assigned this Nov 19, 2021
@borjaevo
Copy link

Same problem here. I have read permissions on /etc/wireguard

@donaldzou
Copy link
Owner

Hi @borjaevo , I'm sorry you're encountering trouble with the dashboard. I'm wondering do you have read permission for the .conf file inside the directory and execution permission for the directory except read?

@borjaevo
Copy link

Hi @borjaevo , I'm sorry you're encountering trouble with the dashboard. I'm wondering do you have read permission for the .conf file inside the directory and execution permission for the directory except read?

Yes, it has read permissions for directory and for the file. I have other files in the directory that are not .conf files, could this produce this problem? Also, my wg0.conf file was created before the installation of wg-dashboard but its working well.

@donaldzou
Copy link
Owner

donaldzou commented Nov 23, 2021

Yes, I think the non .conf might be causing the crash. Could you remove them and try again? And also remove any .json files under the db directory in the WGDashboard

@borjaevo
Copy link

borjaevo commented Nov 24, 2021

Yes, I think the non .conf might be causing the crash. Could you remove them and try again? And also remove any .json files under the db directory in the WGDashboard

Hello! I did both things and restart the service but its stuck. It goes until 80% of the progress bar aprox, but stops there forever. In db directory there was only one file wg0.json.

@donaldzou
Copy link
Owner

Hmmmm this is super weird. Could you paste the log from flask please? Thanks!

@borjaevo
Copy link

Hmmmm this is super weird. Could you paste the log from flask please? Thanks!

Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: File "/home/borja/wgdashboard/src/dashboard.py", line 779, in get_conf
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: "peer_data": get_peers(config_name, search, sort),
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: File "/home/borja/wgdashboard/src/dashboard.py", line 327, in get_peers
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: get_all_peers_data(config_name)
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: File "/home/borja/wgdashboard/src/dashboard.py", line 315, in get_all_peers_data
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: get_transfer(config_name, db, peers)
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: File "/home/borja/wgdashboard/src/dashboard.py", line 219, in get_transfer
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: total_sent = cur_i[0]['total_sent']
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: IndexError: list index out of range
Nov 25 08:49:13 DEB-WIREGUARD1 python3[239769]: 192.168.1.21 - - [25/Nov/2021 08:49:13] "#33[35m#033[1mGET /get_config/wg0?search= HTTP/1.1#033[0m" 500 -

@borjaevo
Copy link

Hello, any news about this?

@donaldzou
Copy link
Owner

Hello, any news about this?

Hi, sorry I've been super busy recently. Could you also provide a sample of your wireguard configuration please? Thanks a lot!

@ikidd
Copy link
Contributor

ikidd commented Dec 11, 2021

I was getting the same symptom as this, hanging going into the tunnel's configuration file.

#108

Fixing the invalid character at the end of the json file for that tunnel in the /db folder fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants