0

I have a VPN that is working fine - except the thing that DHCP is taken from the local host.

So I researched a bit and find that I could add the following into my config file to get it working:

# This updates the resolvconf with dns settings
script-security 2
up /etc/openvpn/update-resolv-conf.sh
down /etc/openvpn/update-resolv-conf.sh

The stupid thing is that it does not work :-/ when I run OpenVPN with sudo, I get the following error:

[...]
Mon Nov 28 22:33:39 2016 SENT CONTROL [REMOTESERVER-XZY]: 'PUSH_REQUEST' (status=1)
Mon Nov 28 22:33:44 2016 SENT CONTROL [REMOTESERVER-XZY]: 'PUSH_REQUEST' (status=1)
Mon Nov 28 22:33:50 2016 SENT CONTROL [REMOTESERVER-XZY]: 'PUSH_REQUEST' (status=1)
Mon Nov 28 22:33:50 2016 PUSH: Received control message: 'PUSH_REPLY,dhcp-option DNS 10.100.1.12,dhcp-option DNS 10.100.1.1,ping 20,ping-restart 60,topology subnet,route-gateway 10.100.12.21,ifconfig 10.100.12.20 255.255.255.0'
Mon Nov 28 22:33:50 2016 OPTIONS IMPORT: timers and/or timeouts modified
Mon Nov 28 22:33:50 2016 OPTIONS IMPORT: --ifconfig/up options modified
Mon Nov 28 22:33:50 2016 OPTIONS IMPORT: route-related options modified
Mon Nov 28 22:33:50 2016 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Mon Nov 28 22:33:50 2016 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=wlan0 HWADDR=e8:b1:fc:d1:d1:66
Mon Nov 28 22:33:50 2016 TUN/TAP device tun1 opened
Mon Nov 28 22:33:50 2016 TUN/TAP TX queue length set to 100
Mon Nov 28 22:33:50 2016 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Mon Nov 28 22:33:50 2016 /sbin/ip link set dev tun1 up mtu 1500
Mon Nov 28 22:33:50 2016 /sbin/ip addr add dev tun1 10.100.12.20/24 broadcast 10.100.12.255
Mon Nov 28 22:33:50 2016 /etc/openvpn/update-resolv-conf.sh tun1 1500 1559 10.100.12.20 255.255.255.0 init
dhcp-option DNS 10.100.1.12
dhcp-option DNS 10.100.1.1
/etc/openvpn/update-resolv-conf.sh: line 57: /run/resolvconf/resolv.conf: Permission denied
Mon Nov 28 22:33:50 2016 /sbin/ip route add 10.100.0.0/16 via 10.100.12.1
RTNETLINK answers: File exists
Mon Nov 28 22:33:50 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Mon Nov 28 22:33:50 2016 Initialization Sequence Completed
[...]

So It seems like OpenVPN is dropping root permissions before calling the up script, so I get Permission denied. Please help!


System:

$ uname -vr
4.4.0-49-generic #70-Ubuntu SMP Fri Nov 11 16:40:34 UTC 2016
0

The script is called update-resolv-conf, you can check it by doing ls /etc/openvpn.

If so, please use

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.