Skip to content

Latest commit

 

History

History
86 lines (54 loc) · 5.18 KB

README.md

File metadata and controls

86 lines (54 loc) · 5.18 KB

Introduction

This repo includes terraform code to deploy a Pritunl VPN server instance on Google Cloud Platform (GCP). Also, we will leverage the Identity-Aware Proxy to provide secure SSH access to the VM instance, needed to a final step to configure your Pritunl VPN server.

Definitions

Client-site VPN

A client-site VPN establishes a secure and encrypted connection between a user and a private network, typically the organization's internal network. The use of a client-site Virtual Private Network (VPN) can be justified for several reasons: Enhanced Security, Remote Access, Protection on Public Networks, Data Privacy and Compliance, Securing Sensitive Transactions, Access Control, Reduced Cybersecurity Risks, etc.

Pritunl VPN

The Pritunl VPN is an open-source solution that provides an intuitive and secure platform for the implementation of Virtual Private Networks (VPNs), emphasizing ease of use and administration. Pritunl VPN

Terraform

Terraform is an Infrastructure as Code (IaC) tool that allows for the automated and declarative provisioning and management of infrastructure resources. Terraform

Google Cloud Platform

The Google Cloud Platform (GCP) is a cloud computing services platform from Google, which includes storage, data processing, machine learning, analytics, and various other resources to facilitate the development, deployment, and scalability of applications. Google Cloud Platform

Identity-Aware Proxy

With TCP forwarding, IAP can protect SSH and RDP access to your VMs hosted on Google Cloud. Not this case but, your VM instances don't even need public IP addresses.

Requirements

Deploy a Pritunl VPN instance on GCP by Terraform

The following Terraform code deploys a Pritunl VPN server on the Google Cloud Platform (GCP).

Setup

  1. Clone the repository:
git clone https://github.com/marcelotpcosta/pritunl-vpn-gcp-terraform
  1. Into the directory:
cd pritunl-vpn-gcp-terraform
  1. Make a copy of the terraform.tfvars.example to terraform.tfvars
cp terraform.tfvars.example terraform.tfvars
  1. Fill the values and save it. Note that the variables.tf file contains the declaration of variables used by tfvars configuration file.
  • project_id: Your GCP project ID. See Creating and managing projects
  • region: The GCP region where the resources will be created. See GCP regions and zones
  • zone: The GCP zone where the resources will be created. See GCP regions and zones
  • server_port: Server port which VPN clients will connect, for example the standard OpenVPN port "1194"
  • instance_type: The intance size. See GCP machine types
  • server_name: The server name on GCP console and OS hostname, for example "my-vpn-server"
  1. Authenticate on GCP (Assuming you have already installed and configured gcloud)
  • gcloud auth application-default login and follow link
  1. Then perform the following commands on the root folder:
  • terraform init to get the plugins
  • terraform plan to see the infrastructure plan
  • terraform apply to apply the infrastructure build
  1. When necessary
  • terraform destroy to destroy the built infrastructure
  1. Pritunl setup: After resources creation, the output will show the public IP to access the Pritunl web interface, so access the Pritunl web interface and follow this instructions to the basic and secure configuration. The page may take take a while to load.

- Important: In order to perform the upcoming procedures, it is essential to connect to the server via SSH. As we utilize IAP (Identity-Aware Proxy), accessing SSH is conveniently achieved through the GCP console. Simply navigate to the console, choose the project, go to the compute engine section, select your virtual machine (VM), and then click on the SSH access button. Please note that being a project owner is a prerequisite for this process.

  1. Pritunl VPN database setup
  2. Initial Setup
  3. Creating Organization and User
  4. Creating Server
  5. Downloading User Profile