Commit bb54a1b2 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Another wrapper for tiptunnel that can be installed and used on boss;

gets the stuff from the DB instead of the xmlrpc server.
parent abf45b15
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
SRCDIR = @srcdir@
......@@ -10,7 +10,7 @@ SUBDIR = tip
include $(OBJDIR)/Makeconf
all: tip tiptunnel console.bin console tippty
all: tip tiptunnel console.bin console console.boss tippty
client: tippty
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -72,8 +72,11 @@ client-install: client
control-install tipserv-install: all $(INSTALL_BINDIR)/tip $(INSTALL_BINDIR)/tiptunnel $(INSTALL_BINDIR)/console.bin $(INSTALL_BINDIR)/console
install: control-install
install: all $(INSTALL_BINDIR)/tip \
$(INSTALL_BINDIR)/tiptunnel \
-mkdir -p $(INSTALL_DIR)/opsdir/bin
$(INSTALL_PROGRAM) console.boss $(INSTALL_DIR)/bin/console
$(INSTALL_PROGRAM) tiptunnel $(INSTALL_DIR)/opsdir/bin/tiptunnel
$(INSTALL_PROGRAM) tip $(INSTALL_DIR)/opsdir/bin/tip
$(INSTALL_PROGRAM) console $(INSTALL_DIR)/opsdir/bin/console
#!/usr/bin/perl -w
# Copyright (c) 2005-2009 University of Utah and the Flux Group.
# All rights reserved.
use English;
use Getopt::Std;
use POSIX qw(setsid);
use File::Temp qw(tempfile);
# Wrapper for console program; grab tipacl from XMLRPC server, and feed it
# to the console binary.
sub usage()
print(STDOUT "Usage: console [-d] pcXXX\n");
my $optlist = "dp:";
my @opts = ();
# Configure variables
my $TB = "@prefix@";
my $CONSOLEBIN = "$TB/bin/console.bin";
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Turn off line buffering on output. Very important for this script!
$| = 1;
# Load the Testbed support stuff.
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use Node;
use User;
sub fatal($)
my ($msg) = @_;
die("*** $0:\n".
" $msg\n");
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
%options = ();
if (! getopts($optlist, \%options)) {
# pass through select options
if (defined($options{"d"})) {
push @opts, "-d";
if (defined($options{"p"})) {
push @opts, "-p";
push @opts, $options{"p"};
if (@ARGV != 1);
my $nodeid = $ARGV[0];
# Map invoking user to object.
my $this_user = User->ThisUser();
if (! defined($this_user)) {
fatal("You ($UID) do not exist!");
# Figure out who called us. Must have admin status to do this.
if (!$this_user->IsAdmin()) {
fatal("You must be a TB administrator to run this script!");
my $node = Node->Lookup($nodeid);
if (!defined($node)) {
fatal("No such node $nodeid");
# Grab what we need out of the DB.
my ($tipserver, $tipname, $portnum, $keydata);
if ($node->TipServer(\$tipserver, \$tipname, \$portnum, \$keydata)) {
fatal("Could not find tipserver info for $nodeid");
# Make a temp file for the acl.
$ENV{'TMPDIR'} = "/tmp";
my ($fh, $tempfile) = tempfile(UNLINK => 0);
fatal("Could not create tempfile for acl stuff")
if (!defined($fh));
print $fh "server: $tipserver\n";
print $fh "portnum: $portnum\n";
print $fh "keydata: $keydata\n";
# Do not want to leave the acl file around, and do not want to wait for
# the user to quit the program, so fork a child to wait a moment and remove
# the file. We have the child do it so as to avoid messing with the session
# and tty goo.
my $syspid = fork();
# Child delays a moment and exits.
if (!$syspid) {
my @cmdargs = ($CONSOLEBIN, "-a", "$tempfile", @opts, "$nodeid");
die("*** $0:\n".
" Exec failure: '@cmdargs'\n");
Supports Markdown
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