Skip to content

Instantly share code, notes, and snippets.

@amitsaxena
Last active July 24, 2022 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitsaxena/0dcf0c0555bdf8c969ad61a31a045283 to your computer and use it in GitHub Desktop.
Save amitsaxena/0dcf0c0555bdf8c969ad61a31a045283 to your computer and use it in GitHub Desktop.
Set up your own VPN server using DSVPN
# SSH to the EC2 instance and run these commands there
$ sudo yum update && sudo yum install gcc gcc-c++ make
$ sudo yum install git && git clone https://github.com/jedisct1/dsvpn.git && cd dsvpn
$ make
$ dd if=/dev/urandom of=vpn.key count=1 bs=32
$ base64 < vpn.key
# Copy the value obtained as output of the command above and use it on the client side
$ sudo ./dsvpn server vpn.key auto 1947
# Run these locally on your machine
$ echo 'key_obtained_on_server_in_previous_comand'| base64 --decode > vpn.key
# This works on a Mac. If you are on a Linux based system, then redo the steps performed on EC2 instance on your machine to get the dsvpn executable
$ brew install dsvpn
# Use the public IP address of your EC2 instance here
# The security group of the EC2 instance should allow SSH (on port 22) and Custom TCP traffic (on port 1947) from your local IP address
$ sudo /usr/local/sbin/dsvpn client vpn.key 10.1.1.1 1947
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment