VPN Connection through PHP or some other server-side scripting?

Josh Bradley picture Josh Bradley · Nov 4, 2011 · Viewed 9.8k times · Source

Ok, let me first start off by saying that I've only ever dealt with VPN access through windows by setting up a connection through the control panel. It's pretty simple since everything is pretty much a point-and-click setup.

I'm now working on a project where I need to access a computer cloud on a private network (there is no public IP directly to the cloud so it can only be accessed when I'm on the network). My project involves a website that needs to access that cloud "somehow". Because of my lack of experience/knowledge with VPN's through the command line and how to programmatically connect to a VPN, I've hit a mild obstacle that I'm hoping someone here can help me with.

What kind of server side scripting would I do to get a VPN connection up and running? The website is being hosted on a linux machine. Is their a "default" VPN utility under linux that I can call through PHP to establish a connection? If not, I would really appreciate any and all suggestions on how to circumvent this little problem of mine. FYI the VPN uses PPTP.

Answer

drew010 picture drew010 · Nov 4, 2011

Looks like there is a little bit to getting it set up from a shell rather than the GUI, but here are some references that will hopefully help you out.

If you set up the connection and connect it, when your PHP script attempts to communicate with an IP address on the remote side of the connection, it will go through the PPTP connection. Having the connection always open is probably better than having to your PHP script connect every time it needs to do something.

http://ubuntuforums.org/showthread.php?t=1443735 - An easy PPTP client setup http://pptpclient.sourceforge.net/ - Client you can install and configure http://www.cyberciti.biz/tips/howto-configure-ubuntu-fedora-linux-pptp-client.html - Walk through of setting up PPTP using the linux PPTP network manager

Hopefully those will help you out a bit. The first one looks like it may be worth trying first.