Skip to content

gszathmari/tfvpn

Repository files navigation

tfvpn

Deploy your private VPN service on Linode. Full automation and rapid deployment.

Description

This project uses Terraform to fully automate the deployment of the hwdsl2/setup-ipsec-vpn VPN project on Linode. Run your self-hosted IPSec VPN service with one click.

Prerequisites

You need the following to deploy your own VPN service with this automation project:

Installation

To deploy your VPN service, simply run the following commands:

  1. Clone the repository:

    git clone https://github.com/gszathmari/tfvpn.git
  2. Change your working directory:

    cd tfvpn/
  3. Initialise Terraform before the first use:

    terraform init
  4. Edit the terraform.tfvars file to choose your favourite geographical region for your VPN service.

  5. Then run terraform apply to launch the hosting infrastructure:

    terraform apply
  6. Enter your Linode API key when prompted.

  7. Answer yes to confirm the deployment. If everything ran successfully, the Linode dashboard should display the virtual machine running our new VPN service.

  8. Once Terraform finishes the deployment of tfvpn, wait a minute or two and your VPN service is ready to accept new connections.

  9. The VPN connection details are the following:

    • IP address: Run terraform show -json | jq -r .values.outputs.ipv4.value to display.
    • Username: Fixed to vpnuser
    • Password: Run terraform show -json | jq -r .values.outputs.password.value to display.
    • IPSec PSK: Run terraform show -json | jq -r .values.outputs.psk.value to display.

Client configuration

To configure Windows, Linux, macOS, iOS and Android clients, refer to the hwdsl2 client configuration guide. Use the connection parameters shown on the terminal screen from the previous step.

Destroying the VPN

If your tfvpn VPN service is no longer needed, it is easy to delete everything with Terraform again:

  1. Change your working directory:

    cd tfvpn/
  2. Run Terraform with the destroy parameter this time.

    terraform destroy
  3. Enter the Linode API key and answer 'yes' to confirm the deletion of your hosting infrastructure.

Once Terraform manages to clean up the virtual machine, Linode should stop billing for the service.

Further reading

Acknowledgments

About

Deploy your private VPN service on Linode. Full automation and rapid deployment.

Topics

Resources

Stars

Watchers

Forks

Languages