├── LICENSE ├── README.md └── do-sshuttle /LICENSE: -------------------------------------------------------------------------------- 1 | WTFPL. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DO-sshuttle 2 | 3 | Transparent your Proxy your connection over your DigitalOcean Droplet. 4 | 5 | ## Installation 6 | 7 | ### 1. Install Requirements 8 | 9 | ```sh 10 | # Install DigitalOcean CLI Tool 11 | brew install doctl 12 | 13 | # Install sshuttle 14 | brew install sshuttle 15 | ``` 16 | 17 | ### 2. Generate DigitalOcean API Key 18 | 19 | Generate a key from [https://cloud.digitalocean.com/settings/api/tokens](https://cloud.digitalocean.com/settings/api/tokens) 20 | 21 | ### 3. Login via `doctl` 22 | 23 | ```sh 24 | doctl auth login 25 | # Enter your API key you generated. 26 | ``` 27 | 28 | ### 4. Create a Droplet called `do-sshuttle-server` 29 | 30 | Create a Droplet on your DigitalOcean account. Name it `do-sshuttle-server`. 31 | 32 | ### 5. Start Proxying. 33 | 34 | ```sh 35 | $ ./do-sshuttle 36 | do-shuttle v0.0.1 37 | Fatih Kadir Akın 38 | Transparent Proxying over DigitalOcean Droplets 39 | 40 | [ds] <--- Getting do-sshuttle-server Droplet information... 41 | [ds] ---> Powering on do-sshuttle-server (root@) Droplet... 42 | [ds] ---> Power-on Request sent... 43 | [ds] ---> Allow server 10 seconds to boot... 44 | [ds] ---> Proxying network via sshuttle... 45 | client: Connected. 46 | ``` 47 | 48 | ## LICENSE 49 | 50 | WTFPL. 51 | -------------------------------------------------------------------------------- /do-sshuttle: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DROPLET_NAME="do-sshuttle-server" 4 | DROPLET_FILE=/tmp/droplet-vpn.json 5 | 6 | echo "do-shuttle v0.0.1" 7 | echo "Fatih Kadir Akın " 8 | echo "Transparent Proxying over DigitalOcean Droplets" 9 | prefix="[ds]" 10 | echo 11 | 12 | if [ ! -f $DROPLET_FILE ]; then 13 | echo "$prefix <--- Getting $DROPLET_NAME Droplet information..." 14 | DROPLET_INFO=`doctl compute droplet list $DROPLET_NAME --output json` 15 | echo $DROPLET_INFO > $DROPLET_FILE 16 | fi 17 | 18 | DROPLET_IP=`cat $DROPLET_FILE | python -c 'import sys, json; print json.load(sys.stdin)[0]["networks"]["v4"][0]["ip_address"]'` 19 | DROPLET_ID=`cat $DROPLET_FILE | python -c 'import sys, json; print json.load(sys.stdin)[0]["id"]'` 20 | 21 | echo "$prefix ---> Powering on $DROPLET_NAME (root@$DROPLET_IP) Droplet..." 22 | doctl compute droplet-action power-on $DROPLET_ID > /dev/null 23 | echo "$prefix ---> Power-on Request sent..." 24 | echo "$prefix ---> Allow server 10 seconds to boot..." 25 | sleep 10 26 | 27 | echo "$prefix ---> Proxying network via sshuttle..." 28 | sshuttle -r root@$DROPLET_IP 0.0.0.0/0 > /dev/null 29 | echo "$prefix ---> sshuttle stopped..." 30 | echo "$prefix ---> Powering off $DROPLET_NAME (root@$DROPLET_IP) Droplet..." 31 | doctl compute droplet-action power-off $DROPLET_ID > /dev/null 32 | echo "$prefix ---> Power-off Request sent..." 33 | echo "$prefix ---> Bye." --------------------------------------------------------------------------------