From 0e51150d84b79ea73fc9a1a48d814a24f2763599 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Fri, 23 Sep 2016 14:31:10 -0500 Subject: [PATCH] Check VPN credentials - If the provided VPN credentials contain \ " or ', exit with error - The above special characters can cause issues with the VPN --- vpnsetup.sh | 6 ++++++ vpnsetup_centos.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/vpnsetup.sh b/vpnsetup.sh index 5e3b24f..4ae281c 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -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). diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 8e97b5f..e815da0 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -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