Coder Social home page Coder Social logo

vpn-bastion's Introduction

vpn-bastion

Deployment of Bastion Instance accessible via VPN

VPC + VPN Provisioning

This project creates (and delete) Linux Server Bastion in its own isolated VPC in AWS. It adds a VPN Server compabible with iOS and MacOS native VPN Client provides access the Linux Server when you hit the road. The output provides DNS Names, IP addresses and Credentials for the VPN Settings. API Gateway provides a way to start this bastion only when needed.

Requirements

  • An SSH Public Key

Define all the Values in terraform.tfvars as shown in terraform.tfvars.example

If you don't want to use DNS Names with Route 53 but only IP, delete the following file:

  • vpn-server-dnsname.tf

Otherwise you will need:

  • A zone ID for your DNS Zone in Route 53

Optional to store terraform states in S3:

  • backend.safe.tf copied from backend.safe.tf.example

Dependencies

ipv6=false doesn't work yet in current version Bug Issue 688:

Usage Example

  • Create terraform.tfvars from terraform.tfvars.example
  • (optional) Create backend.safe.tf from backend.safe.tf.example
  • terraform init
  • (optional) terraform workspace new <workspace_name>
  • terraform apply
  • terraform destroy
  • (optional) terraform workspace delete <workspace_name>

You can use inline vars to overide terraform.tfvars and deploy in a different region

  • terraform workspace new paris
  • terraform apply -var vpcname='VPN-Paris' -var region='eu-west-3' -var hostname='vpn-paris.domain.com'
  • terraform destroy -var vpcname='VPN-Paris' -var region='eu-west-3' -var hostname='vpn-paris.domain.com'
  • terraform workspace delete paris

VPN Clients setup on iOs or MacOS

Follow this guide: https://libreswan.org/wiki/VPN_server_for_remote_clients_using_IKEv1_XAUTH_with_PSK

Enable Logs

https://github.com/hwdsl2/docker-ipsec-vpn-server#enable-libreswan-logs

To keep the Docker image small, Libreswan (IPsec) logs are not enabled by default. If you are an advanced user and wish to enable it for troubleshooting purposes, first start a Bash session in the running container:

docker exec -it ipsec-vpn-server env TERM=xterm bash -l

Then run the following commands:

apt-get update && apt-get -y install rsyslog
service rsyslog restart
service ipsec restart
sed -i '/pluto\.pid/a service rsyslog restart' /opt/src/run.sh
exit

When finished, you may check Libreswan logs with:

docker exec -it ipsec-vpn-server grep pluto /var/log/auth.log
docker exec -it ipsec-vpn-server tail -f pluto /var/log/auth.log

To check xl2tpd logs, run docker logs ipsec-vpn-server.

To Do

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.