From 8bb3dcda9f24e528e0a60df6c635379adea74dd1 Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Sun, 22 Aug 2021 07:31:09 +0000 Subject: [PATCH] Fix: Add route on wireguard reload This should be done by wg-quick. However wg-quick does not provide a sync command. --- tool_generate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tool_generate.py b/tool_generate.py index 842d7b9..0829ff6 100644 --- a/tool_generate.py +++ b/tool_generate.py @@ -156,6 +156,9 @@ sudo cp local/{}.conf /etc/wireguard/ sudo -- bash -c "wg syncconf {} <(wg-quick strip {})" '''.format(config["interface"], config["interface"], config["interface"])) + for info in config["peers"]: + f.write("sudo ip -4 route add {} dev {}\n".format(info["allowed"]), config["interface"]) + logger.info('''[Done] Config generated. Before you run start.sh, besure to: 1. Disable SSH Server password login.