Fix: Add missing $ in sync script and skip invalid clients

This commit is contained in:
infosave2007
2026-01-24 21:16:57 +03:00
parent f51606b6f7
commit 94be6f9b2f
+6 -2
View File
@@ -98,6 +98,10 @@ try {
foreach ($clients as $client) { foreach ($clients as $client) {
$pub = $client['public_key']; $pub = $client['public_key'];
if (empty($pub)) {
echo "Skipping client {$client['id']} (Empty Public Key)\n";
continue;
}
$psk = $client['preshared_key']; $psk = $client['preshared_key'];
$ip = $client['client_ip']; $ip = $client['client_ip'];
$allowed = $client['allowed_ips'] ?? "$ip/32"; // Fallback to IP/32 $allowed = $client['allowed_ips'] ?? "$ip/32"; // Fallback to IP/32
@@ -110,8 +114,8 @@ try {
} }
// 5. Write Config // 5. Write Config
// Use host path if possible for safety // Use host path that matches container volume (-v /opt/amnezia/awg:/opt/amnezia/awg)
$hostConfPath = '/opt/amnezia/amnezia-awg/wg0.conf'; $hostConfPath = '/opt/amnezia/awg/wg0.conf';
$escaped = addslashes($conf); $escaped = addslashes($conf);
$server->executeCommand("echo \"$escaped\" > $hostConfPath", true); $server->executeCommand("echo \"$escaped\" > $hostConfPath", true);