NHAS / wag

Simple Wireguard 2FA
BSD 3-Clause "New" or "Revised" License
499 stars 27 forks source link

Server Error after deleting a user #65

Closed Cody7172 closed 10 months ago

Cody7172 commented 11 months ago

Hello! Noticed a (possible) bug:

  1. Create a token
  2. Register the user with this token
  3. Delete this created user
  4. After deleting, it is impossible to enter the Firewall State section in GUI, it displays just “Server Error” With the same error I can't request the configuration for the next created user After restarting WAG everything works correctly again, but inconvenient Using docker container fyi Can anyone please confirm that this error exists, or what should I do to avoid this server error?
NHAS commented 11 months ago

Howdy, I need some more information to replicate.

What version are you on?

Can you provide your server logs?

NHAS commented 11 months ago

Yeah I cant replicate this with my current setup.

Which is Wag v7.3.1-35-ga3348c2 via docker.

I already have 1 user, not sure if you were doing with a blank setup.

I go create registration token for user abc . Use said token, then delete said user and all is fine.

Cody7172 commented 11 months ago

Thanks for the response! I'm using v7.3.1 from August 16 Here is what the error looks like in the logs:

WAG[6186]: 2023/10/03 04:25:02 registration token for  test created
WAG[6186]: 2023/10/03 04:28:13 test *ip* successfully registered as *ip* : *some-token*
WAG[6186]: 2023/10/03 04:28:34 test deleted
WAG[6186]: 2023/10/03 04:28:38 error getting firewall rules data Error: lookup: key does not exist

Also here is error related to "unable to receive conf for next created user":

WAG[6186]: 2023/10/04 11:48:09 registration token for  *new user* created
WAG[6186]: 2023/10/04 11:49:05 *user* *ip* unable to add device:  attempted to add a device with address that already exists
NHAS commented 11 months ago

Huhhhh. Well that's certainly interesting. To provide context.

That first error is saying that when the user was created it was not added to the ebpf firewall map.

But then the second error says that it was added.

Does this happen on a completely fresh install? I.e new database?

Could you also provide your kernel version and distro?

Cody7172 commented 11 months ago

Distro and kernel are Amazon Linux 2 with Linux 5.10.192-182.736.amzn2.x86_64 x86_64 Most likely not happens on fresh, I tested adding/removing/configuring users before, and didn’t notice anything like that I'll keep an eye on it to see what could be causing this problem

NHAS commented 11 months ago

Ah alright, sweet, definitely super weird that its happening but if its not reproducible then Im not sure what to do about it. Thanks for those details tho!

I have just added more logging to the API endpoints on failure on the unstable branch. But obviously not released.

If you have a db that has routinely caused this then I might ask you to share that

NHAS commented 10 months ago

I am going to close this issue as I cannot replicate.

If you (or anyone else) experience this issue again feel free to reopen it