Skip to content

Commit 0e51150

Browse files
committed
Check VPN credentials
- If the provided VPN credentials contain \ " or ', exit with error - The above special characters can cause issues with the VPN
1 parent cce15b7 commit 0e51150

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

vpnsetup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then
8282
exiterr "All VPN credentials must be specified. Edit the script and re-enter them."
8383
fi
8484

85+
case "$VPN_IPSEC_PSK $VPN_USER $VPN_PASSWORD" in
86+
*[\\\"\']*)
87+
exiterr "VPN credentials must not contain any of these characters: \\ \" '"
88+
;;
89+
esac
90+
8591
if [ "$(sed 's/\..*//' /etc/debian_version 2>/dev/null)" = "7" ]; then
8692
cat <<'EOF'
8793
IMPORTANT: Workaround required for Debian 7 (Wheezy).

vpnsetup_centos.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then
8585
exiterr "All VPN credentials must be specified. Edit the script and re-enter them."
8686
fi
8787

88+
case "$VPN_IPSEC_PSK $VPN_USER $VPN_PASSWORD" in
89+
*[\\\"\']*)
90+
exiterr "VPN credentials must not contain any of these characters: \\ \" '"
91+
;;
92+
esac
93+
8894
echo "VPN setup in progress... Please be patient."
8995
echo
9096

0 commit comments

Comments
 (0)