<?php define('DASHBOARD_ROOT', realpath(__DIR__ . '/..')); require_once DASHBOARD_ROOT . '/index.php'; $opts = getopt('', ['node-a-id:', 'node-b-id:', 'iface-a:', 'iface-b:', 'status:']); $nodeA = $opts['node-a-id'] ?? ''; $nodeB = $opts['node-b-id'] ?? ''; $ifaceA = $opts['iface-a'] ?? ''; $ifaceB = $opts['iface-b'] ?? ''; $status = $opts['status'] ?? 'unknown'; if (!$nodeA || !$nodeB) { echo "Missing node IDs\n"; exit(1); } $meta = json_encode([ 'tunnel_type' => 'stealth_p2p', 'node_a' => $nodeA, 'node_b' => $nodeB, 'iface_a' => $ifaceA, 'iface_b' => $ifaceB, 'status' => $status, 'provisioned_at' => date('Y-m-d H:i:s'), 'provisioned_by' => 'wg_provision.sh' ]); $encMeta = Encryption::encrypt($meta, 'product'); Database::execute( "INSERT INTO events (category, action, target_type, target_id, admin_id, meta, ip_address, created_at)      VALUES ('fleet', 'wg_tunnel_provisioned', 'node', :nid, 0, :meta, '127.0.0.1', NOW())", [':nid' => $nodeA, ':meta' => $encMeta] ); echo "Stored.\n"; 