Install raspbian, set up your users however you would like, so long as you have sudo access on the user you are running this with. You probably want to resize the image so it fills the SD card as well.
-
Copy this entire gist to your raspberry pi
-
Do
chmod +x step1.sh step2.sh iptables.sh
in the gist folder (so that -
Run step1.sh a) This script does a few things - it first updates your raspberry pi, then it installs a few needed utilities, then it upgrades the firmware on your raspberry pi b) Next, it sets up a few iptables rules in /etc/rc.local. Please verify that there is not an 'exit 0' statement before those rules are run, as the 'exit 0' will obviously prevent them from being loaded c) It downloads softether for raspberry pi, extracts it to /usr/local/vpnserver, agrees to the license terms, and then "makes" it. d) It changes the permissions as necessary on the /usr/local/vpnserevr files e) It adds the ufw profile for l2tpvpn's and allows it (But it doesn't enable ufw if it isn't already enabled) f) It adds the init.d script to start up the vpn server on startup
A) Please enable ufw if you would like your pi to be more secure. The IPTables and ufw rules should allow you to simple type 'sudo ufw enable' and everything should work B) Please check /etc/rc.local to ensure that 'exit 0' does not come before the iptables commands C) Unless you are confident in managing the services manually, please reboot your pi to make sure everything is working nicely.
-
Run step2.sh a) This script sets up the softether VPN config for an L2TP/IPSec vpn b) It will ask you various things in order and then stream-edit them into a copy of the 'commands.in' file, which it will then use to configure the softether server with. c) This script only works with a clean-install of softether - if you have already placed a password on softether, it will not work d) The soft-ether admin password is used only to administer the server using the vpncmd program or the softether gui for Windows e) The IPSec secret is the shared secret for all the IPSec connection f) The User/Pass are for one specific account, and do not have to match your unix account g) The script also grabs the mac address of the Raspberry Pi's 'eth0' interface, and then sets up the /etc/network/interfaces to use a bridge with that mac address rather than the ethernet adapter direction 1) This is because we have softether binding to a TAP, which we then need to bridge together, so that we can access the raspberry pi via the vpn. If we did a local bridge directly onto eth0, we would be able to access everything but the raspberry pi when connected via VPN
A) Please check /etc/network/interfaces to make sure things look good! You shouldn't see MACADDRESS in the file, and you should see it making a bridge, and that eth0 is set to manual with no additional settings
Lastly, which you must do on your own,
Set up a dhcp reservation for your Raspberry Pi in your router (essentially a DHCP assigned static IP). If you cannot do this, you may want to mess around with the bridge settings and assign the pi a static IP that way. Then, you need to forward ports 1701tcp, 4500udp, and 500udp from your router to your Raspberry Pi
That should be it! Feel free to message me if you have issues, but only if you are using a raspberrypi and raspbian. I may or may not be able to get back to you. If you make modifications to these scripts to work for other OS's, it might be nice if you shared them with us. If you have any tips on how I should improve my PI's, let me know!
By default softether uses 443, 992 and 5555, so why do you open 1701tcp, 4500udp, and 500udp?