Nice and easy way to setup a VPN on any cloud provider in 5 mins.
- Create a linux vm, Ubuntu, Redhat or a AWS AMI – your choice! A static IP might be useful for you.
- Ensure your security group firewall permits the following:
- tcp=5555
udp=500,4500
- Install docker as a service, something like:
yum install docker
orapt install -y docker
- Ensure docker runs as a service on boot (not required for ubuntu)
systemctl enable docker
systemctl start docker
- Set your login details for the VPN
export USER=yourusername
export PASS=yourpassword
export HPW=yourhubpass
export SPW=yourserverpass
export PSK=yoursecretkey
- Start the VPN server:
-
docker run --restart on-failure -d --name yourvpn -e SPW=$SPW -e HPW=$HPW --cap-add NET_ADMIN -p 5555:5555/tcp -p 500:500/udp -p 4500:4500/udp -e PSK=$PSK -e USERNAME=$USER -e PASSWORD=$PASS harrypod/softethervpn:1
-
- Thats it! FInd your servers external IP and connect.
Extra
Whilst the docker container is running, you could extract a config file to prevent the need for handling environment variables:
$ docker cp yourvpn:/usr/vpnserver/vpn_server.config /path/to/vpn_server.config$ docker run --restart on-failure -d --name yourvpn -v /path/to/vpn_server.config:/usr/vpnserver/vpn_server.config harrypod/softethervpn:1
Other useful commands to help with setting up:
$ docker stop yourvpn; docker rm yourvpn;
$ docker ps -a;
$ docker rm $(docker ps -a -q);
This method is credited to https://github.com/siomiz/SoftEtherVPN – i have reviewed code and recompiled the docker image, to ensure it is safe for my own use.