Coder Social home page Coder Social logo

do-tunnel's Introduction

do-tunnel

DigitalOcean WireGuard Tunnel with Terraform and Ansible

Usage

WireGuard Keys

See WireGuard: Key Generation for details on how to create keys for the WireGuard server and peers.

Variables

Create a .tfvars file defining the value of the Terraform variables.

See variables.tf for a complete list of variables.

Example .tfvars file:

do_token             = "dop_v1_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ssh_key_fingerprint  = "aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa"
ssh_private_key_file = "/home/user/.ssh/id_rsa"
ssh_public_key_file  = "/home/user/.ssh/id_rsa.pub"

domain = "wg.example.com"

# WireGuard

wg_port       = "33099"
wg_ipv4_range = "10.0.42.0/24"

wg_private_key   = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="
wg_allowed_peers = {
  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=" = "10.0.42.2"
}

Apply

terraform init
terraform apply -var-file my-vars.tfvars

Destroy

terraform destroy -var-file my-vars.tfvars

Peer Configuration

Peer configurations vary depending on the platform. See DigitalOcean: How to Set Up WireGuard - Configuring a WireGuard Peer for Linux instructions.

This Terraform does not support adding additional nodes after initial setup.

To add additional nodes either do so manually or update the .tfvars file and destroy then recreate the infrastructure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.