config['OPNsense']['wireguard']['general']['enabled'] = '0';
use OPNsense\Core\Backend;$backend = new Backend();$backend->configdRun('template reload OPNsense/Wireguard');$backend->configdpRun('wireguard configure');
pluginctl -s wireguard stop
#!/usr/local/bin/php<?phprequire_once("config.inc");require_once("util.inc");require_once("interfaces.inc");$subsystem = !empty($argv[1]) ? $argv[1] : '';$type = !empty($argv[2]) ? $argv[2] : '';if ($subsystem != "1@igb1") exit;if (!in_array($type, ['MASTER', 'BACKUP'])) exit; switch ($type) { case 'MASTER': shell_exec("/usr/local/sbin/pluginctl -s wireguard start"); log_msg("Starting WireGuard due to CARP event '$type' on '{$subsystem}'"); break; case 'BACKUP': shell_exec("/usr/local/sbin/pluginctl -s wireguard stop"); log_msg("Stopping WireGuard due to CARP event '$type' on '{$subsystem}'"); break; }