I have managed to start a VPN with this code
tunnel_file = "sudo /opt/local/sbin/openvpn2 primary_config.ovpn"
VPNProcess = subprocess.Popen(tunnel_file,shell = True)
The trouble is that I can't stop this process I tried -
VPNProcess.send_signal(signal.SIGINT)
and also sending SIGTERM or SIGKILL but none of them work. Not even VPNProcess.terminate()
works.
I can list the processes, it seems two are started, a sudo process and an openvpn2 process but if I try killing them in Terminal with kill number I get the response "operation not allowed"
Any ideas?