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

Upgraded from v4.1.4 to v4.2.0-dev UI timedout #613

Closed
donaldzou opened this issue Feb 14, 2025 · 17 comments
Closed

Upgraded from v4.1.4 to v4.2.0-dev UI timedout #613

donaldzou opened this issue Feb 14, 2025 · 17 comments

Comments

@donaldzou
Copy link
Owner

Just upgraded from 4.1.4 to 4.2-dev [3af84e01] and it seems there's a gui timeout that is forcing me out of the configuration interface, even if i've been making changes within the last 30s or so.

I don't see where anything like that is exposed in the GUI, so I'm not sure how to deal with it.

There are no messages in the error or access logs that correspond to the session timing out, nor is journalctl showing the actual service restarting.

Originally posted by @akhepcat in #461

@DaanSelen

@donaldzou
Copy link
Owner Author

@akhepcat Did you restart the service after upgrading?

@akhepcat
Copy link

Fully restarted the container.

Very reproducable here. here's three tests:

  1. sign in

  2. screen refreshes to default, showing existing wg configs

  3. (wait 2 minutes no timeouts)

  4. logout

  5. sign in again

  6. screen refreshes to default

  7. click on first wg server config

  8. wait 2 minutes - note that server auto-logs out in ~60 seconds

  9. log back in

  10. screen refreshes to default

  11. click on first wg server config

  12. add new peer

  13. race to complete before timeout

@akhepcat
Copy link

akhepcat commented Feb 14, 2025

Okay, it looks like it's a bug in the refresh code interval inside the server configuration page, at the bottom by the peers list

I can set it to 5 seconds, and am nearly immediately logged out.
I can set it to 30 seconds, and the logout follows that new time

@donaldzou
Copy link
Owner Author

donaldzou commented Feb 14, 2025

This is super weird.. Is it possible for you to run in debug mode with: ./wgd.sh debug? And paste whatever you see in the console when it logs you out please?

@akhepcat
Copy link

akhepcat commented Feb 14, 2025

Also, left myself logged in overnight at the main screen, no timeout.

My best guess (i'm restarting into debug mode now) is that the refresh is somehow not using the correct url, or isn't saving state somewhere, such that it's forgetting that we're already logged in.

I'm using chrome 133 on linux and android mobile; i can also try firefox and check it, and probably safari on ipad, too.

oh, prior to restarting in debug mode, i'm removing all __pycache__ just in case

@akhepcat
Copy link

akhepcat commented Feb 14, 2025

Chrome linux- log in, look at server config, select 1m refresh, and wait:

127.0.0.1 - - [14/Feb/2025 07:52:24] "GET /api/getDashboardTheme HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:24] "GET /api/isTotpEnabled HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:24] "GET /api/getDashboardVersion HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:31] "POST /api/authenticate HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:31] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:31] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:32] "GET /api/getWireguardConfigurations HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:32] "GET /api/getDashboardUpdate HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:33] "GET /api/systemStatus HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:37] "GET /api/validateAuthentication HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:37] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:37] "GET /api/systemStatus HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:38] "GET /api/getWireguardConfigurationInfo?configurationName=wg-hepcat HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:42] "POST /api/updateDashboardConfigurationItem HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:52:42] "GET /api/getDashboardConfiguration HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getWireguardConfigurationInfo?configurationName=wg-hepcat HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getWireguardConfigurationRealtimeTraffic?configurationName=wg1 HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getDashboardTheme HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getDashboardVersion HTTP/1.0" 200 -
127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/isTotpEnabled HTTP/1.0" 200 -

@akhepcat
Copy link

Validated on Safari/ipad, which i've never used to log into this at all ever before, functions the same way, in that after a 1 minute pause while looking at the wg server + peers screen, the screen refresh jumps back to the login.

I do not currently have 2FA enabled, fwiw.

@donaldzou
Copy link
Owner Author

Chrome linux- log in, look at server config, select 1m refresh, and wait:

127.0.0.1 - - [14/Feb/2025 07:52:24] "GET /api/getDashboardTheme HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:24] "GET /api/isTotpEnabled HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:24] "GET /api/getDashboardVersion HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:31] "POST /api/authenticate HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:31] "GET /api/validateAuthentication HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:31] "GET /api/getDashboardConfiguration HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:32] "GET /api/getWireguardConfigurations HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:32] "GET /api/getDashboardUpdate HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:33] "GET /api/systemStatus HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:37] "GET /api/validateAuthentication HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:37] "GET /api/getDashboardConfiguration HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:37] "GET /api/systemStatus HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:38] "GET /api/getWireguardConfigurationInfo?configurationName=wg-hepcat HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:42] "POST /api/updateDashboardConfigurationItem HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:52:42] "GET /api/getDashboardConfiguration HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getWireguardConfigurationInfo?configurationName=wg-hepcat HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getWireguardConfigurationRealtimeTraffic?configurationName=wg1 HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getDashboardTheme HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/getDashboardVersion HTTP/1.0" 200 - 127.0.0.1 - - [14/Feb/2025 07:53:38] "GET /api/isTotpEnabled HTTP/1.0" 200 -

Okay... seems like a frontend issue. Can you pull the latest v4.2-dev again and see there's any output in your browser's console?

@akhepcat
Copy link

No change:

cd /etc/wgdashboard/src && tar -cpvf ~/wgd.tar db *.ini
db/
db/wgdashboard.db
db/wgdashboard_job.db
db/wgdashboard_log.db
certbot.ini
ssl-tls.ini
wg-dashboard.ini

