Skip to content

Commit

Permalink
Fix: Remove an existing client.
Browse files Browse the repository at this point in the history
"Remove an existing client" may mistakenly remove multiple clients.
For example: remove client "test" will also remove client "test1".
  • Loading branch information
IRN-Kawakaze committed Jan 30, 2022
1 parent f2f0d3d commit 2a6df4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wireguard-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a6df4d

Please sign in to comment.