Commit 605df852 authored by Kirk Webb's avatar Kirk Webb

Merge remote-tracking branch 'central/master' into stordev

parents 2e54dec9 c441e137
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -48,6 +48,7 @@ my $TBBASE = "@TBBASE@";
my $MKCERT = "$TB/sbin/mkusercert";
my $SUDO = "/usr/local/bin/sudo";
my $PROTOUSER = "elabman";
my $MAINSITE = @TBMAINSITE@;
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin';
......@@ -63,6 +64,7 @@ use lib "@prefix@/lib";
use libdb;
use libtestbed;
use Project;
use User;
#
# Only real root can call this.
......@@ -480,6 +482,83 @@ while (my $row = $query_result->fetchrow_hashref()) {
}
}
#
# Looks for unapproved projects and unverified users. Do not do this in Utah,
# it would drive us nuts.
#
if (!$MAINSITE) {
$query_result =
DBQueryWarn("select pid_idx from projects where approved=0");
fatal("Error accessing the database.")
if (! $query_result);
my @badlist = ();
while (my ($pid_idx) = $query_result->fetchrow()) {
my $project = Project->Lookup($pid_idx);
fatal("Could not look up project $pid_idx in DB")
if (!defined($project));
#
# This gets special email.
#
if ($debug) {
print "Unapproved project: $project\n";
}
else {
push(@badlist, $project);
}
}
if (@badlist && !$debug) {
my $msg = "The following projects are not approved yet:\n\n";
foreach my $project (@badlist) {
my $idx = $project->pid_idx();
my $url = "$TBBASE/approveproject_form.php3?pid=$idx";
$msg .= "$project: $url\n";
}
SENDMAIL($TBOPS, "Testbed Unapproved Projects", $msg, $TBOPS)
if (!$impotent);
}
$query_result =
DBQueryWarn("select uid_idx from users ".
"where status='" . $User::USERSTATUS_NEWUSER . "'");
fatal("Error accessing the database.")
if (! $query_result);
@badlist = ();
while (my ($uid_idx) = $query_result->fetchrow()) {
my $user = User->Lookup($uid_idx);
fatal("Could not look up user $uid_idx in DB")
if (!defined($user));
#
# This gets special email.
#
if ($debug) {
print "Unverified user: $user\n";
}
else {
push(@badlist, $user);
}
}
if (@badlist && !$debug) {
my $msg = "The following users are not verified yet:\n\n";
foreach my $user (@badlist) {
my $idx = $user->uid_idx();
my $url = "$TBBASE/showuser.php3?user=$idx";
$msg .= "$user: $url\n";
}
SENDMAIL($TBOPS, "Testbed Unverified Users", $msg, $TBOPS)
if (!$impotent);
}
}
#
# Send email if anything was reported.
#
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use English;
use Getopt::Std;
#
# Create an admin user on the control node.
#
sub usage()
{
print STDERR "Usage: mkadmin.pl <uid> <pubkeyfile>\n";
print STDERR " mkadmin.pl [-r] <uid>\n";
exit(-1);
}
my $optlist = "r";
my $remove = 0;
my $HOMEDIR = "/home";
my $pubkey;
#
# Turn off line buffering on output
#
$| = 1;
#
# Parse command arguments.
#
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (exists($options{"r"})) {
$remove = 1;
}
if ($remove) {
usage()
if (@ARGV != 1);
}
else {
usage()
if (@ARGV != 2);
$pubkey = $ARGV[1];
die("$pubkey does not exist\n")
if (! -e $pubkey);
}
my $uid = $ARGV[0];
sub mysystem($)
{
my ($command) = @_;
system($command);
if ($?) {
print STDERR "Command failed: $? - '$command'\n";
}
}
if ($remove) {
mysystem("deluser --remove-home $uid");
exit(1)
if ($?);
exit(0);
}
#
# Add the user; if it already exists too bad.
#
mysystem("adduser --disabled-password --gecos '$uid' --ingroup root $uid");
exit(1)
if ($?);
# Need to be in this group too, for sudo.
mysystem("adduser $uid admin");
exit(1)
if ($?);
#
# Create and populate the .ssh dir.
#
mysystem("mkdir $HOMEDIR/$uid/.ssh")
if (! -e "$HOMEDIR/$uid/.ssh");
exit(1)
if ($?);
mysystem("cp -pf $pubkey $HOMEDIR/$uid/.ssh/authorized_keys");
exit(1)
if ($?);
mysystem("chmod 700 $HOMEDIR/$uid/.ssh");
mysystem("chmod 600 $HOMEDIR/$uid/.ssh/authorized_keys");
mysystem("chown -R $uid:root $HOMEDIR/$uid/.ssh");
......@@ -74,6 +74,7 @@ use Compress::Zlib;
use File::Temp qw(tempfile);
use MIME::Base64;
use Digest::SHA1 qw(sha1_hex);
use Scalar::Util qw(looks_like_number);
# Configure variables
my $TB = "@prefix@";
......@@ -2483,7 +2484,7 @@ sub GetTicketAuxAux($$$$$$$$$)
#
# Clear any new vlan tag reservations we made during this call.
#
foreach my $linkname (%vlan_reservations) {
foreach my $linkname (keys(%vlan_reservations)) {
my ($lanid, $vlan_tag) = @{ $vlan_reservations{$linkname} };
# If this is a new ticket, there is no lan object yet,
......@@ -6218,6 +6219,8 @@ sub GetSuggestedVlanFromHop($)
if (!defined($capref));
my $tag = GeniXML::GetText("suggestedVLANRange", $capref);
$tag = undef
if (defined($tag) && ! looks_like_number($tag));
return $tag;
}
......
......@@ -361,7 +361,7 @@ Phase "sslcnf", "Updating ssl syscert.cnf", sub {
Phase "apache", "Updating apache config", sub {
DoneIfIdentical("@top_builddir@/apache/httpd.conf", "$HTTPD_CONF");
BackUpFileFatal("$HTTPD_CONF");
ExecQuietFatal("$GMAKE -C $TOP_OBJDIR/apache install");
ExecQuietFatal("$GMAKE -C @top_builddir@/apache install");
};
Phase "rcconf", "Updating $RCCONF", sub {
DoneIfEdited($RCCONF);
......
#! /usr/bin/env python
#
# Copyright (c) 2004, 2005, 2006, 2007 University of Utah and the Flux Group.
# Copyright (c) 2004-2012 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -505,10 +505,10 @@ def infer_pid_eid(*args):
eid = None
for path in args:
dirs = path.split(os.path.sep)
if ((len(dirs) < 6) or not
if ((len(dirs) < 5) or not
((DIRS["proj"] in dirs and
"exp" in dirs[dirs.index(DIRS["proj"]):]) or
(len(dirs) >= 6 and
(len(dirs) >= 5 and
(DIRS["groups"] in dirs and
"exp" in dirs[dirs.index(DIRS["groups"]):])))):
# No match...
......
......@@ -24,7 +24,7 @@
include("defs.php3");
include_once("imageid_defs.php");
include_once("osinfo_defs.php");
include("osiddefs.php3");
include_once("osiddefs.php3");
#
# No PAGEHEADER since we spit out a Location header later. See below.
......
......@@ -25,7 +25,7 @@ include("defs.php3");
include_once("imageid_defs.php");
include_once("osinfo_defs.php");
include_once("node_defs.php");
include("osiddefs.php3");
include_once("osiddefs.php3");
#
# Only known and logged in users.
......
......@@ -25,7 +25,7 @@ include("defs.php3");
include_once("imageid_defs.php");
include_once("osinfo_defs.php");
include_once("node_defs.php");
include("osiddefs.php3");
include_once("osiddefs.php3");
#
# XXX
......
<?php
#
# Copyright (c) 2000-2008, 2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -23,7 +23,7 @@
#
include("defs.php3");
include_once("osinfo_defs.php");
include("osiddefs.php3");
include_once("osiddefs.php3");
include("form_defs.php");
#
......
......@@ -514,6 +514,27 @@ class OSinfo
<td class=left>$uuid</td>
</tr>\n";
if ($def_parentosid) {
$parent_result =
DBQueryFatal("select m.parent_osid,o.osname,o.pid ".
" from os_submap as m ".
"left join os_info as o on o.osid=m.parent_osid ".
"where m.osid='$osid'");
if (mysql_num_rows($parent_result)) {
while ($prow = mysql_fetch_array($parent_result)) {
$posid = $prow["parent_osid"];
$posname = $prow["osname"];
echo "<tr>";
echo " <td>Parent $posid:</td>";
echo " <td class=left>";
echo " <a href='showosinfo.php3?osid=$posid'>";
echo "$posname</a></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