cd /etc
rm -rf wgdashboard

git clone https://github.com/donaldzou/WGDashboard.git -b v4.2-dev wgdashboard
cd wgdashboard/src/ && tar -xvf ~/wgd.tar

./wgd.sh install
[snip]
[WGDashboard] ✅ WGDashboard installed successfully!
[WGDashboard] Enter ./wgd.sh start to start the dashboard

systemctl start wg-dashboard.service

(clear site data from browser cache)

Log in
click into wg config
change refresh to 10 seconds

get kicked out

tail logs/access*.log
127.0.0.1 - - [14/Feb/2025:21:11:27 -0900] "POST /api/updateDashboardConfigurationItem HTTP/1.0" 200 46 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [14/Feb/2025:21:11:27 -0900] "GET /api/getDashboardConfiguration HTTP/1.0" 200 944 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [14/Feb/2025:21:11:37 -0900] "GET /api/getWireguardConfigurationInfo?configurationName=wg-test HTTP/1.0" 200 4597 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [14/Feb/2025:21:11:37 -0900] "GET /api/getWireguardConfigurationRealtimeTraffic?configurationName=wg1 HTTP/1.0" 200 70 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [14/Feb/2025:21:11:38 -0900] "GET /api/getDashboardTheme HTTP/1.0" 200 45 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [14/Feb/2025:21:11:38 -0900] "GET /api/isTotpEnabled HTTP/1.0" 200 44 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
127.0.0.1 - - [14/Feb/2025:21:11:38 -0900] "GET /api/getDashboardVersion HTTP/1.0" 200 47 "https://wgvpn.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"

@donaldzou
Copy link
Owner Author

Oh I meant when you do a right-click on the page, Inspect Element, you should see a console. Do you see any errors?

@akhepcat
Copy link

Ah, yes, i'm seeing this when the page times out and refreshes:

TypeError: Cannot read properties of null (reading 'sent')
at peerListNew-BHx1hJUw.js:2:1694
at index-DlNxBlsu.js:41:7045
at async jr (index-DlNxBlsu.js:41:6784)
at async m (peerListNew-BHx1hJUw.js:2:1568)

@donaldzou
Copy link
Owner Author

Image

Is it possible for you to show me the very last request before it kicks you out please?

@akhepcat
Copy link

akhepcat commented Feb 15, 2025

Okay, here's what's changing between events:

I pre-set the refresh to 10 seconds, then backed out of the configuration screen.

Then, going back into it, i see that there's a cookie being set:

Request: https://wgvpn.local/api/getWireguardConfigurationInfo?configurationName=wg-test
date: Sat, 15 Feb 2025 08:19:42 GMT
set-cookie: session=.eJwFwTEOgzAMBdC7eGbAcWwnXKYy-HcjqgJMVe_e9770-mCeMTBu2u75YKHnwhxxgjYqCHZZu3nu3BgSZtDO-S4qLnvV6tI0EZbZe4nItR7cvLiywen3B9faHH4.Z7BOHg.frLhqlC7j9Ln3J55dUSrdT5Igp4; Expires=Tue, 18 Mar 2025 08:19:42 GMT; HttpOnly; Path=/

10 seconds later, there's a refresh:

Request: https://wgvpn.local/api/getWireguardConfigurationInfo?configurationName=wg-test
date: Sat, 15 Feb 2025 08:19:52 GMT
set-cookie: session=.eJwFwTEOgzAMBdC7eGbAcWwnXKYy-HcjqgJMVe_e9770-mCeMTBu2u75YKHnwhxxgjYqCHZZu3nu3BgSZtDO-S4qLnvV6tI0EZbZe4nItR7cvLiywen3B9faHH4.Z7BOKA.cM7VCL4JOLH8I1KCdBIEQ0skBkY; Expires=Tue, 18 Mar 2025 08:19:52 GMT; HttpOnly; Path=/

(these are the only changes)

But then there's a bounce back to a different page:

Request URL: https://wgvpn.local/api/getWireguardConfigurationRealtimeTraffic?configurationName=wg1
date: Sat, 15 Feb 2025 08:19:52 GMT
set-cookie: session=.eJwFwTEOgzAMBdC7eGbAcWwnXKYy-HcjqgJMVe_e9770-mCeMTBu2u75YKHnwhxxgjYqCHZZu3nu3BgSZtDO-S4qLnvV6tI0EZbZe4nItR7cvLiywen3B9faHH4.Z7BOKA.cM7VCL4JOLH8I1KCdBIEQ0skBkY; Expires=Tue, 18 Mar 2025 08:19:52 GMT; HttpOnly; Path=/

and this is where the logout happens

Note that there is no configuration in my server called 'wg1'

curl https://wgvpn.local/api/getWireguardConfigurationRealtimeTraffic?configurationName=wg1
{"data":null,"message":"Configuration does not exist","status":false}

confirmed with sqlite dumping wgdashboard.db, there is no 'wg1'
sqlite3 wgdashboard.db '.dump' | grep wg1 | wc -l
0

@donaldzou
Copy link
Owner Author

OMGGGG... I have to admit I'm dumb sometimes.. it was hardcoded by myself during testing :(

@donaldzou
Copy link
Owner Author

Just pushed a commit and should be good now :)

@akhepcat
Copy link

That's done it! phew!

@donaldzou
Copy link
Owner Author

I will close this for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants