gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.52k stars 552 forks source link

[Bug]: Ext. Clients belonging to deleted Ingress Gateway can't be deleted #970

Closed rinlabs closed 2 years ago

rinlabs commented 2 years ago

Contact Details

No response

What happened?

Can't delete External Clients after deleting their gateway. The old external clients are still able to be edited or disabled. rhino1 rhino2

Regards

Version

v0.12.1

What OS are you using?

Linux

Relevant log output

[netmaker] 2022-03-26 10:04:17 processed request error: no result found

Contributing guidelines

WXpiero commented 2 years ago

wired things happened to me too, add 2 harmony phones under the same gateway, one is connectable, the other can't。after i creat a new network, they both can't connect to gateway and shows "bad address “prompt, but my windows laptop can connect to that gateway by importing the conf file.

kellervater commented 2 years ago

yep, can confirm this issue. Tested in v0.12.2 After deleting an Ingress Gateway without properly removing the external clients before, they'll remain indefinetely (at least in the UI). It's more of a minor issue I guess, but I gotta admit I haven't tested if connections of those clients are still valid.

susanthenerd commented 2 years ago

I can confirm this issue as well

0xdcarns commented 2 years ago

@ppoetz @cristiioan do the ext clients persist if you refresh after removing the ingress status?

kellervater commented 2 years ago

In my case, yes. Since I'm still evaluating a docker volume purge did the trick for me.

0xdcarns commented 2 years ago

I've still been toiling with this issue and I can't seem to replicate. If someone can provide some repeatable steps for this, that would be helpful. Like did you have 2 browser tabs open and deleted the gateway in one and are viewing the other..?

BOZG commented 2 years ago

I've still been toiling with this issue and I can't seem to replicate. If someone can provide some repeatable steps for this, that would be helpful. Like did you have 2 browser tabs open and deleted the gateway in one and are viewing the other..?

I had this issue but ended up resolving it by starting over so can't give you repeatable steps unfortunately but maybe my scenario might provide some ideas!

In my case, my ingress gateway completely disappeared from the network after a netclient update (0.14 -> 0.14.1). The client config also disappeared so I needed to create a new access key to rejoin the network. After rejoining and reconfiguring the ingress gateway to match the original configuration, the external clients that I'd created previously showed up but were unusable (QR-code didn't work, downloading config resulted in a "Not found" error).

Tried deleting them but had same issue as mentioned above. If I remember correctly, the logs had an error reference to what I assume was the original id for the gateway as well as the error mentioned by OP in the first post. After renaming the dead configs, some of them disappeared but not all.

afeiszli commented 2 years ago

Based on that, my first guess is a gap in the code that causes the ingress gateway settings from a node to go missing, without running the delete function. If this were to happen, it would lead to the ext clients not getting deleted, but there's no longer an attached ingress gateway. We'll have to do some investigation into where that gap might be.

kellervater commented 2 years ago

In v0.14.0 I cannot reproduce this issue anymore. But I did a complete purge of all docker volumes (since some breakingISH changes in 0.13.x), so I cannot tell if "graceful" updates behave the same.

BOZG commented 2 years ago

In v0.14.0 I cannot reproduce this issue anymore. But I did a complete purge of all docker volumes (since some breakingISH changes in 0.13.x), so I cannot tell if "graceful" updates behave the same.

I was using a fresh install of 0.14.0 when issue occurred for me so it sounds like purging volumes resolved it.

lorenzo95 commented 2 years ago

This still happens in 0.14.2. Looks to me like the ext configs aren't being cleaned up when the node is deleted.

When I have a netclient node with an ext config attached to it and I delete and re-join the node, the ext client config comes back in the ui but not on the node itself (doesn't get configured in wireguard). Then, it also can't be deleted. I can add/remove new ones but can't touch the old one.

Almost feels like they are being tracked by hostname. I was expecting that by deleting/leaving the node and re-joining it, it would give it a different uuid and therefore the old ext clients wouldn't come back. But they do and that's not an expected/wanted behavior.

To reproduce: -make node ingress -create ext config -go to node and leave network -join node back to network -check ext client in ui and try to delete (also note that "wg show" doesn't show it)

afeiszli commented 2 years ago

This is fixed as of 0.14.3. However, it does not fix this problem in existing servers that upgrade. For these, you will need to delete the ext clients from the database.

nitsujri commented 1 year ago

@afeiszli this happened to me when i upgraded from 0.17.1 to 0.18.5. Just an FYI thanks.