1
0
mirror of synced 2024-11-22 13:06:02 +03:00

Add notes about escaping characters in VPN variables

Thanks to @sohailmamdani for reminding me on this!
This commit is contained in:
hwdsl2 2016-01-15 10:01:40 -06:00
parent 7cfe17f1a2
commit 79887bb458
2 changed files with 54 additions and 44 deletions

View File

@ -23,28 +23,17 @@ if [ "$(uname)" = "Darwin" ]; then
exit 1
fi
if [ "$(lsb_release -si)" != "Ubuntu" ] && [ "$(lsb_release -si)" != "Debian" ]; then
echo "Looks like you aren't running this script on a Ubuntu or Debian system."
exit 1
fi
# Please define your own values for these variables
# IMPORTANT: You must escape all non-alphanumeric characters with a backslash.
# Examples: \ --> \\, " --> \", ' --> \', $ --> \$, ` --> \`, [space] --> \[space]
if [ -f "/proc/user_beancounters" ]; then
echo "Sorry, this script does NOT support OpenVZ VPS. Try Nyr's OpenVPN script instead:"
echo "https://github.com/Nyr/openvpn-install"
exit 1
fi
if [ "$(id -u)" != 0 ]; then
echo "Sorry, you need to run this script as root."
exit 1
fi
# Please define your own values for those variables
IPSEC_PSK=your_very_secure_key
VPN_USER=your_username
VPN_PASSWORD=your_very_secure_password
# IMPORTANT NOTES:
# --------------------
# | IMPORTANT NOTES |
# --------------------
# To support multiple VPN users with different credentials, just edit a few lines below.
# See: https://gist.github.com/hwdsl2/123b886f29f4c689f531
@ -73,6 +62,22 @@ VPN_PASSWORD=your_very_secure_password
# This script will backup /etc/rc.local, /etc/sysctl.conf and /etc/iptables.rules
# before overwriting them. Backups can be found under the same folder with .old suffix.
if [ "$(lsb_release -si)" != "Ubuntu" ] && [ "$(lsb_release -si)" != "Debian" ]; then
echo "Looks like you aren't running this script on a Ubuntu or Debian system."
exit 1
fi
if [ -f "/proc/user_beancounters" ]; then
echo "Sorry, this script does NOT support OpenVZ VPS. Try Nyr's OpenVPN script instead:"
echo "https://github.com/Nyr/openvpn-install"
exit 1
fi
if [ "$(id -u)" != 0 ]; then
echo "Sorry, you need to run this script as root."
exit 1
fi
# Check for empty VPN variables
[ -z "$IPSEC_PSK" ] && { echo "'IPSEC_PSK' cannot be empty. Please edit the VPN script."; exit 1; }
[ -z "$VPN_USER" ] && { echo "'VPN_USER' cannot be empty. Please edit the VPN script."; exit 1; }

View File

@ -22,38 +22,17 @@ if [ "$(uname)" = "Darwin" ]; then
exit 1
fi
if [ ! -f /etc/redhat-release ]; then
echo "Looks like you aren't running this script on a CentOS/RHEL system."
exit 1
fi
# Please define your own values for these variables
# IMPORTANT: You must escape all non-alphanumeric characters with a backslash.
# Examples: \ --> \\, " --> \", ' --> \', $ --> \$, ` --> \`, [space] --> \[space]
if grep -qs -v -e "release 6" -e "release 7" /etc/redhat-release; then
echo "Sorry, this script only supports versions 6 and 7 of CentOS/RHEL."
exit 1
fi
if [ "$(uname -m)" != "x86_64" ]; then
echo "Sorry, this script only supports 64-bit CentOS/RHEL."
exit 1
fi
if [ -f "/proc/user_beancounters" ]; then
echo "Sorry, this script does NOT support OpenVZ VPS. Try Nyr's OpenVPN script instead:"
echo "https://github.com/Nyr/openvpn-install"
exit 1
fi
if [ "$(id -u)" != 0 ]; then
echo "Sorry, you need to run this script as root."
exit 1
fi
# Please define your own values for those variables
IPSEC_PSK=your_very_secure_key
VPN_USER=your_username
VPN_PASSWORD=your_very_secure_password
# IMPORTANT NOTES:
# --------------------
# | IMPORTANT NOTES |
# --------------------
# To support multiple VPN users with different credentials, just edit a few lines below.
# See: https://gist.github.com/hwdsl2/123b886f29f4c689f531
@ -82,6 +61,32 @@ VPN_PASSWORD=your_very_secure_password
# This script will backup /etc/rc.local, /etc/sysctl.conf and /etc/sysconfig/iptables
# before overwriting them. Backups can be found under the same folder with .old suffix.
if [ ! -f /etc/redhat-release ]; then
echo "Looks like you aren't running this script on a CentOS/RHEL system."
exit 1
fi
if grep -qs -v -e "release 6" -e "release 7" /etc/redhat-release; then
echo "Sorry, this script only supports versions 6 and 7 of CentOS/RHEL."
exit 1
fi
if [ "$(uname -m)" != "x86_64" ]; then
echo "Sorry, this script only supports 64-bit CentOS/RHEL."
exit 1
fi
if [ -f "/proc/user_beancounters" ]; then
echo "Sorry, this script does NOT support OpenVZ VPS. Try Nyr's OpenVPN script instead:"
echo "https://github.com/Nyr/openvpn-install"
exit 1
fi
if [ "$(id -u)" != 0 ]; then
echo "Sorry, you need to run this script as root."
exit 1
fi
# Check for empty VPN variables
[ -z "$IPSEC_PSK" ] && { echo "'IPSEC_PSK' cannot be empty. Please edit the VPN script."; exit 1; }
[ -z "$VPN_USER" ] && { echo "'VPN_USER' cannot be empty. Please edit the VPN script."; exit 1; }