adds ssh tunneling script to connect remote DB
This commit is contained in:
5
env_files/ssh-tunnel-example.env
Normal file
5
env_files/ssh-tunnel-example.env
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
local_ip=192.168.2.109
|
||||||
|
local_ip_on_remote=localhost
|
||||||
|
local_port=5432
|
||||||
|
local_port_on_remote=5432
|
||||||
|
remote_host=federal-non-interactive
|
||||||
22
start-ssh-tunnel.sh
Normal file
22
start-ssh-tunnel.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ] || [ "$#" -gt 1 ]; then
|
||||||
|
echo takes only one argument
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${1}" ]; then
|
||||||
|
echo cannot find "${1}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck source=./env_files/ssh-tunnel-example.env
|
||||||
|
. "${1}"
|
||||||
|
|
||||||
|
ssh \
|
||||||
|
-v \
|
||||||
|
-N \
|
||||||
|
-L \
|
||||||
|
"${local_ip}:${local_port}:${local_ip_on_remote}:${local_port_on_remote}" \
|
||||||
|
"${remote_host}"
|
||||||
Reference in New Issue
Block a user