-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Can't unrestrict peers #441
Comments
Hi! Did you add a peer with the same public key after restricting that peer?
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: xtg ***@***.***>
Sent: Sunday, October 27, 2024 12:10:48 PM
To: donaldzou/WGDashboard ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [donaldzou/WGDashboard] Can't unrestrict peers (Issue #441)
Some peers after being restricted, can't be unrestricted and when I try to, the web session ends and will directed to login page of the panel.
Expected Error / Traceback
***@***.***:~/WGDashboard/src# ./wgd.sh debug
------------------------------------------------------------
[WGDashboard] Starting WGDashboard in the foreground.
[WGDashboard] Initialized Configuration: wg0
[WGDashboard] Initialized Configuration: wg2
[WGDashboard] Initialized Configuration: wg1
[WGDashboard] Background Thread #1 Started
[WGDashboard] Background Thread #2 Started
* Serving Flask app 'WGDashboard'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:10086
Press CTRL+C to quit
127.0.0.1 - - [27/Oct/2024 07:34:02] "GET / HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:02] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:02] "GET /api/getDashboardTheme HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:02] "GET /api/isTotpEnabled HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:02] "GET /api/getDashboardVersion HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:04] "POST /api/authenticate HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:05] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:05] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:05] "GET /api/getWireguardConfigurations HTTP/1.0" 200 -
[WGDashboard] Access Log Error: cannot rollback - no transaction is active
127.0.0.1 - - [27/Oct/2024 07:34:06] "GET /api/getWireguardConfigurationInfo?configurationName=wg0 HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:06] "GET /api/getDashboardUpdate HTTP/1.0" 200 -
[2024-10-27 07:34:33,194] ERROR in app: Exception on /api/allowAccessPeers/wg0 [POST]
Traceback (most recent call last):
File "/root/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "/root/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/root/WGDashboard/src/venv/lib/python3.10/site-packages/flask_cors/extension.py", line 178, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/root/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/root/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/root/WGDashboard/src/dashboard.py", line 1797, in API_allowAccessPeers
return configuration.allowAccessPeers(peers)
File "/root/WGDashboard/src/dashboard.py", line 702, in allowAccessPeers
sqlUpdate("INSERT INTO '%s' SELECT * FROM %s_restrict_access WHERE id = ?"
File "/root/WGDashboard/src/dashboard.py", line 1430, in sqlUpdate
cursor.execute(statement, paramters)
sqlite3.IntegrityError: UNIQUE constraint failed: wg0.id
127.0.0.1 - - [27/Oct/2024 07:34:33] "POST /api/allowAccessPeers/wg0 HTTP/1.0" 500 -
127.0.0.1 - - [27/Oct/2024 07:34:34] "GET /api/getDashboardTheme HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:34] "GET /api/isTotpEnabled HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:34] "GET /api/getDashboardVersion HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:52] "POST /api/authenticate HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:52] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:52] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
[WGDashboard] Access Log Error: cannot commit - no transaction is active
127.0.0.1 - - [27/Oct/2024 07:34:53] "GET /api/getWireguardConfigurations HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:53] "GET /api/getDashboardUpdate HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:54] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:58] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:58] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:58] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
127.0.0.1 - - [27/Oct/2024 07:34:59] "GET /api/getWireguardConfigurationInfo?configurationName=wg0 HTTP/1.0" 200 -
^Z
[1]+ Stopped ./wgd.sh debug
***@***.***:~/WGDashboard/src# ^C
—
Reply to this email directly, view it on GitHub<#441>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGARNUJJCCYTS7UQKX3WQADZ5RRURAVCNFSM6AAAAABQVNTGSGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYTMMRZHE2DQNY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
No I don’t add keys manually, they are generated automatically by the panel. |
I see.. did you used any other tools or script to manage WireGuard? |
Got what happened after some manipulation of the panel. I got a list of all weird bugs here: How did I fixed all the above problems? |
That's weird... Basically how restrict peer works is:
When allow access, it just reverse what restrict did. In this case, the only reason for can't unrestrict is the restricted peer somehow got added back to the WireGuard interface.. because WireGuard itself "think" that peer is no longer existed, but WGDashboard know that peer is just restricted. |
No, never. |
So this is going to be a bug, the only reason 2 separate peers count as one is their public and private keys, adding the same keys for 2 different peers is almost rare as the public key length is high enough to prevent producing the same key for 2 different peers, the problem could be something else. another idea is restricting the peer in another way than deleting it from wg0.cong something like making it comment by putting # at the beginning of each line or adding PSK to the peer to make it unavailable to connect. this way causes WireGuard to detect the peers that exist but are unavailable to connect. |
If you take a deeper look at options 3 and 4 you might realize something which panel is unable to make changes permanent right away, after a reboot or server restart we get some Untitled peers that have not connected for a while(have no last connection time) and usually their statistics are 0, this is where we can look for a bug in something like syncing wg0.conf or making permanent changes to wg0.conf file. |
Some peers after being restricted, can't be unrestricted and when I try to, the web session ends and will directed to login page of the panel.
Expected Error / Traceback
The text was updated successfully, but these errors were encountered: