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
This commit is contained in:
Dolorosus 2023-06-09 15:13:36 +02:00 committed by GitHub
parent 241d7c4209
commit d54e0a452d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -110,8 +110,8 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do
# Disable the peer section from the server config # Disable the peer section from the server config
echo "${CLIENT_NAME}" echo "${CLIENT_NAME}"
sed_pattern="/### begin ${CLIENT_NAME}/," sed_pattern="/### begin ${CLIENT_NAME} ###/,"
sed_pattern="${sed_pattern}/end ${CLIENT_NAME}/ s/^/#\[disabled\] /" sed_pattern="${sed_pattern}/### end ${CLIENT_NAME} ###/ s/^/#\[disabled\] /"
sed -e "${sed_pattern}" -i wg0.conf sed -e "${sed_pattern}" -i wg0.conf
unset sed_pattern unset sed_pattern

View file

@ -110,8 +110,8 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do
# Enable the peer section from the server config # Enable the peer section from the server config
echo "${CLIENT_NAME}" echo "${CLIENT_NAME}"
sed_pattern="/begin ${CLIENT_NAME}/," sed_pattern="/### begin ${CLIENT_NAME} ###/,"
sed_pattern="${sed_pattern}/end ${CLIENT_NAME}/ s/#\[disabled\] //" sed_pattern="${sed_pattern}/### end ${CLIENT_NAME} ###/ s/#\[disabled\] //"
sed -e "${sed_pattern}" -i wg0.conf sed -e "${sed_pattern}" -i wg0.conf
unset sed_pattern unset sed_pattern