Closed sznees closed 2 months ago
Hi @sznees,
Had same issue, I've (dirty)fixed this by modifying systemd file. As you probably know by now, there is systemd monitor (/etc/systemd/system/wgui.path) that monitors wireguard config file /etc/wireguard/wg0.conf (or whatever you use as config file) for any changes. If changes are detected (when you press Apply Config for example), systemd service wgui (/etc/systemd/system/wgui.service) is triggered. Thing is that wgui.service uses wg-quick down/up sequence, which disconnects all clients and causes WireGuard downtime (about 5–10 seconds in my case). So...
Just one note, I'm using the wireguard-ui binary on ubuntu 20.04, if you're using docker I'm not sure if this will help you... (modifying docker container maybe?!)
After googling a little bit, found this to be very useful, it turns out that "wg syncconf" command will apply changes without downtime, so I've:
#!/bin/bash
echo "Wireguard UI: Reloading wireguard after config change (wg0)."
/usr/bin/wg syncconf wg0 <(/usr/bin/wg-quick strip wg0)
chmod +x /usr/local/bin/gw_reload.sh
[Unit]
Description=Restart WireGuard
After=network.target
[Service] Type=oneshot
ExecStart=/usr/local/bin/wg_reload.sh
[Install] RequiredBy=wgui.path
5. After saving changes in wgui.service, i had to reload systemd configuration in terminal
> systemctl daemon-reload
6. Make some changes in WireguardUI web interface (add/delete client), press Apply Config, watch output of journalctl -f in your terminal and deal with the errors :)
> ... systemd[1]: Starting Restart WireGuard...
> ... wg_reload.sh[7128]: Wireguard UI: Reloading wireguard after config change (wg0).
> ... systemd[1]: wgui.service: Succeeded.
> ... systemd[1]: Finished Restart WireGuard.
I hope this helps or at least points you in the right direction...
Hello @beginho!
Thank you a lot for the exact description of your solution. It works perfect! :)
Hello there,
my issue is following: When I apply the config to add a new user, every other user gets disconnected and needs to reconnect. Is there any way, to add and activate an user without executing "apply config"? Like saving each user in a single file or something like that.
Would be great, if there is any way.