1
0
mirror of synced 2025-02-07 15:59:25 +03:00

Check VPN credentials

- If the provided VPN credentials contain \ " or ', exit with error
- The above special characters can cause issues with the VPN
This commit is contained in:
hwdsl2 2016-09-23 14:31:10 -05:00
parent cce15b7f08
commit 0e51150d84
2 changed files with 12 additions and 0 deletions

View File

@ -82,6 +82,12 @@ if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then
exiterr "All VPN credentials must be specified. Edit the script and re-enter them."
fi
case "$VPN_IPSEC_PSK $VPN_USER $VPN_PASSWORD" in
*[\\\"\']*)
exiterr "VPN credentials must not contain any of these characters: \\ \" '"
;;
esac
if [ "$(sed 's/\..*//' /etc/debian_version 2>/dev/null)" = "7" ]; then
cat <<'EOF'
IMPORTANT: Workaround required for Debian 7 (Wheezy).

View File

@ -85,6 +85,12 @@ if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then
exiterr "All VPN credentials must be specified. Edit the script and re-enter them."
fi
case "$VPN_IPSEC_PSK $VPN_USER $VPN_PASSWORD" in
*[\\\"\']*)
exiterr "VPN credentials must not contain any of these characters: \\ \" '"
;;
esac
echo "VPN setup in progress... Please be patient."
echo