ssh-keygen -t rsa -b 4096 -C "YOUR EMAIL ADDRESS"
- write ssh key to
~/.ssh/gcp-sstp-box
- also save the key to an encrypted location, e.g. Lastpass
gcloud config set project YOURGCPPROJECTNAME
gcloud config compute/region set europe-west1
(or wherever you wish to host it)gcloud config compute/zone set europe-west1-b
(or wherever)
- Create instance
- type:
g1-small
(based on usage to date this might be oversized; a micro may be possible) - zone:
europe-west1-b
(or wherever) - name & tag:
sstp
- Image:
container-optimized-stable
- Add the public key from
~/.ssh/gcp-sstp-box.pub
- default service account permissions/roles
- select
allow https access
- type:
- Allocate the instance a static IP
- Open an egress in the firewall from instances tagged
sstp
, to0.0.0.0/0
, allowing all ports (allow all
).
gcloud compute ssh sstp
openssl req -nodes -new -x509 -keyout /tmp/key.pem -out /tmp/cert.pem
- do not provide a password for this key
- The Common Name (CN) must be the static IP address of the instance
- All other parameters can be blank
- For more security you could instead use rsa:4096 with an expiry period e.g.
openssl req -x509 -newkey rsa:4096 -keyout /tmp/key.pem -out /tmp/cert.pem -days 365
docker run -d --cap-add NET_ADMIN -e SSTP_ENABLED=1 -e USERNAME=<YOUR USERNAME> -e PASSWORD=<CREATE A NEW PASSWORD> -e SERVER_PWD=<CREATE ANOTHER NEW PASSWORD> -e CERT="$(cat /tmp/cert.pem)" -e KEY="$(cat /tmp/key.pem)" -p 443:443/tcp fernandezcuesta/softethervpn
gcloud compute scp sstp:/tmp/cert.pem ./server.cert
- Save the cert and key in an encrypted secrets store (e.g. Lastpass)
rm /tmp/cert.pem
rm /tmp/key.pem
- Install the server certificate as a trusted root cert
- Right-click the
server.cert
and press install - Click next on the first panel
- Select 'Place all certificates in the following store'
- Browse to 'Trusted Root Certification Authorities'
- Click 'OK', then click 'Next'
- Click 'Finish' on the next panel
- Alternatively, you could follow this guide
- Then follow this guide to connect the VPN
As a further activity to ensure the server reboots immediately whenever the VM is restarted:
vim /tmp/sstp-startup.sh
- paste in the following, replacing secrets where noted in <>:
#! /bin/bash
exec docker run -d --cap-add NET_ADMIN -e SSTP_ENABLED=1 -e USERNAME=<SECRET-STORE-LOCATION-OF-YOUR-USERNAME> -e PASSWORD=<SECRET-STORE-LOCATION-OF-YOUR-PASSWORD> -e SERVER_PWD=<SECRET-STORE-LOCATION-OF-YOUR-SERVER-PASSWORD> -e CERT="$(cat SECRET-STORE-LOCATION-OF-YOUR-CERT)" -e KEY="$(cat SECRET-STORE-LOCATION-OF-YOUR-KEY)" -p 443:443/tcp fernandezcuesta/softethervpn
gcloud compute instances add-metadata sstp --metadata-from-file startup-script=/tmp/sstp-startup.sh
For further information on Soft Ether VPN docker, refer to this guide found here