Commit 8dfd5adf authored by Leigh Stoller's avatar Leigh Stoller

Add -mng option; ssh to the management (ilo) interface instead of the

node. There auth method has to be ssh-key in the DB, since I did not
feel like dealing with password auth and the required tty stuff.
parent be0c285a
......@@ -12,13 +12,12 @@ use English;
# An ssh frontend to determine if the node is local or remote, and to
# add in special options.
#
# NOTE THE DIFFERENT SYNTAX!
#
sub usage()
{
print STDOUT
"Usage: sshtb [ssh args] -host <hostname> [command and args ...]\n";
print STDERR
"Usage: sshtb [ssh args] [-mng] -host <hostname> [command and args]\n";
print STDERR
" Use -mng option to talk to ilo/drac interface\n";
exit(-1);
}
......@@ -40,6 +39,7 @@ my $hostname;
my $chpid = 0;
# Run command on the local machine.
my $runlocal = 0;
my $domng = 0;
#
# Testbed Support libraries
......@@ -49,6 +49,7 @@ use libdb;
use libtestbed;
use Node;
use Interface;
use EmulabConstants;
#
# Turn off line buffering on output
......@@ -69,6 +70,10 @@ if (@ARGV < 2) {
# Find everything before the -host.
while (@ARGV) {
my $arg = shift(@ARGV);
if ($arg eq "-mng") {
$domng = 1;
next;
}
if ($arg eq "-host") {
$hostname = shift(@ARGV);
last;
......@@ -95,6 +100,7 @@ if ($hostname eq $FSNODE && $FSNODE eq $BOSSNODE) {
else {
my $user;
my $node = Node->Lookup($hostname);
my $key;
if (defined($node)) {
if ($node->isvirtnode()) {
......@@ -117,6 +123,30 @@ else {
}
}
}
elsif ($domng) {
#
# We want to log into the management port.
#
my $interface = Interface->LookupManagement($node);
if (! defined($interface)) {
print STDERR "No management interface for $node\n";
exit(1);
}
$hostname = $interface->IP();
#
# Also need info from the outlets authorization table.
#
($user,$key) = $node->GetOutletAuthInfo("ssh-key");
if (!defined($user)) {
print STDERR "No authinfo user defined for $node\n";
exit(1);
}
if (! -e $key) {
print STDERR "Key $key does not exist\n";
exit(1);
}
}
elsif ($node->isremotenode() && !$node->isdedicatedremote()) {
$user = "emulabman";
}
......@@ -151,6 +181,7 @@ else {
@cmdargs = (@sshargs, @args,
(defined($user) ? ("-l", "$user") : ()),
(defined($key) ? ("-i", "$key") : ()),
$hostname, @ARGV);
}
......
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