Using pluginctl with wireguard tunnels?

Started by Flamez, August 24, 2023, 06:08:26 PM

Previous topic - Next topic
I am wanting to stop and start a couple different wireguard tunnels at a preset time each day. I used to be able to do this with OpenVPN using "pluginctl -s openvpn start <tunnel name>" inside a cron job.

So far, I have only been able to use pluginctl -s wireguard start to start and pluginctl -s wireguard stop. This start/stops all wireguard tunnels at the same time.   I tried using the tunnel name and it didn't work.

Any ideas?

Thank you.

os-wireguard-devel on 23.7.2 already has that extension, but we are still testing as it is more or less a fundamental change.

See https://github.com/opnsense/plugins/commit/86c9e5ccc87ca


Cheers,
Franco

Thank you for the fast response.  Looking forward to the update.

-Flamez

Feel free to try it as well if you already updated to 23.7.2:

# pkg install os-wireguard-devel

and to get back

# pkg install os-wireguard(-go)

depending on the kmod/go variant used.

It probably needs a restart to be started properly.


Cheers,
Franco

I first removed the wireguard plugin and then installed the os-wireguard-devel.  I did a reboot of the firewall, and everything came online normal. Reviewing the firmware plugins page, I noticed it showed the plugin os-wireguard-devel (misconfigured).   It did not show this before.  Both vpn tunnels seem to be working just fine.

What would be the correct command to start or stop an individual vpn tunnel?

Thank you,

-Flamez

You can list all instances:

# pluginctl -S wireguard

Use <id> like with OpenVPN:

# pluginctl -s wireguard restart <id>


Cheers,
Franco

That worked!   Reviewing the firmware plugins page, I noticed it showed the plugin os-wireguard-devel (misconfigured). Is the normal since it's a development version?  I did notice under vpn/wireguard there is a log file tab now.  It shows 3 errors, and everything seems to be working ok.


Thank you so much for your help with this.  I will continue to test and let you know if i run into any issues.

-Flamez

Thanks a lot for testing. Ad did a very nice job on this one it seems.

The "misconfigured" is because it was installed from the console, because development versions cannot be installed from the GUI. But under System: Firmware: Status you can select "Resolve plugin conflicts" and activate "Reset all local conflicts" which marks os-wireguard-devel as properly installed.


Cheers,
Franco

I am finally getting back to work on setting up cron jobs to start and stop wireguard instances at a specific time each day and I was wondering if there is a way to add these commands to the drop-down menu in the cron section so I could pick to them from the menu and just add the cron times in the web GUI?

Thank again for all your help.

-Flamez