Fixed issue #352

Fixed issue when allowed_ips have more than 1 IP Address, allow access will crash
This commit is contained in:
Donald Zou
2024-10-06 16:59:11 +08:00
parent 2cb06bb4bb
commit 71349f35e4
7 changed files with 119 additions and 97 deletions

View File

@@ -697,7 +697,7 @@ class WireguardConfiguration:
with open(f"{uid}", "w+") as f:
f.write(p['preshared_key'])
subprocess.check_output(f"wg set {self.Name} peer {p['id']} allowed-ips {p['allowed_ip']}{f' preshared-key {uid}' if presharedKeyExist else ''}",
subprocess.check_output(f"wg set {self.Name} peer {p['id']} allowed-ips {p['allowed_ip'].replace(' ', '')}{f' preshared-key {uid}' if presharedKeyExist else ''}",
shell=True, stderr=subprocess.STDOUT)
if presharedKeyExist: os.remove(str(uid))
else: