Giter Club home page Giter Club logo

terraform-openvpn's Introduction

Terraform OpenVPN

Terraform declarations for Single node OpenVPN infrastructure. You can have your pay as you go personal VPN in minutes! And you can destroy your environment whenever you want!

asciicast

Prerequisites

Terraform v0.11.3

Check your version.

$ terraform -v

Installing

Install Terraform, you can use brew if you're on Mac OS X.

$ brew install terraform

Usage

Make sure you provided AWS credentials to your environment.

You can simply export:

export AWS_ACCESS_KEY_ID=(your access key id)
export AWS_SECRET_ACCESS_KEY=(your secret access key)

Or, you can use something like awsudo if you are using multiple accounts in your system:

$ awsudo -u personal env | grep AWS
AWS_ACCESS_KEY_ID='<jadajada>'
AWS_SECRET_ACCESS_KEY='<blablabla>'

To provision remote machine, Terraform needs to access that machine, for that you have to add your SSH key to your local ssh-agent, so Terraform can find:

$ ssd-add # Adds default ssh key
$ ssd-add ~/.ssh/my-jada-jada-key # Adds a specific ssh key

Then plan your changes:

$ terraform plan

If everything is ok, you should see something like:

after_plan

If everything looks good, you can apply your plan, it will take couple of minutes:

$ terraform apply

If everything is ok, you should see something like:

after_apply

Booom! You did it!

Client Setup

Use generated file with an OpenVPN client. In OS X, you can install one with brew.

$ brew install openvpn

Then,

$ sudo openvpn --config awesome-personal-vpn.ovpn
$ sudo openvpn --config awesome-personal-vpn.ovpn --deaemon # as daemon
$ sudo -b openvpn --config awesome-personal-vpn.ovpn # run in background

If you want a GUI client, you can use Tunnelblick for Mac OS X, with Tunnelblick is installed, just go to your console:

$ open awesome-personal-vpn.ovpn

Available Parameters

If you want to configure your VPN, you can pass following parameters.

$ terraform apply \
   -var "aws_region=JADA" \
   -var "ssh_remote_user=JADA"
   -var "ssh_public_key_path=JADA" \
   -var "vpn_data=JADA" \
   -var "vpn_port=1234" \
   -var "vpn_client_name=JADA"

Your VPN is ready! Have fun!

Built With

Special thanks to @kylemanna for docker-openvpn

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Kemal Akkoyun - Initial work - kakkoyun

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENCE file for details

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.