From 2a6df4daf01f0380c4c2fa2a3e35bacf69ebcdef Mon Sep 17 00:00:00 2001 From: IRN-Kawakaze <41798687+IRN-Kawakaze@users.noreply.github.com> Date: Sun, 30 Jan 2022 17:32:34 +0800 Subject: [PATCH] Fix: Remove an existing client. "Remove an existing client" may mistakenly remove multiple clients. For example: remove client "test" will also remove client "test1". --- wireguard-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index e8ba13c..86be9f6 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -580,7 +580,7 @@ else # Remove from the live interface wg set wg0 peer "$(sed -n "/^# BEGIN_PEER $client$/,\$p" /etc/wireguard/wg0.conf | grep -m 1 PublicKey | cut -d " " -f 3)" remove # Remove from the configuration file - sed -i "/^# BEGIN_PEER $client/,/^# END_PEER $client/d" /etc/wireguard/wg0.conf + sed -i "/^# BEGIN_PEER $client$/,/^# END_PEER $client$/d" /etc/wireguard/wg0.conf echo echo "$client removed!" else