0

Is it possible to use openvpn as "a wrapper" for certain scripts?

So that

a) The VPN is built up for a script and terminated after the script has finished

b) Only the traffic of that script is sent through the vpn

1

A) Sure. You can start up the openvpn client via a script. Something like openvpn --config /path/to/config.cfg should be sufficient, if everything relevant to your connection is contained in /path/to/config.cfg. The VPN tunnel can then be taken down by killing that process.

B) This is a bit harder, but only a bit. Typically, you would do this by firewall rules, to restrict VPN traffic to what you want to permit. If you don't have these firewall rules, anything on the client box can send traffic across the VPN (It won't necessarily happen; if the VPN is to a private network, and no other process on the machine cares, there probably won't be any traffic. But, if you have a requirement to permit only certain traffic, then you should write up firewall rules that specifically permit this traffic and block everything else.)

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.