From d54e0a452d33c2ace10870ddb250bc20aaa85799 Mon Sep 17 00:00:00 2001 From: Dolorosus Date: Fri, 9 Jun 2023 15:13:36 +0200 Subject: [PATCH] fix(scripts): #issue-1747767321 ensure only "user" is disabled * fix common https://github.com/pivpn/pivpn/issues/1733#issue-1747767321 pivpn -off/-on user (en-/dis-)ables also user-1, user-2...user-n this fix prevents from (en-/dis-)ableing user-1 ...user-n --- scripts/wireguard/disableCONF.sh | 4 ++-- scripts/wireguard/enableCONF.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/wireguard/disableCONF.sh b/scripts/wireguard/disableCONF.sh index 901256c..4769489 100755 --- a/scripts/wireguard/disableCONF.sh +++ b/scripts/wireguard/disableCONF.sh @@ -110,8 +110,8 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do # Disable the peer section from the server config echo "${CLIENT_NAME}" - sed_pattern="/### begin ${CLIENT_NAME}/," - sed_pattern="${sed_pattern}/end ${CLIENT_NAME}/ s/^/#\[disabled\] /" + sed_pattern="/### begin ${CLIENT_NAME} ###/," + sed_pattern="${sed_pattern}/### end ${CLIENT_NAME} ###/ s/^/#\[disabled\] /" sed -e "${sed_pattern}" -i wg0.conf unset sed_pattern diff --git a/scripts/wireguard/enableCONF.sh b/scripts/wireguard/enableCONF.sh index 390b0a9..d20276d 100755 --- a/scripts/wireguard/enableCONF.sh +++ b/scripts/wireguard/enableCONF.sh @@ -110,8 +110,8 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do # Enable the peer section from the server config echo "${CLIENT_NAME}" - sed_pattern="/begin ${CLIENT_NAME}/," - sed_pattern="${sed_pattern}/end ${CLIENT_NAME}/ s/#\[disabled\] //" + sed_pattern="/### begin ${CLIENT_NAME} ###/," + sed_pattern="${sed_pattern}/### end ${CLIENT_NAME} ###/ s/#\[disabled\] //" sed -e "${sed_pattern}" -i wg0.conf unset sed_pattern