X-Git-Url: https://git.toastfreeware.priv.at/debian/iodine.git/blobdiff_plain/e0c989f43a67e3df499db03e16368bce741d4a3f..16250e846ac329ce595b394678bcc9ee2d4a289c:/debian/iodine-jigger diff --git a/debian/iodine-jigger b/debian/iodine-jigger index 0bb32ae..92533a2 100644 --- a/debian/iodine-jigger +++ b/debian/iodine-jigger @@ -27,7 +27,7 @@ set -e ## Minimal customization: put the two lines ## subdomain=your.tunnel.sub.domain -## passed=password_for_that_tunnel +## passwd=password_for_that_tunnel ## in the file /etc/default/iodine-client. echo "${iodine_client_rc:=/etc/default/iodine-client}" > /dev/null @@ -67,7 +67,7 @@ echo "${test_ping_final:=true}" > /dev/null echo "${default_router}" > /dev/null ## Set if script uses the wrong hardware interface -echo "{interface}" > /dev/null +echo "${interface}" > /dev/null ## Set if the script should continue even if a command fails. ## Used to test script when running as non-root. @@ -83,6 +83,7 @@ fi ## ipcalc (for /usr/bin/ipcalc) ## dnsutils (for /usr/bin/dig) ## fping (for /usr/bin/fping) +## gawk (for /usr/bin/gawk, to use gensub()) ## The default tunnel MTU is 1024. ## If local DNS server restricts to 512 byte packets then do this: @@ -189,6 +190,8 @@ for n in ${nameservers}; do n_net=$(ipcalc --nobinary ${n}/${prefix_len} | awk '$1=="Network:" {print $2}') if [ "${n_net}" != "${local_net}" ]; then echo ==== Adding point-to-point route for DNS server ${n} + ## remove point-to-point route first, in case it is already present + ip -4 route del ${n}/32 || true ip -4 route add ${n}/32 via ${router} || ${continue_on_error} fi done @@ -196,7 +199,7 @@ done ## Bring up DNS tunnel echo ==== Creating IP-over-DNS tunnel... -iodine -P ${passwd} ${subdomain} || ${continue_on_error} +iodine -P "${passwd}" "${subdomain}" || ${continue_on_error} ## Find DNS tunnel interface @@ -212,7 +215,7 @@ echo ==== DNS tunnel interface: ${tunnel_interface} ## it *prints* it as it sets up the tunnel, so it does know it.) tunnel_remote=$(ip -4 address show dev ${tunnel_interface} \ - | awk '$1=="inet" {print gensub("[.][0-9]*/.*", ".1", 1, $2)}' | head -1) + | gawk '$1=="inet" {print gensub("[.][0-9]*/.*", ".1", 1, $2)}' | head -1) if [ -z ${tunnel_remote} ]; then echo ERROR: Cannot find DNS tunnel remote endpoint.