2018-06-05 15:24:58 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
arg1=$1
|
|
|
|
|
|
|
|
if [ $arg1 = list ]; then
|
|
|
|
sqlite3 /opt/sshjump/sshjump.db 'select host,id from sshjump'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $arg1 = host ]; then
|
|
|
|
user=$2
|
|
|
|
host=$3
|
2018-06-05 15:46:42 -04:00
|
|
|
port=$(sqlite3 /opt/sshjump/sshjump.db "select port from sshjump where host = \"$host\"")
|
2018-06-05 15:24:58 -04:00
|
|
|
ssh -p $port $user@localhost
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $arg1 = id ]; then
|
|
|
|
user=$2
|
|
|
|
id=$3
|
2018-06-05 15:46:42 -04:00
|
|
|
port=$(sqlite3 /opt/sshjump/sshjump.db "select port from sshjump where id = \"$id\"")
|
2018-06-05 15:24:58 -04:00
|
|
|
ssh -p $port $user@localhost
|
|
|
|
fi
|