This commit is contained in:
Rubén Díaz 2013-07-31 14:39:15 -07:00
commit 481c0339ab

View File

@ -26,6 +26,7 @@ fi
IP=$(ifconfig | grep 'inet addr:' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d: -f2 | awk '{ print $1}') IP=$(ifconfig | grep 'inet addr:' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d: -f2 | awk '{ print $1}')
if [ "$IP" = "" ]; then if [ "$IP" = "" ]; then
IP=$(wget -qO- ipv4.icanhazip.com) IP=$(wget -qO- ipv4.icanhazip.com)
EXTERNALIP=$IP
fi fi
@ -179,7 +180,7 @@ else
mkdir ~/ovpn-$CLIENT mkdir ~/ovpn-$CLIENT
# Try to detect a NATed connection and ask about it to potential LowEndSpirit # Try to detect a NATed connection and ask about it to potential LowEndSpirit
# users # users
EXTERNALIP=$(wget -qO- ipv4.icanhazip.com) if [ -z "$EXTERNALIP" ]; then EXTERNALIP=$(wget -qO- ipv4.icanhazip.com); fi
if [ "$IP" != "$EXTERNALIP" ]; then if [ "$IP" != "$EXTERNALIP" ]; then
echo "" echo ""
echo "Looks like your server is behind a NAT!" echo "Looks like your server is behind a NAT!"
@ -209,4 +210,4 @@ else
echo "" echo ""
echo "Your client config is available at ~/ovpn-$CLIENT.tar.gz" echo "Your client config is available at ~/ovpn-$CLIENT.tar.gz"
echo "If you want to add more clients, you simply need to run this script another time!" echo "If you want to add more clients, you simply need to run this script another time!"
fi fi