Skip to content

Instantly share code, notes, and snippets.

@ansell
Last active March 3, 2018 00:26
Show Gist options
  • Save ansell/65365c90435d7534eb1be294e2a26a8d to your computer and use it in GitHub Desktop.
Save ansell/65365c90435d7534eb1be294e2a26a8d to your computer and use it in GitHub Desktop.
sshuttle usage
#!/bin/bash
set -e
VIRTUAL_ENV_DIR="${HOME}/python-virtualenvironments/sshuttle"
GITREPOS_DIR="${VIRTUAL_ENV_DIR}/gitrepos"
SSHUTTLE_REPO="${GITREPOS_DIR}/sshuttle"
# Set these to match your server
TUNNEL_USER="${USER}"
TUNNEL_SERVER="your-server"
if [[ ! -e "${VIRTUAL_ENV_DIR}" ]] ;
then
virtualenv -p python3 "${VIRTUAL_ENV_DIR}"
fi
echo "Virtual environment setup complete"
. "${VIRTUAL_ENV_DIR}"/bin/activate
echo "Virtual environment activated"
if [[ ! -e "${SSHUTTLE_REPO}" ]] ;
then
mkdir -p "${GITREPOS_DIR}"
cd "${GITREPOS_DIR}"
git clone https://github.com/sshuttle/sshuttle.git "${SSHUTTLE_REPO}"
cd "${SSHUTTLE_REPO}"
echo "Installing sshuttle"
./setup.py install --user
fi
echo "Running sshuttle using ${TUNNEL_USER}@${TUNNEL_SERVER}"
sshuttle --dns -r "${TUNNEL_USER}"@"${TUNNEL_SERVER}" 0/0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment