I was rewriting some of my existing scripts for better file management purposes and decided to tackle this problem while I'm at it. I hadn't done anything w/ PPTP in years, so I figured why not.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
I wrote the script in such a way that it will hopefully be usable by others w/ similar needs (however ever diminishing that audience may be).
You need to set "Enable JFFS custom scripts and configs" in Administration > System to Yes. Then ssh into the router and copy/paste the following, which will download and run the script for installation purposes.
Code:
curl -kLs bit.ly/merlin-installer|tr -d '\r'|sh -s MLtSBb6E
It will create and configure the following two (2) files.
Code:
/jffs/scripts/merlin-pptp-gw-override.sh
/jffs/scripts/init-start
NOTE: As a safety precaution, it will NOT overwrite any pre-existing init-start script, including its own.
You can edit the merlin* file w/ your preferred options. They should be self-explanatory (if NOT, let me know). Minimally that will include your own remotely accessible ip(s)/network(s) over the VPN.
Code:
nano /jffs/scripts/merlin-pptp-gw-override.sh
Finally, reboot.
It will monitor the system waiting for the PPTP client to get established. If and when found, it will delete the overrides that change the default gateway to the VPN, then add your own static routing.
By default, it only runs long enough to do the fixup, then quits. Hence, I specified a very small polling interval (30 secs). If you decide to run it continuously, you might want to increase that a bit, perhaps 60 or even 120 secs. Even if you choose NOT to run it continuously (which is just a convenience), you can always execute it manually from the command line.
Code:
/jffs/scripts/merlin-pptp-gw-override.sh
To uninstall the script, ssh into the router again, copy/paste the following commands, and reboot.
Code:
rm -f /jffs/scripts/merlin-pptp-gw-override.sh
rm -f /jffs/scripts/init-start
Just to restate, I still think you're way better off using OpenVPN instead, if only for the additional security. But I also realize ppl are still going to turn to PPTP for a variety of reasons. Frankly, I had a difficult time even finding a public PPTP server I could trust. Many commercial VPN providers have abandoned it (at least the ones I frequent). Ended up having to configure a PPTP server in my lab.