Add notes about escaping characters in VPN variables
Thanks to @sohailmamdani for reminding me on this!
This commit is contained in:
parent
7cfe17f1a2
commit
79887bb458
39
vpnsetup.sh
39
vpnsetup.sh
@ -23,28 +23,17 @@ if [ "$(uname)" = "Darwin" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(lsb_release -si)" != "Ubuntu" ] && [ "$(lsb_release -si)" != "Debian" ]; then
|
# Please define your own values for these variables
|
||||||
echo "Looks like you aren't running this script on a Ubuntu or Debian system."
|
# IMPORTANT: You must escape all non-alphanumeric characters with a backslash.
|
||||||
exit 1
|
# Examples: \ --> \\, " --> \", ' --> \', $ --> \$, ` --> \`, [space] --> \[space]
|
||||||
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
|
IPSEC_PSK=your_very_secure_key
|
||||||
VPN_USER=your_username
|
VPN_USER=your_username
|
||||||
VPN_PASSWORD=your_very_secure_password
|
VPN_PASSWORD=your_very_secure_password
|
||||||
|
|
||||||
# IMPORTANT NOTES:
|
# --------------------
|
||||||
|
# | IMPORTANT NOTES |
|
||||||
|
# --------------------
|
||||||
|
|
||||||
# To support multiple VPN users with different credentials, just edit a few lines below.
|
# To support multiple VPN users with different credentials, just edit a few lines below.
|
||||||
# See: https://gist.github.com/hwdsl2/123b886f29f4c689f531
|
# 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
|
# 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.
|
# 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
|
# Check for empty VPN variables
|
||||||
[ -z "$IPSEC_PSK" ] && { echo "'IPSEC_PSK' cannot be empty. Please edit the VPN script."; exit 1; }
|
[ -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; }
|
[ -z "$VPN_USER" ] && { echo "'VPN_USER' cannot be empty. Please edit the VPN script."; exit 1; }
|
||||||
|
@ -22,38 +22,17 @@ if [ "$(uname)" = "Darwin" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /etc/redhat-release ]; then
|
# Please define your own values for these variables
|
||||||
echo "Looks like you aren't running this script on a CentOS/RHEL system."
|
# IMPORTANT: You must escape all non-alphanumeric characters with a backslash.
|
||||||
exit 1
|
# Examples: \ --> \\, " --> \", ' --> \', $ --> \$, ` --> \`, [space] --> \[space]
|
||||||
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
|
|
||||||
|
|
||||||
# Please define your own values for those variables
|
|
||||||
IPSEC_PSK=your_very_secure_key
|
IPSEC_PSK=your_very_secure_key
|
||||||
VPN_USER=your_username
|
VPN_USER=your_username
|
||||||
VPN_PASSWORD=your_very_secure_password
|
VPN_PASSWORD=your_very_secure_password
|
||||||
|
|
||||||
# IMPORTANT NOTES:
|
# --------------------
|
||||||
|
# | IMPORTANT NOTES |
|
||||||
|
# --------------------
|
||||||
|
|
||||||
# To support multiple VPN users with different credentials, just edit a few lines below.
|
# To support multiple VPN users with different credentials, just edit a few lines below.
|
||||||
# See: https://gist.github.com/hwdsl2/123b886f29f4c689f531
|
# 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
|
# 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.
|
# 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
|
# Check for empty VPN variables
|
||||||
[ -z "$IPSEC_PSK" ] && { echo "'IPSEC_PSK' cannot be empty. Please edit the VPN script."; exit 1; }
|
[ -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; }
|
[ -z "$VPN_USER" ] && { echo "'VPN_USER' cannot be empty. Please edit the VPN script."; exit 1; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user