diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-06-12 16:17:00 +0200 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-06-12 16:17:00 +0200 |
commit | a752b76ccbeced9741ed1204d2ffa1a905a7be11 (patch) | |
tree | aa319922cd28bc4f9fb1962eafcd1870fed4dbf1 /src | |
parent | 3038106a16248d9d05b1545e019101e54f8291cc (diff) | |
download | 0tdns-a752b76ccbeced9741ed1204d2ffa1a905a7be11.tar.gz 0tdns-a752b76ccbeced9741ed1204d2ffa1a905a7be11.zip |
specify full path to openvpn
Diffstat (limited to 'src')
-rwxr-xr-x | src/vpn_wrapper.sh | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/vpn_wrapper.sh b/src/vpn_wrapper.sh index 5a44147..38eeaba 100755 --- a/src/vpn_wrapper.sh +++ b/src/vpn_wrapper.sh @@ -1,5 +1,9 @@ #!/bin/sh +# We give the full path, because PATH environment variable +# might be unset if run by cron +OVPN_COMMAND="/usr/sbin/openvpn" + OPENVPN_CONFIG="$1" PHYSICAL_IP="$2" ROUTE_THROUGH_VETH="$3" @@ -44,16 +48,16 @@ echo nameserver $DEFAULT_DNS > /etc/netns/$NAMESPACE_NAME/resolv.conf # the netns-script, which creates tun inside network namespace # of name $NAMESPACE_NAME # we could consider using --daemon option instead of & -openvpn --ifconfig-noexec --route-noexec --up $NETNS_SCRIPT \ - --route-up $NETNS_SCRIPT --down $NETNS_SCRIPT \ - --config "$OPENVPN_CONFIG" --script-security 2 \ - --connect-timeout 20 \ - --setenv NAMESPACE_NAME $NAMESPACE_NAME \ - --setenv WRAPPER_PID $$ \ - --setenv VETH_HOST0 $VETH_HOST0 \ - --setenv VETH_HOST1 $VETH_HOST1 \ - --setenv ROUTE_THROUGH_VETH $ROUTE_THROUGH_VETH\ $DEFAULT_DNS/32 \ - --setenv PHYSICAL_IP $PHYSICAL_IP & +$OVPN_COMMAND --ifconfig-noexec --route-noexec --up $NETNS_SCRIPT \ + --route-up $NETNS_SCRIPT --down $NETNS_SCRIPT \ + --config "$OPENVPN_CONFIG" --script-security 2 \ + --connect-timeout 20 \ + --setenv NAMESPACE_NAME $NAMESPACE_NAME \ + --setenv WRAPPER_PID $$ \ + --setenv VETH_HOST0 $VETH_HOST0 \ + --setenv VETH_HOST1 $VETH_HOST1 \ + --setenv ROUTE_THROUGH_VETH $ROUTE_THROUGH_VETH\ $DEFAULT_DNS/32 \ + --setenv PHYSICAL_IP $PHYSICAL_IP & OPENVPN_PID=$! |