Skip to content

Commit

Permalink
put in wait for tunnel before execute extip
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jul 31, 2017
1 parent be1af25 commit 9e1e9a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions run/root/getvpnextip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ retry_count=30
# remove previous run output file
rm -f /home/nobody/vpn_external_ip.txt

# wait for vpn tunnel to come up before proceeding
source /home/nobody/getvpnip.sh

while true; do

external_ip="$(dig TXT +short o-o.myaddr.l.google.com @${pri_external_ip_ns} | tr -d '"')"
Expand Down
6 changes: 3 additions & 3 deletions run/root/openvpn.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

# define common command lne parameters for openvpn
openvpn_cli="/usr/bin/openvpn --cd /config/openvpn --config ${VPN_CONFIG} --daemon --reneg-sec 0 --mute-replay-warnings --auth-nocache --keepalive 10 60 --setenv VPN_PROV ${VPN_PROV} --setenv DEBUG ${DEBUG} --script-security 2 --up /root/openvpnup.sh --up-delay --up-restart --writepid /root/openvpn.pid"
openvpn_cli="/usr/bin/openvpn --cd /config/openvpn --config ${VPN_CONFIG} --daemon --reneg-sec 0 --mute-replay-warnings --auth-nocache --keepalive 10 60 --setenv VPN_PROV ${VPN_PROV} --setenv DEBUG ${DEBUG} --setenv VPN_DEVICE_TYPE ${VPN_DEVICE_TYPE} --script-security 2 --up /root/openvpnup.sh --up-delay --up-restart --writepid /root/openvpn.pid"

if [[ "${VPN_PROV}" == "pia" ]]; then

# add additional flags to pass credentials and ignore local-remote warnings
openvpn_cli="${openvpn_cli} --setenv STRICT_PORT_FORWARD ${STRICT_PORT_FORWARD} --auth-user-pass credentials.conf --disable-occ --remap-usr1 SIGHUP --log-append /dev/stdout"
# add pia specific flags
openvpn_cli="${openvpn_cli} --setenv STRICT_PORT_FORWARD ${STRICT_PORT_FORWARD} --disable-occ --remap-usr1 SIGHUP --log-append /dev/stdout"

fi

Expand Down

0 comments on commit 9e1e9a7

Please sign in to comment.