ovpen_init: Remove external IP resolution

* Disable auto guessing the external IP in favor of the user explicitly
  specifying the server name.  Save the servername for client cert
  generation later.
* Remove dnsutils from build since dig is no longer necessary.  Favor
  learn and mean images.
This commit is contained in:
Kyle Manna
2014-06-04 11:15:43 -07:00
parent 1869cd85d0
commit 939cf7ab67
2 changed files with 10 additions and 8 deletions

View File

@ -22,13 +22,15 @@ easyrsa build-ca nopass
easyrsa gen-dh
openvpn --genkey --secret $OPENVPN/pki/ta.key
if [ -z "$cn"]; then
#TODO: Handle IPv6 (when I get a VPS with IPv6)...
ip4=$(dig +short myip.opendns.com @resolver1.opendns.com)
ptr=$(dig +short -x $ip4 | sed -e 's:\.$::')
[ -n "$ptr" ] && cn=$ptr || cn=$ip4
fi
# Was nice to autoset, but probably a bad idea in practice, users should
# have to explicitly specify the common name of their server
#if [ -z "$cn"]; then
# #TODO: Handle IPv6 (when I get a VPS with IPv6)...
# ip4=$(dig +short myip.opendns.com @resolver1.opendns.com)
# ptr=$(dig +short -x $ip4 | sed -e 's:\.$::')
#
# [ -n "$ptr" ] && cn=$ptr || cn=$ip4
#fi
echo "$cn" > $OPENVPN/servername