From a752b76ccbeced9741ed1204d2ffa1a905a7be11 Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Fri, 12 Jun 2020 16:17:00 +0200 Subject: specify full path to openvpn --- src/vpn_wrapper.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') 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=$! -- cgit v1.2.3