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 8b0a95c7a1
commit 486c9a862a
+6 -2
View File
@@ -98,6 +98,10 @@ try {
foreach ($clients as $client) {
$pub = $client['public_key'];
if (empty($pub)) {
echo "Skipping client {$client['id']} (Empty Public Key)\n";
continue;
}
$psk = $client['preshared_key'];
$ip = $client['client_ip'];
$allowed = $client['allowed_ips'] ?? "$ip/32"; // Fallback to IP/32
@@ -110,8 +114,8 @@ try {
}
// 5. Write Config
// Use host path if possible for safety
$hostConfPath = '/opt/amnezia/amnezia-awg/wg0.conf';
// Use host path that matches container volume (-v /opt/amnezia/awg:/opt/amnezia/awg)
$hostConfPath = '/opt/amnezia/awg/wg0.conf';
$escaped = addslashes($conf);
$server->executeCommand("echo \"$escaped\" > $hostConfPath", true);