Fix: Add missing $ in sync script and skip invalid clients
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user