All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 0132fe12 authored by Russ Fish's avatar Russ Fish

Add an RDP button to the Reserved Nodes row for rdesktop login to Windows nodes.

parent a83bc7d2
......@@ -39,7 +39,7 @@ FILES += $(wildcard $(SRCDIR)/*.php)
FILES += $(wildcard $(SRCDIR)/*.ico)
FILES += $(wildcard $(SRCDIR)/*.class)
FILES += $(SRCDIR)/.htaccess $(SRCDIR)/error.shtml $(SRCDIR)/ssh-mime.pl \
$(SRCDIR)/ssh-mime-windows.pl
$(SRCDIR)/ssh-mime-windows.pl $(SRCDIR)/rdp-mime.pl
AUTOICONS = $(wildcard $(SRCDIR)/autostatus-icons/*.gif)
AUTOICONS += $(wildcard $(SRCDIR)/autostatus-icons/*.png)
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
#
# This script generates an "tbc" file, to be passed to ./rdp-mime.pl
# on the remote node, when set up as a proper mime type.
#
#
# Only known and logged in users.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
#
# Verify form arguments.
#
if (!isset($node_id) ||
strcmp($node_id, "") == 0) {
USERERROR("You must provide a node ID.", 1);
}
$query_result =
DBQueryFatal("select n.jailflag,n.jailip,n.sshdport, ".
" r.vname,r.pid,r.eid, ".
" t.isvirtnode,t.isremotenode,t.isplabdslice ".
" from nodes as n ".
"left join reserved as r on n.node_id=r.node_id ".
"left join node_types as t on t.type=n.type ".
"where n.node_id='$node_id'");
if (mysql_num_rows($query_result) == 0) {
USERERROR("The node $node_id does not exist!", 1);
}
$row = mysql_fetch_array($query_result);
$jailflag = $row[jailflag];
$jailip = $row[jailip];
$sshdport = $row[sshdport];
$vname = $row[vname];
$pid = $row[pid];
$eid = $row[eid];
$isvirt = $row[isvirtnode];
$isremote = $row[isremotenode];
$isplab = $row[isplabdslice];
if (!isset($pid)) {
USERERROR("$node_id is not allocated to an experiment!", 1);
}
$filename = $node_id . ".tbrdp";
header("Content-Type: text/x-testbed-rdp");
header("Content-Disposition: inline; filename=$filename;");
header("Content-Description: RDP description file for a testbed node");
echo "hostname: $vname.$eid.$pid.$OURDOMAIN\n";
echo "login: $uid\n";
if ($isvirt) {
if ($isremote) {
#
# Remote nodes run sshd on another port since they so not
# have per-jail IPs. Of course, might not even be jailed!
#
if ($jailflag || $isplab) {
echo "port: $sshdport\n";
}
}
else {
#
# Local virt nodes are on the private network, so have to
# bounce through ops node to get there. They run sshd on
# on the standard port, but on a private IP.
#
echo "gateway: $USERNODE\n";
}
}
elseif ($ELABINELAB) {
echo "gateway: $USERNODE\n";
}
?>
......@@ -12,6 +12,7 @@ $osid_oslist = array();
$osid_oslist["Linux"] = 1;
$osid_oslist["FreeBSD"] = 1;
$osid_oslist["NetBSD"] = 1;
$osid_oslist["Windows"] = 1;
$osid_oslist["Oskit"] = 0;
$osid_oslist["Other"] = 1;
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
#
# This is a helper program for your web browser. It allows you to rdp
# to an experimental node by clicking on a menu option in the shownode
# page. Its extremely helpful with jailed nodes, where sshd is either
# running on another port, or on a private IP. Please see the Emulab FAQ
# for instructions on how to install this helper program.
#
# Obviously, it helps to have an ssh agent running.
#
sub usage()
{
print(STDERR "rdp-mime.pl <control-file>\n");
}
my $optlist = "";
my $config;
# Locals
my $hostname;
my $gateway;
my $port = "";
my $login = "";
#
# Turn off line buffering on output
#
$| = 1;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (@ARGV != 1) {
usage();
}
$config = $ARGV[0];
#
# Open up the config file. It tells us what to do.
#
open(CONFIG, "< $config")
or die("Could not open config file $config: $!\n");
while (<CONFIG>) {
chomp();
SWITCH1: {
/^port:\s*(\d+)$/ && do {
$port = "-p $1";
last SWITCH1;
};
/^hostname:\s*([-\w\.]+)$/ && do {
$hostname = $1;
last SWITCH1;
};
/^gateway:\s*([-\w\.]+)$/ && do {
$gateway = $1;
last SWITCH1;
};
/^login:\s*([-\w]+)$/ && do {
$login = "-u $1";
last SWITCH1;
};
}
}
close(CONFIG);
#
# Must have a hostip. Port is optional.
#
if (!defined($hostname)) {
die("Config file must specify a hostname\n");
}
# Run rdesktop in its own directory so it finds the keymaps subdirectory.
my $rd = 'cd ~fish/misc/rdesktop/rdesktop-1.3.1; ./rdesktop -K -g 1200x1024';
if (!defined($gateway)) {
exec "$rd $login $hostname &"; ### -p $pswd
}
else {
die("No proxying yet.\n");
}
www/rdp.gif

246 Bytes

......@@ -1075,7 +1075,7 @@ function SHOWNODES($pid, $eid, $sortby) {
# every reserved node.
#
$query_result =
DBQueryFatal("SELECT r.*,n.*,nt.isvirtnode, ".
DBQueryFatal("SELECT r.*,n.*,nt.isvirtnode,oi.OS, ".
" ns.status as nodestatus, ".
" date_format(rsrv_time,\"%Y-%m-%d&nbsp;%T\") as rsrvtime, ".
"nl.reported,nl.entry ".
......@@ -1083,6 +1083,7 @@ function SHOWNODES($pid, $eid, $sortby) {
"left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ".
"left join node_status as ns on ns.node_id=r.node_id ".
"left join os_info as oi on n.def_boot_osid=oi.osid ".
"inner join nodelogtemp as t on t.node_id=r.node_id ".
"left join nodelog as nl on nl.node_id=r.node_id and nl.reported=t.reported ".
......@@ -1092,13 +1093,14 @@ function SHOWNODES($pid, $eid, $sortby) {
}
else {
$query_result =
DBQueryFatal("SELECT r.*,n.*,nt.isvirtnode, ".
DBQueryFatal("SELECT r.*,n.*,nt.isvirtnode,oi.OS, ".
" ns.status as nodestatus, ".
" date_format(rsrv_time,\"%Y-%m-%d&nbsp;%T\") as rsrvtime ".
"from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ".
"left join node_status as ns on ns.node_id=r.node_id ".
"left join os_info as oi on n.def_boot_osid=oi.osid ".
"WHERE r.eid='$eid' and r.pid='$pid' ".
"ORDER BY $sortclause");
}
......@@ -1130,10 +1132,22 @@ function SHOWNODES($pid, $eid, $sortby) {
echo " <th>Last Log<br>Time</th>
<th>Last Log Message</th>\n";
}
echo " <th><a href=\"docwrapper.php3?docname=ssh-mime.html\">SSH</a>
</th>
<th><a href=\"faq.php3#UTT-TUNNEL\">Console</a></th>
</tr>\n";
echo " <th><a href=\"docwrapper.php3?docname=ssh-mime.html\">SSH</a></th>
<th><a href=\"faq.php3#UTT-TUNNEL\">Console</a></th>";
# Only put out a RDP column header if there are any Windows nodes.
$windows_query_result = DBQueryFatal("SELECT r.pid,r.eid,n.node_id,oi.OS ".
"from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join os_info as oi on n.def_boot_osid=oi.osid ".
"WHERE r.eid='$eid' and r.pid='$pid' and oi.OS='Windows'");
$anywindows = mysql_num_rows($windows_query_result);
if ($anywindows) {
echo " <th>
<a href=\"docwrapper.php3?docname=rdp-mime.html\">RDP</a>
</th>\n";
}
echo " </tr>\n";
$stalemark = "<b>?</b>";
$count = 0;
......@@ -1148,6 +1162,7 @@ function SHOWNODES($pid, $eid, $sortby) {
$status = $row[nodestatus];
$bootstate = $row[eventstate];
$isvirtnode = $row[isvirtnode];
$iswindowsnode = $row[OS]=='Windows';
$idlehours = TBGetNodeIdleTime($node_id);
$stale = TBGetNodeIdleStale($node_id);
......@@ -1166,8 +1181,7 @@ function SHOWNODES($pid, $eid, $sortby) {
$count++;
echo "<tr>
<td><A href='shownode.php3?node_id=$node_id'>$node_id</a>
</td>
<td><A href='shownode.php3?node_id=$node_id'>$node_id</a></td>
<td>$vname</td>\n";
if ($pid == $TBOPSPID)
echo "<td>$rsrvtime</td>\n";
......@@ -1175,7 +1189,7 @@ function SHOWNODES($pid, $eid, $sortby) {
if ($def_boot_osid) {
echo "<td>";
SPITOSINFOLINK($def_boot_osid);
echo "</td>";
echo "</td>\n";
}
else
echo "<td>&nbsp</td>\n";
......@@ -1191,20 +1205,36 @@ function SHOWNODES($pid, $eid, $sortby) {
if ($showlastlog) {
echo " <td>$row[reported]</td>\n";
echo " <td>$row[entry] (<a href='shownodelog.php3?node_id=$node_id'>LOG</a>)</td>\n";
echo " <td>$row[entry]
(<a href='shownodelog.php3?node_id=$node_id'>LOG</a>)
</td>\n";
}
echo " <td align=center>
<A href='nodessh.php3?node_id=$node_id'>
<img src=\"ssh.gif\" alt=s></A></td>\n";
<A href='nodessh.php3?node_id=$node_id'>
<img src=\"ssh.gif\" alt=s></A>
</td>\n";
if ($isvirtnode) {
echo "<td>&nbsp</td>\n";
}
else {
echo " <td align=center>
<A href='nodetipacl.php3?node_id=$node_id'>
<img src=\"console.gif\" alt=c></A></td>\n";
<A href='nodetipacl.php3?node_id=$node_id'>
<img src=\"console.gif\" alt=c></A>
</td>\n";
}
if ($iswindowsnode) {
echo " <td align=center>
<A href='noderdp.php3?node_id=$node_id'>
<img src=\"rdp.gif\" alt=r></A>
</td>\n";
}
elseif ($anywindows) {
echo " <td>&nbsp</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
......
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