Fix #114
This commit is contained in:
parent
fe80919ac3
commit
7865df2c00
1 changed files with 5 additions and 5 deletions
|
@ -250,8 +250,8 @@ if [[ ! -e /etc/wireguard/wg0.conf ]]; then
|
||||||
echo
|
echo
|
||||||
echo "Enter a name for the first client:"
|
echo "Enter a name for the first client:"
|
||||||
read -p "Name [client]: " unsanitized_client
|
read -p "Name [client]: " unsanitized_client
|
||||||
# Allow a limited set of characters to avoid conflicts
|
# Allow a limited lenght and set of characters to avoid conflicts
|
||||||
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client")
|
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client" | cut -c-15)
|
||||||
[[ -z "$client" ]] && client="client"
|
[[ -z "$client" ]] && client="client"
|
||||||
echo
|
echo
|
||||||
new_client_dns
|
new_client_dns
|
||||||
|
@ -546,12 +546,12 @@ else
|
||||||
echo
|
echo
|
||||||
echo "Provide a name for the client:"
|
echo "Provide a name for the client:"
|
||||||
read -p "Name: " unsanitized_client
|
read -p "Name: " unsanitized_client
|
||||||
# Allow a limited set of characters to avoid conflicts
|
# Allow a limited lenght and set of characters to avoid conflicts
|
||||||
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client")
|
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client" | cut -c-15)
|
||||||
while [[ -z "$client" ]] || grep -q "^# BEGIN_PEER $client$" /etc/wireguard/wg0.conf; do
|
while [[ -z "$client" ]] || grep -q "^# BEGIN_PEER $client$" /etc/wireguard/wg0.conf; do
|
||||||
echo "$client: invalid name."
|
echo "$client: invalid name."
|
||||||
read -p "Name: " unsanitized_client
|
read -p "Name: " unsanitized_client
|
||||||
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client")
|
client=$(sed 's/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-]/_/g' <<< "$unsanitized_client" | cut -c-15)
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
new_client_dns
|
new_client_dns
|
||||||
|
|
Loading…
Add table
Reference in a new issue