Commit 9de266c3 authored by Robert Ricci's avatar Robert Ricci

New script: sshtb

sshtb is a _very_ simple shell script that runs ssh with a few commandline
parameters, which make it play nicer in an script environment. These
parameters can be changed with the '--with-ssh-args' argument, but default to:
'-q -o "BatchMode yes" -o "StrictHostKeyChecking no"'
All ssh calls now use this script.
parent 664be064
......@@ -16,6 +16,8 @@ ac_help="$ac_help
--with-TBDEFS=name Specify definitions file (defs-default default)"
ac_help="$ac_help
--with-LEDA Specify LEDA path (/usr/testbed default)"
ac_help="$ac_help
--with-ssh-args Specify ssh arguments when running from testbed scripts "
ac_help="$ac_help
--enable-debug Build with debug flags (-g -DDEBUG)
--disable-debug Build with optimization flags (-O2 -DNDEBUG -UDEBUG)"
......@@ -557,7 +559,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:561: checking host system type" >&5
echo "configure:563: checking host system type" >&5
host_alias=$host
case "$host_alias" in
......@@ -578,7 +580,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:582: checking build system type" >&5
echo "configure:584: checking build system type" >&5
build_alias=$build
case "$build_alias" in
......@@ -604,7 +606,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:608: checking for $ac_word" >&5
echo "configure:610: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -636,7 +638,7 @@ fi
# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
set dummy ${ac_tool_prefix}g++; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:640: checking for $ac_word" >&5
echo "configure:642: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -668,7 +670,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:672: checking for $ac_word" >&5
echo "configure:674: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -700,7 +702,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:704: checking for $ac_word" >&5
echo "configure:706: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -732,7 +734,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:736: checking for $ac_word" >&5
echo "configure:738: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -761,6 +763,38 @@ fi
# Extract the first word of "${ac_tool_prefix}ssh", so it can be a program name with args.
set dummy ${ac_tool_prefix}ssh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:770: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SSH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$SSH"; then
ac_cv_prog_SSH="$SSH" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_SSH="${ac_tool_prefix}ssh"
break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_prog_SSH" && ac_cv_prog_SSH="ssh"
fi
fi
SSH="$ac_cv_prog_SSH"
if test -n "$SSH"; then
echo "$ac_t""$SSH" 1>&6
else
echo "$ac_t""no" 1>&6
fi
#
# These get defined in the definitions file (--with-TBDEFS).
......@@ -827,6 +861,23 @@ fi
#
# Arguments to ssh to disable strict host key checking, etc
#
# Check whether --with-SSH_ARGS or --without-SSH_ARGS was given.
if test "${with_SSH_ARGS+set}" = set; then
withval="$with_SSH_ARGS"
SSH_ARGS="$withval"
else
SSH_ARGS="-q -o \"BatchMode yes\" -o \"StrictHostKeyChecking no\""
fi
#
# Optionally build with optimization or aggressive non-optimization
# (Actually three options: on, off or default.)
......@@ -864,7 +915,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:868: checking for a BSD compatible install" >&5
echo "configure:919: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -952,7 +1003,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/linux/GNUmakefile \
tmcd/netbsd/GNUmakefile \
tmcd/tmcd.restart \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config utils/sshtb \
www/GNUmakefile www/defs.php3 www/dbdefs.php3"
#
......@@ -1121,6 +1172,7 @@ s%@CXX@%$CXX%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@STRIP@%$STRIP%g
s%@SSH@%$SSH%g
s%@TBDBNAME@%$TBDBNAME%g
s%@WWWDEFS@%$WWWDEFS%g
s%@TBOPSEMAIL@%$TBOPSEMAIL%g
......@@ -1128,6 +1180,7 @@ s%@TBLOGSEMAIL@%$TBLOGSEMAIL%g
s%@DELAYCAPACITY@%$DELAYCAPACITY%g
s%@IPBASE@%$IPBASE%g
s%@LEDA@%$LEDA%g
s%@SSH_ARGS@%$SSH_ARGS%g
s%@OPT_CFLAGS@%$OPT_CFLAGS%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
......
......@@ -10,6 +10,7 @@ AC_CHECK_TOOL(CXX,g++)
AC_CHECK_TOOL(AR,ar)
AC_CHECK_TOOL(RANLIB,ranlib)
AC_CHECK_TOOL(STRIP,strip)
AC_CHECK_TOOL(SSH,ssh)
#
# These get defined in the definitions file (--with-TBDEFS).
......@@ -66,6 +67,18 @@ AC_ARG_WITH(LEDA,
])
AC_SUBST(LEDA)
#
# Arguments to ssh to disable strict host key checking, etc
#
AC_ARG_WITH(SSH_ARGS,
[ --with-ssh-args Specify ssh arguments when running from testbed scripts ],
[
SSH_ARGS="$withval"
],[
SSH_ARGS="-q -o \"BatchMode yes\" -o \"StrictHostKeyChecking no\""
])
AC_SUBST(SSH_ARGS)
#
# Optionally build with optimization or aggressive non-optimization
# (Actually three options: on, off or default.)
......@@ -125,7 +138,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/linux/GNUmakefile \
tmcd/netbsd/GNUmakefile \
tmcd/tmcd.restart \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config utils/sshtb \
www/GNUmakefile www/defs.php3 www/dbdefs.php3"
#
......
......@@ -24,7 +24,7 @@ require libdb;
# Turn off line buffering on output
$| = 1;
my $SSH = "sshtb -n -q -l root plastic.emulab.net";
my $SSH = "$TB/bin/sshtb -n -l root plastic.emulab.net";
my $PROG = "/usr/testbed/sbin/console_setup.proxy";
my $TBPID = "flux";
my $cmdargs = "";
......
......@@ -19,7 +19,7 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
# Note no -n option. We redirect stdin from the new exports file below.
my $SSH = "sshtb -q -l root fs.emulab.net";
my $SSH = "$TB/bin/sshtb -l root fs.emulab.net";
my $PROG = "/usr/testbed/sbin/exports_setup.proxy";
my $exportstail = "/var/tmp/exports.tail";
my $lockfile = "/var/tmp/testbed_exports_lockfile";
......
......@@ -17,7 +17,7 @@ my $TBOPS = "@TBOPSEMAIL@";
my $HOMEDIR = "/users";
my $PBAG = "$TB/sbin/paperbag";
my $SSH = "ssh";
my $SSH = "$TB/bin/sshtb";
my $CONTROL = "users.emulab.net";
my $GROUPADD= "/usr/sbin/pw groupadd";
my $USERADD = "/usr/sbin/pw useradd";
......
......@@ -29,7 +29,7 @@ my $TB = "@prefix@";
push(@INC, "$TB/lib");
require libdb;
my $ssh = "ssh -n -q";
my $ssh = "$TB/bin/sshtb -n";
my $power = "$TB/bin/power";
my $ipod = "$TB/sbin/ipod";
my $ping = "/sbin/ping";
......
......@@ -17,7 +17,7 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $HOMEDIR = "/users";
my $SSH = "ssh";
my $SSH = "$TB/bin/sshtb";
my $CONTROL = "users.emulab.net";
my $USERDEL = "/usr/sbin/pw userdel";
......
......@@ -18,6 +18,7 @@ use English;
#
my $TB = "@prefix@";
my $DBNAME = "@TBDBNAME@";
my $SSH = "$TB/bin/sshtb";
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin';
......@@ -124,7 +125,7 @@ if (system("/usr/sbin/pw groupdel $pid")) {
#
$UID = 0;
if (system("/usr/local/bin/sshtb $control_node /usr/sbin/pw groupdel $pid")) {
if (system("$SSH $control_node /usr/sbin/pw groupdel $pid")) {
print STDOUT "Could not remove group $pid fron control node (plastic)\n";
exit(-1);
}
......
......@@ -8,7 +8,7 @@ SUBDIR = utils
include $(OBJDIR)/Makeconf
BIN_SCRIPTS = delay_config
BIN_SCRIPTS = delay_config sshtb
SBIN_SCRIPTS = vlandiff vlansync
#
......
#!/bin/sh
@SSH@ @SSH_ARGS@ $*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment