gravitl / netmaker

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

Request: please add support for non-mqtt clients that just polls for network changes #1643

Open dionorgua opened 1 year ago

dionorgua commented 1 year ago

Contact Details

dion@inhex.net

What happened?

I've played a bit with netmaker gui, installed it on a few devices and really like it.

They only limitation that I see is that there is no full-featured client for Android phone and I can't install it on Mikrotik router. I understand that native Android client is just question of time. But adding Netmaker support to Mikrotik router is almost impossible (without some agreement from Mikrotik itself)

I also understand that I can use Wireguard-capable device by using ingress gateway. But I don't like fact that:

At the same time I think that Netmaker already contains most of stuff needed for almost perfect support of such devices. Basically followed things are needed:

  1. Netmaker server should provide certain HTTP endpoint to get actual Wireguard config file with all known peers and their endpoints. Either real wireguard config or just JSON.
  2. Client should be able to share it's own addresses via same request or via additional request. And server should be able to update it's knowledge with this information and notify all MQTT-aware clients if it's changed.
  3. Client can do same HTTP request periodically to update it's wireguard config
  4. Netmaker server should know that this client is feature-limited and will not connect via MQTT. Instead of showing 'WARNING' when there is no MQTT, it should also consider how much time passed since previous poll.

This setup will keep most benefits of mesh network and at the same time will eliminate requirements to use netmaker client to get it working. Surely such 'polling' client will be unable to do NAT traverse itself, but it'll be able to connect to nodes with public IP address and likely will be able to connect to nodes that are running netclient (so that NAT traverse will be performed by netclient on other side)

I think everything except last one is already possible. But main issue here is that this is not public API so it's not documented and may change at any time.

As about Mikrotik routers: they supports wireguard (with static configuration). Plus they have scripting language that has enough features to implement such 'polling' client fully in user script.

Version

v0.16.0

What OS are you using?

Unlisted

Relevant log output

No response

Contributing guidelines

dionorgua commented 1 year ago

I've already tried to implement such 'client' for Mikrotik router. it's certainly possible. Followed curl request can be used to get actual config:

curl -v  "https://api.example.com/api/nodes/mynet/a736137e-33a8-47c4-9017-a8d8af4f879d" -H "Authorization: Bearer myHash"

A few issues:

pete1019 commented 1 year ago

Making netclient work with Mikrotik would be so cool.