/usr/share/doc/bacula-common/examples/ssh-tunnel.sh is in bacula-common 7.0.5+dfsg-4build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/bin/sh
# script for creating / stopping a ssh-tunnel to a backupclient
# Stephan Holl<sholl@gmx.net>
# Modified by Joshua Kugler <joshua.kugler@uaf.edu>
#
#
# variables
USER=bacula
CLIENT=$2
LOCAL=your.backup.server.host.name
SSH=/usr/bin/ssh
case "$1" in
start)
# create ssh-tunnel
echo "Starting SSH-tunnel to $CLIENT..."
$SSH -fnCN2 -o PreferredAuthentications=publickey -i /usr/local/bacula/ssh/id_dsa -l $USER -R 9101:$LOCAL:9101 -R 9103:$LOCAL:9103 $CLIENT > /dev/null 2> /dev/null
exit $?
;;
stop)
# remove tunnel
echo "Stopping SSH-tunnel to $CLIENT..."
# find PID killem
PID=`ps ax | grep "ssh -fnCN2 -o PreferredAuthentications=publickey -i /usr/local/bacula/ssh/id_dsa" | grep "$CLIENT" | awk '{ print $1 }'`
kill $PID
exit $?
;;
*)
# usage:
echo " "
echo " Start SSH-tunnel to client-host"
echo " to bacula-director and storage-daemon"
echo " "
echo " USAGE:"
echo " ssh-tunnel.sh {start|stop} client.fqdn"
echo ""
exit 1
;;
esac
|