Skip to content

Instantly share code, notes, and snippets.

@arno01
Last active April 8, 2022 10:59
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 arno01/2ab436b99b552047ea77beba1684f6ba to your computer and use it in GitHub Desktop.
Save arno01/2ab436b99b552047ea77beba1684f6ba to your computer and use it in GitHub Desktop.

Simple VPN over SSH with shuttle in Akash

ssh server

  • deploy.yaml:
---
version: "2.0"

services:
  ssh:
    image: ubuntu:21.10
    env:
      - 'SSH_PUBKEY=ssh-rsa AAAAB3Nza......'
    command:
      - "sh"
      - "-c"
    args:
      - 'apt-get update;
      apt-get install -y --no-install-recommends -- ssh;
      mkdir -p -m0755 /run/sshd;
      mkdir -m700 ~/.ssh;
      echo "$SSH_PUBKEY" | tee ~/.ssh/authorized_keys;
      chmod 0600 ~/.ssh/authorized_keys;
      ls -lad ~ ~/.ssh ~/.ssh/authorized_keys;
      md5sum ~/.ssh/authorized_keys;
      exec /usr/sbin/sshd -D'
    expose:
      # SSH
      - port: 22
        as: 22
        to:
          - global: true

profiles:
  compute:
    ssh:
      resources:
        cpu:
          units: 1.0
        memory:
          size: 1024Mi
        storage:
          size: 1024Mi
  placement:
    akash:
      attributes:
        host: akash
      signedBy:
        anyOf:
          - "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
      pricing:
        ssh:
          denom: uakt
          amount: 100

deployment:
  ssh:
    akash:
      profile: ssh
      count: 1

VPN client

sudo apt -y install sshuttle
sshuttle -r root@<ingress-provider>:<22-mapped-port> 0.0.0.0/0

Enjoy your VPN!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment