No, I don't think so.
#!/usr/local/bin/php
<?php
require_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 != "102@igc0") exit;
if (!in_array($type, ['MASTER', 'BACKUP'])) exit;
switch ($type) {
case 'MASTER':
$config['OPNsense']['wireguard']['general']['enabled'] = '1';
write_config("Enable WireGuard due to CARP event on '{$subsystem}'", false);
log_msg("Starting WireGuard due to CARP event '$type' on '{$subsystem}'");
break;
case 'BACKUP':
$config['OPNsense']['wireguard']['general']['enabled'] = '0';
write_config("Disable WireGuard due to CARP event on '{$subsystem}'", false);
log_msg("Stopping WireGuard due to CARP event '$type' on '{$subsystem}'");
break;
}
use OPNsense\Core\Backend;
$backend = new Backend();
$backend->configdRun('template reload OPNsense/Wireguard');
$backend->configdpRun('wireguard configure');
#!/usr/local/bin/php
<?php
require_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 != "102@igc0") exit;
if (!in_array($type, ['MASTER', 'BACKUP'])) exit;
switch ($type) {
case 'MASTER':
$config['OPNsense']['wireguard']['general']['enabled'] = '1';
write_config("Enable WireGuard due to CARP event on '{$subsystem}'", false);
log_msg("Starting WireGuard due to CARP event '$type' on '{$subsystem}'");
break;
case 'BACKUP':
$config['OPNsense']['wireguard']['general']['enabled'] = '0';
write_config("Disable WireGuard due to CARP event on '{$subsystem}'", false);
log_msg("Stopping WireGuard due to CARP event '$type' on '{$subsystem}'");
break;
}
use OPNsense\Core\Backend;
$backend = new Backend();
$backend->configdRun('template reload OPNsense/Wireguard');
$backend->configdpRun('wireguard configure');
"