Crash CDK

๐Ÿ— CDK App for Amazon CDK! Lets you create your own VPN server in few simple steps.

๐Ÿ’ธ Suits for AWS Free Tier instances

โ˜€๏ธ Fast, but verbose setup

๐Ÿ‘ฏโ€ Mostly copy-pasting

๐Ÿ’ฅ Easy to destroy

Pre-requirements

๐Ÿšœ Latest node.js

nvm use 14

๐Ÿงถ Yarn

npm install -g yarn

๐Ÿงพ AWS Account

๐Ÿšœ AWS CLI

๐Ÿ”Œ EC2 Instance Connect CLI

๐Ÿค– IAM User with following policies:

  1. AmazonEC2FullAccess

  2. AWSCloudFormationFullAccess

  3. EC2InstanceConnect

๐Ÿ’ญ Important: Create a separate user instead of using default sudo-level access.

๐Ÿ’ญ Important 2: Best practice is to attach permissions to a group and then add users to that group, rather than giving permissions to user directly. In this particular case there's not much difference, so you can do either.

Configure AWS CLI

aws configure

The tool will prompt for an IAM credentials. Fill in ones, created before.

Deploy

## Actually you need to clone this repo first, and install all deps
git clone https://github.com/hex22a/crash-cdk.git && cd ./crash-cdk && yarn install

yarn cdk deploy

Go to EC2 Dashboard and copy instance id and then SSH to the instance ๐Ÿ”‘

mssh ubuntu@INSTANCE_ID
# Set default user password
sudo passwd openvpn

Instance configuration is complete ๐ŸŽ‰

Set up VPN

Server

Log in as openvpn user at https://PUBLIC_IP:943/admin. Ignore SSL warning, or add SSL Cert as trusted to the keychain. You can find your public ip in AWS Console. To bypass Google Chrome's "Not Secure" warning, just type in "thisisunsafe" while the tab is open.

Update Hostname or IP Address at Network Settings (https://PUBLIC_IP:943/admin/network_settings). Value in the field should be your PUBLIC_IP.

Create ๐Ÿ‘ฉโ€๐Ÿ’ป VPN users, click "More Settings" to set password, enable auto-login

Don't forget to "Update Running Server"

Client

Login as a ๐Ÿ‘ฉโ€๐Ÿ’ป VPN user https://PUBLIC_IP:943/?src=connect

Download client app if you haven't yet

Click Yourself (autologin profile) to download client.ovpn file. Use this file to establish your custom VPN connection.

๐Ÿšจ Destroy

npm run cdk destroy

Notes

Unrecognized option or missing or extra parameter(s) in configuration: (line 4): dhcp-pre-release (2.4.4)

If you're configuring WiFi router with .ovpn autologin profile like above, try adding following lines to the .ovpn file in your favorite text editor

## Add this right after comments block, just for better arrangemnt
pull-filter ignore "dhcp-pre-release"
pull-filter ignore "dhcp-renew"
pull-filter ignore "dhcp-release"
pull-filter ignore "register-dns"
pull-filter ignore "block-ipv6"