Start pptp VPN from a script

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

Start pptp VPN from a script

#1 Post by jafadmin »

Updated information is in the post below this one.

Would you like to start your pptp VPN with just the click of a mouse, or better yet, start automatically when you connect to a network?

This is a standalone solution that is not reliant on other software (Gpptp, OpenVPN, etc.). It is a bash script that uses the native pptp, pppd utilities included in most puppy LiveCD's.

This is a script called Qpptp (quick pptp) to do just that. There are actually two scripts. Once Qpptp starts, it loops continuously, keeping your VPN connection up until you kill it with Qpptp-kill.

The scripts install in your /root/my-applications/bin directory. You can put links to them on your desktop, or better yet, have the script start automatically when you boot by placing a link in /root/Startup.

Once the Qpptp script starts, here's what it does:
1) Checks that no other pptp processes are already running. Exits if there are.
2) Waits for a usable network to become available.
3) Once network availability is established, starts up pptp using your cedentials.
4) Loops forever, resetting itself if the pptp tunnel drops.

It keeps doing this until you stop it with Qpptp-kill

All you need to do to get started is edit the top three variables in the Qpptp script for the server name/address, your username, and your password.
Attachments
Quick-VPN-tray.pet
Quick-VPN
(12.31 KiB) Downloaded 297 times
Qpptp-scripts.pet
(3.51 KiB) Downloaded 303 times
Last edited by jafadmin on Mon 08 Dec 2014, 16:14, edited 15 times in total.

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#2 Post by jafadmin »

[ Update 22:58 UTC 11-19-2014 ] I've tweaked the scripts and the .pet so that it will install clean onto a LiveCD session. Before this, it assumed the user already had Gpptp v2.0 installed. It includes "myip" which is a shell command to check your public ip address, and "vpn-check" which I map to a Ctrl+alt+V keypress, that I use to quick-check the VPN tunnel.

I have also written a simple tray applet in C (Quick-Vpn-tray.pet above) to make and watch the pptp connection. It installs into "/root/my-applications/bin", and a link to it is in "/root/Startup" to start at boot.

Right-clicking the tray icon lets you edit your connection parameters, left clicking starts and stops the script.

If you are having trouble getting pptp to connect right, check here for pptp patches first.

.

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#3 Post by slavvo67 »

So, can you for example install this on multiple cd's or dvds and send them to friends or associates and have them boot to a vpn, all connected? Is that the goal of this?

Post Reply