ngoduykhanh / wireguard-ui

Wireguard web interface
MIT License
3.77k stars 464 forks source link

Please do not prevent IP Allocation with IP addresses outside of the Wireguard subnet #560

Open shawly opened 3 months ago

shawly commented 3 months ago

I have Site2Site connection from my server to a Fritzbox. The Fritzbox does have a custom Wireguard implementation without any transfer networks which means I need to allocate the Fritzboxes OWN IP instead of an IP from my wg network.

When I try to set the IP Allocation to the IP of the Fritzbox, Wireguard UI prevents me from saving this configuration with the error "IP 192.168.178.1 does not belong to any network addresses of WireGuard server".

While I find it ok to warn a user from a possible misconfiguration, I do not think that the UI should prevent saving this configuration since it is indeed a valid config for this use case. So this should be changed from error level to warning level.

I know I can just change the IP in the final config but in cases where I didn't have to manage my Wireguard stuff it is easy to forget things like this so I'd like to have Wireguard UI produce valid and ready to use confs instead of having to edit them after downloading.

This seems to be the line of code: https://github.com/ngoduykhanh/wireguard-ui/blob/2fdafd34ca6c8f7f1415a3a1d89498bb575a7171/util/util.go#L413

gnat commented 2 months ago

Yup I always get hung up on this too, it kinda ruins the wireguard-ui UX unless you know exactly what you're doing.

In my case Address= needs to be 10.10.10.1/24 not 10.10.10.1/32 or wireguard-ui won't let you add clients. I just add both addresses to the server interface as a workaround (even though 10.10.10.1/24 is wrong, I don't think wireguard cares, which is nice).