wireguard-ui
wireguard-ui copied to clipboard
Clients generated with UI does not work
I have installed wireguard with road-warrior script. It works really very good. Then I run 'sudo ./wireguard-ui.sh' and web ui server starts at port 5000. In Status tab it also shows all clients added by above script. I also updated private and public keys of interface from old /etc/wireguard/wg0.conf (generated by road warrior script) and updated interface address to 10.7.0.1/24 (this interface adress is also generated by roadwarror script). But when I add any client with your web-ui, It is displayed under Clients tab and also in /etc/wireguard/wg0/conf but not shown in Status Tab. Moreover any generated config file or QR code does not connect to the server. Only files generated with script works.
Update
Finally I found a solution. After every client addition or deletion You must run "sudo systemctl restart wg-quick@wg0" in terminal after clicking on "Apply Config" Button.
I also tried installing wireguard-ui without above script. There is no any documentation of how to install wireguard and what to configure and when to run sudo ./wireguard-ui. But anyway here are steps that I made on a new new clean server which had never a wireguard server before:
- I installed wireguard by sudo apt install wireguard wireguard-tools.
- Then I ran sudo ./wireguard-ui and thats all. This ways UI is not even able to generate a interface and again clients generated do not connect to server.
WireGuard-UI only takes care of configuration generation. You can use systemd to watch for the changes and restart the service. Following is an example:
systemd Create /etc/systemd/system/wgui.service
[Unit]
Description=Restart WireGuard
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart [email protected]
[Install]
RequiredBy=wgui.path
Create /etc/systemd/system/wgui.path
[Unit]
Description=Watch /etc/wireguard/wg0.conf for changes
[Path]
PathModified=/etc/wireguard/wg0.conf
[Install]
WantedBy=multi-user.target
Apply it
systemctl enable wgui.{path,service}
systemctl start wgui.{path,service}
restarting wg-quick@wg0 removes all recorded stats. No need to restart the interface just upload new configuration to interface.
restarting wg-quick@wg0 removes all recorded stats. No need to restart the interface just upload new configuration to interface. @afzl-wtu do you mean you used systemd to watch for the changes and upload new configuration to interface ? how did you do that ? Thanks
No need to restart the interface just upload new configuration to interface.
how did you do that ?
Change the ExecStart
line in the unit file to this (adjust paths as necessary):
ExecStart=/usr/bin/wg syncconf wg0 <(/usr/bin/wg-quick strip /etc/wireguard/wg0.conf)
This won't apply all changes to the interface itself, though, as certain options are only understood by wg-quick
(hence the wg-quick strip
command). But for just adding/removing/enabling/disabling clients without bumping others off, this is perfect.
See the wg-quick
manpage for a list of those items that won't be refreshed. When changes are made for these options in wireguard-ui, you'll have to restart wireguard manually, if you use the ExecStart
line above.
restarting wg-quick@wg0 removes all recorded stats. No need to restart the interface just upload new configuration to interface. @afzl-wtu do you mean you used systemd to watch for the changes and upload new configuration to interface ? how did you do that ? Thanks
Sorry for Late reply. There is a command in this script that After adding new configuration to /etc/wireguard/wg0.conf again adds the new added client configuaration to wireguard interface directly. So no need to create systemd and keep watching for changes in the file.
https://github.com/Nyr/wireguard-install
ExecStart=/usr/bin/wg syncconf wg0 <(/usr/bin/wg-quick strip /etc/wireguard/wg0.conf)
i'm new to this, are you referring to this line?
# Append new client configuration to the WireGuard interface
wg addconf wg0 <(sed -n "/^# BEGIN_PEER $client/,/^# END_PEER $client/p" /etc/wireguard/wg0.conf)
if so, how should this be for this setup?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.