Hi,
I´ve a static wireguard connection to a server with an variable IP-address.
So I set an monit service with testing ping over the tunnel.
I want to restart tunnel with /usr/local/bin/wg-quick up wg2.
This works fine. but after last update /usr/local/bin/wg-quick doesn´t exists anymore.
Where is wg-quick now?
So how I restart a wireguard server?
os-wireguard-go (missing)
Greets
Byte
wg-quick is a horrible bash script that was removed when we were working on core integration during the 24.1 development phase.
The script you can use is https://github.com/opnsense/core/blob/master/src/opnsense/scripts/Wireguard/wg-service-control.php
Cheers,
Franco
'Thanks, I´ve seen this, but which parameters should I use?
/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart wg2 ?
What is uuid or vhid is this the interface name??
Greets
byte
You can enable the "ID" column from the instances GUI or use the command line for all enabled wireguard instances:
# pluginctl -S wireguard
Cheers,
Franco
Thanks, I will try it.
Greets
Byte
For any lost soul...
If your Wireguard "Instance" Name is e.g. "CB"
/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart $(pluginctl -S wireguard |jq -r '.[]|select(.description|endswith("CB"))|.id')
Quote from: crpb on August 13, 2024, 08:58:23 PM
For any lost soul...
If your Wireguard "Instance" Name is e.g. "CB"
/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart $(pluginctl -S wireguard |jq -r '.[]|select(.description|endswith("CB"))|.id')
Does not seem to work as of OPNsense 24.7.8-amd64
sudo pkg install jq
Fatal error: Uncaught TypeError: flock(): Argument #1 ($stream) must be of type resource, bool given in /usr/local/opnsense/scripts/Wireguard/wg-service-control.php:243
Stack trace:
#0 /usr/local/opnsense/scripts/Wireguard/wg-service-control.php(243): flock(false, 2)
#1 {main}
thrown in /usr/local/opnsense/scripts/Wireguard/wg-service-control.php on line 243
:-\ :( :'(