Commit 77092495 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Checkpoint widearea changes. A zillion little things. Now running okay

on the RON nodes and in the new widearea image.
parent 83b3d5d3
......@@ -1817,6 +1817,14 @@ sub remotenodeupdate()
{
local $tmcctimeout = 10;
if ($USESFS) {
#
# Setup SFS hostid.
#
print STDOUT "Setting up for SFS ... \n";
dosfshostid();
}
print STDOUT "Checking Testbed group/user configuration ... \n";
doaccounts();
}
......
......@@ -85,3 +85,15 @@ script-install: dir-install
$(INSTALL) -m 644 $(SRCDIR)/gated_fxp1.conf $(INSTALL_DIR)/gated_fxp1.conf
$(INSTALL) -m 644 $(SRCDIR)/gated_fxp4.conf $(INSTALL_DIR)/gated_fxp4.conf
$(INSTALL) -m 755 $(SRCDIR)/shutdown.sh $(RC_DIR)/shutdown.sh
$(INSTALL) -m 755 $(SRCDIR)/testbed.sh $(RC_DIR)/testbed.sh
sfs-install:
$(INSTALL) -m 755 -o root -g wheel -d /etc/sfs
$(INSTALL) -m 755 $(SRCDIR)/sfs.sh $(RC_DIR)/sfs.sh
$(INSTALL) -m 644 $(SRCDIR)/exports $(ETCDIR)/exports
$(INSTALL) -m 644 $(SRCDIR)/sfsrwsd_config $(ETCDIR)/sfs/sfsrwsd_config
$(INSTALL) -m 644 $(SRCDIR)/sfssd_config $(ETCDIR)/sfs/sfssd_config
$(INSTALL) -m 755 -o sfs -g sfs -d /var/sfs
$(INSTALL) -m 775 -o sfs -g sfs -d /var/sfs/root
$(INSTALL) -m 775 -o sfs -g sfs -d /var/sfs/root/var
$(INSTALL) -m 775 -o sfs -g sfs -d /var/sfs/root/usr
/ localhost -alldirs
/var localhost -alldirs
/usr localhost -alldirs
......@@ -18,5 +18,6 @@ uucp:*:66:
xten:*:67:xten
dialer:*:68:
network:*:69:
sfs:*:77:
nogroup:*:65533:
nobody:*:65534:
......@@ -205,7 +205,7 @@ sub os_usermod($$$$$)
$glist = "-G $glist";
}
if (system("$CHPASS $pswd $login") != 0) {
if (system("$CHPASS '$pswd' $login") != 0) {
warn "*** WARNING: $CHPASS $login error.\n";
return -1;
}
......
......@@ -13,3 +13,4 @@ uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucic
xten:*:67:67::0:0:X-10 daemon:/usr/local/xten:/sbin/nologin
pop:*:68:6::0:0:Post Office Owner:/nonexistent:/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/sbin/nologin
sfs:*:77:77::0:0:SFS pseudo-user:/:/bin/nologin
......@@ -21,6 +21,8 @@ my $HISTORY = "/root/.history";
my $MAILFILE = "/var/mail/root";
my $LEASES = "/var/db/dhclient.leases";
my $NTPDRIFT = "/etc/ntp/drift";
my $SFSUSERS = "/etc/sfs/sfs_users";
my $SFSHOSTKEY = "/etc/sfs/sfs_host_key";
#
# Load the OS independent support library. It will load the OS dependent
......@@ -127,3 +129,11 @@ system("rm -rf /tmp/* /tmp/.??*");
print "Removing dhclient leases ...\n";
system("rm -f $LEASES");
print "Removing SFS files ...\n";
if (-f $SFSUSERS) {
system("rm -f $SFSUSERS ${SFSUSERS}.pub");
}
if (-f $SFSHOSTKEY) {
system("rm -f $SFSHOSTKEY");
}
......@@ -18,10 +18,10 @@ if [ -e /etc/testbed/ismfs ]; then
exit 0
fi
echo "Checking for file updates ..."
export HOME=/root
if [ -f /etc/testbed/supfile ]; then
echo "Checking for file updates ..."
set -- `/etc/testbed/tmcc bossinfo`
/usr/local/bin/cvsup -h $1 -e -1 -g -L 1 /etc/testbed/supfile
fi
......
......@@ -66,6 +66,7 @@ if (! $nickname) {
print STDOUT "No Testbed nickname available!\n";
exit(0);
}
$nickname = lc($nickname);
#
# No prints. Something screwy in dhclient causes these prints
......
#!/bin/sh
case "$1" in
start)
if [ ! -e /etc/sfs ]; then
mkdir -m 0755 /etc/sfs;
fi
if [ -f /usr/local/bin/sfskey -a ! -f /etc/sfs/sfs_host_key ]; then
/usr/local/bin/sfskey gen -K -P -n \
root@`hostname` /etc/sfs/sfs_host_key
fi
if [ -x /usr/local/sbin/sfscd ]; then
/usr/local/sbin/sfscd && echo -n ' sfscd'
fi
if [ -x /usr/local/sbin/sfssd ]; then
/usr/local/sbin/sfssd && echo -n ' sfssd'
fi
;;
stop)
if [ -f /var/run/sfssd.pid ]; then
kill `cat /var/run/sfssd.pid`;
fi
if [ -f /var/run/sfscd.pid ]; then
kill `cat /var/run/sfscd.pid`;
fi
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
Export /var/sfs/root /
Export /var /var
Export /usr /usr
Server *
Release *
Service 1 /usr/local/lib/sfs/sfsrwsd
Service 2 /usr/local/lib/sfs/sfsauthd
Service 3 /usr/local/lib/sfs/rexd
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Boottime initialization.
#
case "$1" in
start)
if [ -x /etc/testbed/rc.testbed ]; then
echo ""
/etc/testbed/rc.testbed
fi
;;
stop)
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
......@@ -1817,6 +1817,14 @@ sub remotenodeupdate()
{
local $tmcctimeout = 10;
if ($USESFS) {
#
# Setup SFS hostid.
#
print STDOUT "Setting up for SFS ... \n";
dosfshostid();
}
print STDOUT "Checking Testbed group/user configuration ... \n";
doaccounts();
}
......
......@@ -79,3 +79,6 @@ script-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/tbshutdown /etc/rc.d/init.d/
-ln -s /etc/rc.d/init.d/tbshutdown /etc/rc.d/rc3.d/S13tbshutdown
-ln -s /etc/rc.d/init.d/tbshutdown /etc/rc.d/rc6.d/K13tbshutdown
$(INSTALL) -m 755 $(SRCDIR)/sfs.sh /etc/rc.d/init.d/sfs.sh
-ln -s /etc/rc.d/init.d/sfs.sh /etc/rc.d/rc3.d/S50sfs
-ln -s /etc/rc.d/init.d/sfs.sh /etc/rc.d/rc6.d/K50sfs
......@@ -13,7 +13,7 @@ package liblocsetup;
use Exporter;
@ISA = "Exporter";
@EXPORT =
qw ( $CP $EGREP $MOUNT $UMOUNT $TMPASSWD
qw ( $CP $EGREP $MOUNT $UMOUNT $TMPASSWD $SFSSD $SFSCD
os_cleanup_node os_ifconfig_line os_etchosts_line
os_setup os_groupadd os_useradd os_userdel os_usermod os_mkdir
os_rpminstall_line enable_ipod
......@@ -196,7 +196,7 @@ sub os_usermod($$$$$)
$glist = "-G $glist";
}
return system("$USERMOD -g $gid $glist -p $pswd $login");
return system("$USERMOD -g $gid $glist -p '$pswd' $login");
}
#
......
......@@ -20,6 +20,8 @@ my $RUNDIR = "/var/run";
my $HISTORY = "/.bash_history";
my $MAILFILE = "/var/spool/mail/root";
my $NTPDRIFT = "/etc/ntp/drift";
my $SFSUSERS = "/etc/sfs/sfs_users";
my $SFSHOSTKEY = "/etc/sfs/sfs_host_key";
#
# Load the OS independent support library. It will load the OS dependent
......@@ -123,3 +125,11 @@ system("rm -rf $RUNDIR/*.pid");
print "Cleaing out /tmp ...\n";
system("rm -rf /tmp/* /tmp/.??*");
print "Removing SFS files ...\n";
if (-f $SFSUSERS) {
system("rm -f $SFSUSERS ${SFSUSERS}.pub");
}
if (-f $SFSHOSTKEY) {
system("rm -f $SFSHOSTKEY");
}
......@@ -51,6 +51,7 @@ if (! $nickname) {
print STDOUT "No Testbed nickname available!\n";
exit(0);
}
$nickname = lc($nickname);
print STDOUT "Resetting hostname to ${nickname} ... ";
......
#!/bin/sh
case "$1" in
start)
if [ ! -e /etc/sfs ]; then
mkdir -m 0755 /etc/sfs;
fi
if [ -f /usr/local/bin/sfskey -a ! -f /etc/sfs/sfs_host_key ]; then
/usr/local/bin/sfskey gen -K -P -n \
root@`hostname` /etc/sfs/sfs_host_key
fi
if [ -x /usr/local/sbin/sfscd ]; then
/usr/local/sbin/sfscd && echo -n ' sfscd'
fi
if [ -x /usr/local/sbin/sfssd ]; then
/usr/local/sbin/sfssd && echo -n ' sfssd'
fi
;;
stop)
if [ -f /var/run/sfssd.pid ]; then
kill `cat /var/run/sfssd.pid`;
fi
if [ -f /var/run/sfscd.pid ]; then
kill `cat /var/run/sfscd.pid`;
fi
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
......@@ -2,17 +2,19 @@
# Testbed TMCD client program
#
BOSSNODE = boss.emulab.net
#BOSSNODE = golden-gw.ballmoss.com
CFLAGS += -O -g -Wall -DUDP -DSTANDALONE -DBOSSNODE='"$(BOSSNODE)"'
SRCDIR = .
DESTDIR =
INSTALL_DIR = $(DESTDIR)/usr/local/etc/emulab
RC_DIR = $(DESTDIR)/usr/local/etc/rc.d
OLD_DIR = $(DESTDIR)/usr/local/etc/testbed
INSTALL = /usr/bin/install -c
INSTALL_PROG = /usr/bin/install -c -m 755
DISTFILES = makefile decls.h libsetup.pm ssl.c ssl.h tmcc.c
WAFILES = liblocsetup-linux.pm liblocsetup-freebsd.pm install.sh \
emulabctl rc.testbed update vnodesetup watchdog \
reinstall.sh emulabkey
reinstall.sh emulabkey cvsup.auth cvsup.sh \
runcvsup.sh webserver.pl
BSDFILES = setipod
DISTDIR = /tmp/emulab
......@@ -31,18 +33,37 @@ ssl.o: ssl.c ssl.h decls.h
clean:
rm -f *.o core tmcc
emulab-install: misc-install script-install bin-install
emulab-install: misc-install script-install bin-install post-install
dir-install:
-mkdir -p $(INSTALL_DIR)
$(INSTALL) -d -m 755 -o root -g wheel $(INSTALL_DIR)
$(INSTALL) -d -m 750 -o root -g wheel $(INSTALL_DIR)/.cvsup
$(INSTALL) -d -m 755 -o root -g wheel $(DESTDIR)/var/emulab
$(INSTALL) -d -m 755 -o root -g wheel $(DESTDIR)/var/emulab/sup
$(INSTALL) -d -m 755 -o root -g wheel $(RC_DIR)
cp /dev/null $(INSTALL_DIR)/isrem
-rm -rf /usr/local/etc/testbed
ln -s emulab /usr/local/etc/testbed
if [ ! -L $(OLD_DIR) ]; then \
cp -p $(OLD_DIR)/passdb.db /var/tmp; \
cp -p $(OLD_DIR)/groupdb.db /var/tmp; \
cp -p $(OLD_DIR)/passdb.db $(INSTALL_DIR); \
cp -p $(OLD_DIR)/groupdb.db $(INSTALL_DIR); \
fi
-rm -rf $(DESTDIR)/usr/local/etc/testbed
ln -s emulab $(DESTDIR)/usr/local/etc/testbed
-rm -f $(INSTALL_DIR)/liblocsetup.pm
ln -s liblocsetup-freebsd.pm $(INSTALL_DIR)/liblocsetup.pm
misc-install: dir-install
misc-install: dir-install bossnode
$(INSTALL) bossnode $(INSTALL_DIR)/bossnode
$(INSTALL) supfile $(INSTALL_DIR)/supfile
$(INSTALL) -m 440 $(SRCDIR)/client.pem $(INSTALL_DIR)/client.pem
$(INSTALL) -m 440 $(SRCDIR)/emulab.pem $(INSTALL_DIR)/emulab.pem
$(INSTALL) -m 440 $(SRCDIR)/cvsup.auth $(INSTALL_DIR)/.cvsup/auth
bin-install: dir-install tmcc
$(INSTALL_PROG) tmcc $(INSTALL_DIR)/tmcc
$(INSTALL_PROG) trafgen $(INSTALL_DIR)/trafgen
$(INSTALL_PROG) vtund $(INSTALL_DIR)/vtund
script-install: dir-install
for file in $(WAFILES); do \
......@@ -52,8 +73,12 @@ script-install: dir-install
$(INSTALL_PROG) $(SRCDIR)/$$file $(INSTALL_DIR)/$$file; \
done
$(INSTALL_PROG) $(SRCDIR)/libsetup.pm $(INSTALL_DIR)/libsetup.pm
$(INSTALL) -m 440 $(SRCDIR)/client.pem $(INSTALL_DIR)/client.pem
$(INSTALL) -m 440 $(SRCDIR)/emulab.pem $(INSTALL_DIR)/emulab.pem
rm -f $(RC_DIR)/testbed.sh
rm -f $(RC_DIR)/emulab.sh
rm -f $(RC_DIR)/z.emulab.sh
$(INSTALL_PROG) $(SRCDIR)/rc.testbed $(RC_DIR)/z.emulab.sh
rm -f $(RC_DIR)/0.cvsup.sh
$(INSTALL_PROG) $(SRCDIR)/cvsup.sh $(RC_DIR)/0.cvsup.sh
post-install:
for file in $(WAFILES); do \
......@@ -66,23 +91,32 @@ post-install:
chmod u+s $(INSTALL_DIR)/update
chown root $(INSTALL_DIR)/vnodesetup
chmod u+s $(INSTALL_DIR)/vnodesetup
chown root /usr/bin/suidperl
chmod u+s /usr/bin/suidperl
-chown root $(DESTDIR)/usr/bin/suidperl
-chmod u+s $(DESTDIR)/usr/bin/suidperl
chown emulabman $(INSTALL_DIR)/client.pem $(INSTALL_DIR)/emulab.pem
chmod 640 $(INSTALL_DIR)/client.pem $(INSTALL_DIR)/emulab.pem
dist: trafgen pemfile
ron-dist: dist
cp /usr/testbed/etc/ronnode.pem $(DISTDIR)/client.pem
cp ron/supfile.ron $(DISTDIR)/supfile
rm -f $(DISTDIR)-ron.tar
tar cf $(DISTDIR)-ron.tar -C $(DISTDIR) .
wa-dist: dist
cp /usr/testbed/etc/pcwa.pem $(DISTDIR)/client.pem
cp ron/supfile.wa $(DISTDIR)/supfile
rm -f $(DISTDIR)-wa.tar
tar cf $(DISTDIR)-wa.tar -C $(DISTDIR) .
dist: trafgen
rm -rf $(DISTDIR)
mkdir $(DISTDIR)
cp -p $(DISTFILES) $(DISTDIR)
for file in $(WAFILES); do cp ron/$$file $(DISTDIR); done
for file in $(BSDFILES); do cp freebsd/$$file $(DISTDIR); done
cp /usr/testbed/etc/emulab.pem $(DISTDIR)
cp /usr/testbed/etc/$(PEMFILE) $(DISTDIR)/client.pem
cp /usr/local/sbin/vtund $(DISTDIR)
cp $(TRAFGEN) $(DISTDIR)
rm -f $(DISTDIR).tar
tar cf $(DISTDIR).tar -C $(DISTDIR) .
trafgen:
ifndef TRAFGEN
......@@ -90,9 +124,9 @@ ifndef TRAFGEN
@false
endif
pemfile:
ifndef PEMFILE
@echo "You must define PEMFILE (name of the pem file)."
@false
endif
#
# We build the bossnode file from config info
#
bossnode: makefile
echo >$@ "$(BOSSNODE)"
paper.emulab.net:widearea@widearea.emulab.net:UseLess$%^PassWord:
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Fire up a cvsup each time we boot.
#
case "$1" in
start)
if [ -f /usr/local/etc/emulab/runcvsup.sh ]; then
/usr/local/etc/emulab/runcvsup.sh && echo -n ' cvsup'
fi
;;
stop)
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
......@@ -11,9 +11,22 @@
case "$1" in
start)
/usr/local/etc/emulab/watchdog > /dev/null 2>&1 && echo -n ' Emulab'
#
# Do not start the mini server on RON nodes yet.
#
if [ -x /usr/local/etc/emulab/webserver.pl -a -e /etc/emulab.pkey ]
then
/usr/local/etc/emulab/webserver.pl && echo -n ' Webserver'
fi
;;
stop)
(killall watchdog; sleep 5) > /dev/null 2>&1 && echo -n ' Emulab'
if [ -f /var/run/emulab-watchdog.pid ]; then
kill `cat /var/run/emulab-watchdog.pid` && echo -n ' Emulab'
fi
if [ -f /var/run/webserver.pid ]; then
kill `cat /var/run/webserver.pid` && echo -n ' Webserver'
fi
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
......
......@@ -19,8 +19,10 @@ if ($OSTYPE == "FreeBSD") then
ln -s liblocsetup-freebsd.pm liblocsetup.pm
rm -f /usr/local/etc/rc.d/testbed.sh
rm -f /usr/local/etc/rc.d/emulab.sh
rm -f /usr/local/etc/rc.d/Z.emulab.sh
cp -f rc.testbed /usr/local/etc/rc.d/Z.emulab.sh
rm -f /usr/local/etc/rc.d/z.emulab.sh
cp -f rc.testbed /usr/local/etc/rc.d/z.emulab.sh
rm -f /usr/local/etc/rc.d/0.cvsup.sh
cp -f cvsup.sh /usr/local/etc/rc.d/0.cvsup.sh
else
ln -s liblocsetup-linux.pm liblocsetup.pm
rm -f /etc/init.d/emulab
......@@ -32,7 +34,6 @@ else
rm -f /etc/rc5.d/S99emulab
ln -s ../init.d/emulab /etc/rc5.d/S99emulab
endif
cp /dev/null isrem
chown emulabman . *
chgrp bin . *
chown root update vnodesetup
......@@ -41,12 +42,13 @@ chown root /usr/bin/suidperl
chmod u+s /usr/bin/suidperl
chown emulabman client.pem emulab.pem
chmod 640 client.pem emulab.pem
/usr/bin/install -c -o root -g wheel -d -m 755 -o root -g 0 /var/emulab
/usr/bin/install -c -o root -g wheel -d -m 755 /var/emulab
/usr/bin/install -c -o root -g wheel -d -m 755 /var/emulab/sup
if ( -e vtund ) then
cp vtund /usr/local/sbin
/usr/bin/install -c -o root -g wheel -d -m 755 -o root -g 0 /var/log/vtund
/usr/bin/install -c -o root -g wheel -d -m 755 -o root -g 0 /var/lock/vtund
/usr/bin/install -c -o root -g wheel -d -m 755 /var/log/vtund
/usr/bin/install -c -o root -g wheel -d -m 755 /var/lock/vtund
endif
if (! -d ~emulabman/.ssh) then
......
......@@ -13,7 +13,7 @@ package liblocsetup;
use Exporter;
@ISA = "Exporter";
@EXPORT =
qw ( $CP $EGREP
qw ( $CP $EGREP $SFSSD $SFSCD
os_groupadd os_useradd os_userdel os_usermod os_mkdir
os_groupdel os_cleanup_node os_homedirdel
os_routing_enable_forward os_routing_enable_gated
......@@ -34,6 +34,8 @@ libsetup::libsetup_init($SETUPDIR);
#
$CP = "/bin/cp";
$EGREP = "/usr/bin/egrep -s -q";
$SFSSD = "/usr/local/sbin/sfssd";
$SFSCD = "/usr/local/sbin/sfscd";
#
# These are not exported
......@@ -98,7 +100,7 @@ sub os_usermod($$$$$)
$glist = "-G $glist";
}
if (system("$CHPASS $pswd $login") != 0) {
if (system("$CHPASS '$pswd' $login") != 0) {
warn "*** WARNING: $CHPASS $login error.\n";
return -1;
}
......@@ -135,7 +137,7 @@ sub os_useradd($$$$$$$$)
return -1;
}
if (system("$CHPASS $pswd $login") != 0) {
if (system("$CHPASS '$pswd' $login") != 0) {
warn "*** WARNING: $CHPASS $login error.\n";
return -1;
}
......
......@@ -12,7 +12,7 @@ package liblocsetup;
use Exporter;
@ISA = "Exporter";
@EXPORT =
qw ( $CP $EGREP
qw ( $CP $EGREP $SFSSD $SFSCD
os_groupadd os_useradd os_userdel os_usermod os_mkdir
os_groupdel os_cleanup_node os_homedirdel
os_routing_enable_forward os_routing_enable_gated
......@@ -33,6 +33,8 @@ libsetup::libsetup_init($SETUPDIR);
#
$CP = "/bin/cp";
$EGREP = "/bin/egrep -q";
$SFSSD = "/usr/local/sbin/sfssd";
$SFSCD = "/usr/local/sbin/sfscd";
#
# These are not exported
......@@ -98,7 +100,7 @@ sub os_usermod($$$$$)
$glist = "-G $glist";
}
return system("$USERMOD -g $gid $glist -p $pswd $login");
return system("$USERMOD -g $gid $glist -p '$pswd' $login");
}
......@@ -126,7 +128,7 @@ sub os_useradd($$$$$$$$)
$glist = "-G $glist";
}
if (system("$USERADD -M -u $uid -g $gid $glist -p $pswd ".
if (system("$USERADD -M -u $uid -g $gid $glist -p '$pswd' ".
"-d $homedir -s /bin/tcsh -c \"$gcos\" $login") != 0) {
warn "*** WARNING: $USERADD $login error.\n";
return -1;
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
DIR=/usr/local/etc/emulab
LOG=/var/tmp/cvsup.log
CVSUP=/usr/local/bin/cvsup
SERVER=cvsup.emulab.net
# So that it finds the auth file!
export HOME=$DIR
exec >>${LOG} 2>&1
if [ -f $DIR/supfile -a -x $CVSUP ]; then
echo -n "Checking for file updates at "
date
set -- `$DIR/tmcc bossinfo`
$CVSUP -h $1 -e -1 -g -L 1 -a $DIR/supfile
fi
exit 0;
#
# Make sure this matches the server!
#
RON host=boss.emulab.net base=/var/emulab prefix=/ preserve delete release=current
#
# Make sure this matches the server!
#
WIDE host=boss.emulab.net base=/var/emulab prefix=/ preserve delete release=current
......@@ -43,8 +43,8 @@ use lib "/usr/local/etc/emulab";
use libsetup;
# Locals
my $timeout = (60 * 60); # In seconds of course.
my $logname = "/tmp/emulab-watchdog.debug";
my $timeout = (60 * 60 * 12); # In seconds of course.
my $logname = "/var/tmp/emulab-watchdog.debug";
my $vndir = "/var/emulab";
my $pidfile = "/var/run/emulab-watchdog.pid";
my $noboot = 0;
......@@ -217,6 +217,12 @@ while (1) {
#
print "Looking for new Emulab accounts ...\n";
system("update -i");
#
# Do a cvsup to get updated software.
#
print "Looking for software updates ... \n";
system("runcvsup.sh");
}
#
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use Getopt::Std;
use English;
use HTTP::Daemon;
use HTTP::Status;
use URI::http;
#
# Trivial web server that redirects everthing back to emulab.
#
sub usage()
{
die("Usage: webserver.pl\n");
}
my $logname = "/var/tmp/webserver.log";
my $pidfile = "/var/run/webserver.pid";
my $webpage = "http://www.emulab.net/widearea_redirect.php";
my $IP;
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/usr/local/etc/emulab';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Turn off line buffering on output
#
$| = 1;
my $webserver = HTTP::Daemon->new(LocalPort => 'http(80)',
Reuse => 1)
|| die("*** $0:\n".
" Could not create a new daemon object!\n");
#
# Put ourselves into the background, directing output to the log file.
#
my $mypid = fork();
if ($mypid) {
exit(0);
}
#
# Write our pid into the pid file so we can be killed.
#
open(PFILE, "> $pidfile")
or die("Could not open $pidfile: $!");
print PFILE "$PID\n";
close(PFILE);
#
# We have to disconnect from the caller by redirecting STDIN and STDOUT.
#
open(STDIN, "< /dev/null") or die("opening /dev/null for STDIN: $!");
open(STDERR, "> $logname") or die("opening $logname for STDERR: $!");
open(STDOUT, ">> $logname") or die("opening $logname for STDOUT: $!");
#
# We would like our IP address to pass along.
#
my $hostname = `hostname`;
if (defined($hostname)) {
# Untaint and strip newline.
if ($hostname =~ /^([-\w\.]+)$/) {
$hostname = $1;
my (undef,undef,undef,undef,@ipaddrs) = gethostbyname($hostname);
$IP = inet_ntoa($ipaddrs[0]);
$webpage .= "?IP=$IP";
}
}
#
# Flip to user nobody after binding to port 80 (a reserved port).
#
my (undef,undef,$unix_uid) = getpwnam("nobody") or
die("No such user nobody\n");
my (undef,undef,$unix_gid) = getgrnam("nobody") or
die("No such group nobody\n");
$EGID = $GID = $unix_gid;
$EUID = $UID = $unix_uid;
#
# Loop, always returning a redirect no matter what the request.
#
while (my $c = $webserver->accept) {
while (my $r = $c->get_request) {
#
# We do not actually care what the request is. Just send
# back a redirect.
#
$c->send_redirect($webpage);
}
$c->close;
undef($c);
}
exit 0;
......@@ -97,7 +97,7 @@ main(int argc, char **argv)
int useudp = 0;
#endif
while ((ch = getopt(argc, argv, "v:s:p:un:t:")) != -1)
while ((ch = getopt(argc, argv, "v:s:p:un:t:k:")) != -1)
switch(ch) {
case 'p':
portlist[0] = atoi(optarg);
......