Scripts for interacting with KVM virtual machines in NCIT cluster.
--- /dev/null
+#!/bin/bash
+
+#
+# Create an SSH tunnel to a remote host (destination) through another host
+# (gateway). This is useful, for example, when destionation in not accesible
+# directly, but may be accessed through the gateway.
+#
+# dest_... refers the destionation, gw_... refers the gateway.
+#
+# 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
+#
+
+# Use _DRY_RUN_ for testing purposes in case you don't want any action to
+# be undertaken.
+
+#_DRY_RUN_=1
+
+gw_username=razvan.deaconescu
+gw_ip=fep.grid.pub.ro
+gw_port=22
+
+if test $# -ne 2; then
+ echo "Usage: $0 localport dest-ip-address" 1>&2
+ exit 1
+fi
+
+localport=$1
+dest_ip=$2
+dest_port=22 # hard code SSH port
+
+# run SSH tunnel in background
+if test "x${_DRY_RUN_}" != "x1"; then
+ ssh -N -n -f -L ${localport}:${dest_ip}:${dest_port} \
+ -l ${gw_username} -p ${gw_port} ${gw_ip}
+fi
--- /dev/null
+# Sample configuration file for SSH tunnel creation scripts.
+# Use a single TAB as separator between localport an destination IP or
+# hostname.
+#
+# localport destination
+
+60122 10.42.5.136
+60222 10.42.5.225
+60322 10.42.5.223
+60422 10.42.5.226
+60522 10.42.5.224
+60622 10.42.5.227
+60722 10.42.5.228
+60822 10.42.5.229
+60922 10.42.5.230
+61022 10.42.5.231
+61122 10.42.5.240
+61222 10.42.5.243
+61322 10.42.5.232
+61422 10.42.5.233
+61522 10.42.5.234
+61622 10.42.5.239
+61722 10.42.5.235
+61822 10.42.5.236
+61922 10.42.5.237
+62022 10.42.5.244
--- /dev/null
+#!/bin/bash
+
+#
+# Create multiple SSH tunnels. Read configuration file and call
+# create-ssh-tunnel script.
+#
+# Configuration file consists of a set of destination hostnames or IP
+# addresses accesible from the gateway.
+#
+# 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
+#
+
+default_config=destinations.default.conf
+
+if test $# -ge 2; then
+ echo "Usage: $0 [config]" 1>&2
+ exit 1
+elif test $# -eq 1; then
+ config="$1"
+else
+ config=${default_config}
+fi
+
+# 1 - debug enabled
+# 0 or none - debug disabled
+_DEBUG_=1
+
+DEBUG()
+{
+ if test "x${_DEBUG_}" == "x1"; then
+ echo $@ 1>&2
+ fi
+}
+
+while read local_port destination; do
+ DEBUG "Adding tunnel to ${destination} through local port ${local_port} ..."
+ ./create-ssh-tunnel ${local_port} ${destination}
+done < <(grep -v '^[ \t]*#' ${config} | grep -v '^[ \t]*$')