Terraform scripts to create a quick OpenVPN server in the cloud (AWS, Azure, Google (GCP), more to come). Can be trivially modified to work with other cloud providers.
-
For AWS, be sure your AWS profile is setup (i.e.,
$HOME/.aws/config
). -
For GCP, be sure to generate your
account.json
from Google Application Default Credentials or, more easily, simply login withgcloud auth application-default login
. -
For Azure, be sure you have the Azure CLI installed and complete an
az login
-
Create your SSH keys:
cd TerraformOpenVPN
ssh-keygen -N '' -f ./certs/ovpn
-
Edit your own
cert_details
(usecert_details.sample
as template) -
In the cloud provider you're using, edit the region in
variables.tf
as needed (default is Canada). -
For Azure it will restrict SSH and VPN to your public ip by default, if otherwise needed set variables 'restrict_vpn' or 'restrict_ssh' in
variables.tf
. -
For GCP, be sure you've created a new project and noted it in
variables.tf
. -
cd to the cloud provider directory and perform a
terraform apply
. -
The new
.ovpn
file will be copied from new instance intocert_details
. Open with your OpenVPN client.
- (AWS/GCP) Flag for "only allow this IP to connect" to either SSH and/or OpenVPN.
- Finish
fail2ban
configuration. - Better use of variables and file hierarchy to allow for a single variables file and one place to execute the
apply
command. - Enable this repository to be used as a module.
- Fix Azure implementation to use API/metadata to retrieve external IP.