mirror of
https://github.com/sshuttle/sshuttle.git
synced 2024-11-28 19:03:26 +01:00
30 lines
631 B
Plaintext
30 lines
631 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
set -e
|
||
|
|
||
|
node=$1
|
||
|
|
||
|
if [[ ! $node =~ [1-9]+ ]]; then
|
||
|
echo "node argument missing. should be '1' , '2' etc"
|
||
|
exit 2
|
||
|
fi
|
||
|
shift
|
||
|
|
||
|
port="2200$node"
|
||
|
subnet_args="-N"
|
||
|
host=localhost
|
||
|
user="test:test"
|
||
|
|
||
|
if ! command -v sshpass >/dev/null; then
|
||
|
echo "sshpass is not found. You have to manually enter ssh password: 'test'" >&2
|
||
|
user="test"
|
||
|
fi
|
||
|
ssh_cmd='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
||
|
|
||
|
if [[ "$*" =~ -v ]]; then
|
||
|
ssh_cmd+='-v'
|
||
|
fi
|
||
|
|
||
|
SSHUTTLE_BIN=${SSHUTTLE_BIN:-"$(dirname "$0")/../run"}
|
||
|
set -x
|
||
|
exec "${SSHUTTLE_BIN}" -r "$user@$host:$port" --ssh-cmd "$ssh_cmd" "$@" $subnet_args
|