Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 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.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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