Commit be69c6e4 authored by Leigh Stoller's avatar Leigh Stoller

Two main changes:

* Add mailman to the install process. This includes the package
  install, all the setup needed in ops-install, and the little patches
  we apply locally.

  Note: Only under 6.0: no point in going backwards since its a pain
  in the ass to build these packages for the 4.10 image.

* Push more of the package install back down into the ops/boss install
  scripts. This improves testing within those scripts, and avoids
  duplication. There are some changes in rc.mkelab that will temp
  mount the package dir on /packages for the benefit of the scripts.
parent a78f4e66
......@@ -33,7 +33,7 @@ THISHOMEBASE=changeme
PLABSUPPORT=0
WIKISUPPORT=0
BUGDBSUPPORT=0
MAILMANSUPPORT=0
MAILMANSUPPORT=changeme
WINSUPPORT=0
SFSSUPPORT=0
CVSSUPPORT=0
......
......@@ -26,7 +26,7 @@ my $TOP_SRCDIR = '@top_srcdir@';
my $DBNAME = "@TBDBNAME@";
my $ELABINELAB = @ELABINELAB@;
my $WINSUPPORT = @WINSUPPORT@;
my $MAILMANSUPPORT = @MAILMANSUPPORT@;
my $OURDOMAIN = '@OURDOMAIN@';
my $LOGFACIL = '@TBLOGFACIL@';
......@@ -354,22 +354,22 @@ Phase "tftp", "Setting up directories for tftp", sub {
};
Phase "ports", "Installing ports", sub {
if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT") &&
(($FBSD_VERSION == 4) || !ExecQuiet("$PKG_INFO -e $PHP4_PORT"))) {
PhaseSkip("Ports already installed");
}
Phase "packages", "Installing packages", sub {
if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT") &&
(($FBSD_VERSION == 4) || !ExecQuiet("$PKG_INFO -e $PHP4_PORT"))) {
PhaseSkip("Ports already installed");
}
if (!$packagedir) {
PhaseSkip("No package directory provided");
}
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $BOSS_PORT")
if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT"));
if (ExecQuiet("$PKG_INFO -e $BOSS_PORT"));
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $PHP4_PORT")
if ($FBSD_VERSION > 4 && !ExecQuiet("$PKG_INFO -e $PHP4_PORT"));
if ($FBSD_VERSION > 4 && ExecQuiet("$PKG_INFO -e $PHP4_PORT"));
};
if ($packagedir) {
PhaseSkip("Packages installed okay");
}
PhaseSkip("Package directory provided; not installing from source")
if ($packagedir);
Phase "pcopy", "Copying ports into place", sub {
DoneIfExists("$PORTSMISCDIR/emulab-boss");
ExecQuietFatal("$SH $SRCDIR/ports/ports-install");
......@@ -397,10 +397,10 @@ Phase "portfixup", "Fixing up packages", sub {
PhaseSkip("rsync already installed");
}
PhaseFail("Must have a PKG_PATH variable set in your environment")
if (!exists($ENV{"PKG_PATH"}));
ExecQuietFatal("$PKG_ADD rsync-2.6.3_1");
PhaseFail("Must provide -p (packagedir) argument!")
if (!$packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD rsync-2.6.3_1");
};
if ($WINSUPPORT) {
Phase "gcc30", "Looking for GCC 3.0 and installing", sub {
......@@ -409,10 +409,10 @@ Phase "portfixup", "Fixing up packages", sub {
PhaseSkip("GCC 3.0 already installed");
}
PhaseFail("Must have a PKG_PATH variable set in your environment")
if (!exists($ENV{"PKG_PATH"}));
ExecQuietFatal("$PKG_ADD gcc30-3.0.4_1");
PhaseFail("Must provide -p (packagedir) argument!")
if (!$packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD gcc30-3.0.4_1");
};
}
};
......@@ -959,6 +959,16 @@ Phase "sslcerts", "Setting up SSL certificates", sub {
}
};
if ($MAILMANSUPPORT) {
my $secret = substr(GenSecretKey(), 0, 10);
Phase "Mailman", "Setting up Mailman admin Password", sub {
ExecQuietFatal("echo \"update sitevariables set value='$secret' ".
" where name='general/mailman/password'\" | ".
"$MYSQL $DBNAME");
};
}
Phase "event", "Setting up event system", sub {
Phase "elvinconf", "Installing elvind config file", sub {
DoneIfIdentical($ELVIND_CONF,$BOSS_ELVIND_CONF);
......
......@@ -483,4 +483,14 @@ sub PrintLastOutput() {
print "--------------------------------------------------------------\n";
}
#
# Get me a secret
#
sub GenSecretKey()
{
my $key=`/bin/dd if=/dev/urandom count=128 bs=1 2> /dev/null | /sbin/md5`;
chomp($key);
return $key;
}
1;
......@@ -36,6 +36,7 @@ my $FSNODE_IP = '@FSNODE_IP@';
my $LOGFACIL = '@TBLOGFACIL@';
my $ELABINELAB = @ELABINELAB@;
my $WINSUPPORT = @WINSUPPORT@;
my $MAILMANSUPPORT = @MAILMANSUPPORT@;
my $QUOTA_FSLIST= '@FS_WITH_QUOTAS@';
my $LOGDIR = "$PREFIX/log";
my $ETCDIR = "$PREFIX/etc";
......@@ -148,6 +149,7 @@ my $RCLOCAL = "/etc/rc.local";
my $RCCAPTURE = "$PREFIX/etc/rc.capture";
my $LOCAL_HOSTNAMES = "/etc/mail/local-host-names";
my $ALIASES_FILE = "/etc/mail/aliases";
my $SENDMAIL_CF = "/etc/mail/sendmail.cf";
my $EXPORTS_FILE = "/etc/exports";
my $EXPORTS_HEAD = "$EXPORTS_FILE.head";
my $SYSLOG_CONF = "/etc/syslog.conf";
......@@ -202,6 +204,7 @@ my @MOUNTPOINTS = ("/users", "/proj", "/groups", "/share");
my $ELVIND_CONF = "/usr/local/etc/elvind.conf";
my $OPS_ELVIND_CONF = "$TOP_OBJDIR/event/etc/elvind-ops.conf";
my $M2CRYPTO_PATCH = "$TOP_SRCDIR/patches/m2crypto.patch";
my $MAILMAN_PATCH = "$TOP_SRCDIR/patches/mailman.patch";
my $IDENTPUB = "$TOP_SRCDIR/install/identity.pub";
#
......@@ -288,9 +291,9 @@ Phase "ports", "Installing ports", sub {
PhaseSkip("No package directory provided");
}
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $OPS_PORT")
if (!ExecQuiet("$PKG_INFO -e $OPS_PORT"));
if (ExecQuiet("$PKG_INFO -e $OPS_PORT"));
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $PHP4_PORT")
if ($FBSD_VERSION > 4 && !ExecQuiet("$PKG_INFO -e $PHP4_PORT"));
if ($FBSD_VERSION > 4 && ExecQuiet("$PKG_INFO -e $PHP4_PORT"));
};
Phase "fs-packages", "Installing FS packages", sub {
if (!$ISFS) {
......@@ -304,10 +307,27 @@ Phase "ports", "Installing ports", sub {
}
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $FS_PORT");
};
if ($MAILMANSUPPORT) {
Phase "mailman", "Installing Mailman package", sub {
if (!ExecQuiet("$PKG_INFO -x -e mailman")) {
PhaseSkip("Mailman package already installed");
}
if (!$packagedir) {
PhaseSkip("No package directory provided");
}
# Lets not hardwire the package name; whatever it is will do.
my $pname = `ls $packagedir/mailman-*.tbz`;
PhaseFail("Cannot find mailman package in $packagedir!")
if ($?);
chomp($pname);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $pname");
};
}
PhaseSkip("Package directory provided; not installing from source")
if ($packagedir);
Phase "pcopy", "Copying ports into place", sub {
if ($packagedir) {
PhaseSkip("Package directory provided");
}
DoneIfExists("$PORTSMISCDIR/emulab-ops");
ExecQuietFatal("$SH $SRCDIR/ports/ports-install");
};
......@@ -317,9 +337,6 @@ Phase "ports", "Installing ports", sub {
if (!ExecQuiet("$PKG_INFO -e $OPS_PORT")) {
PhaseSkip("Ports already installed");
}
if ($packagedir) {
PhaseSkip("Package directory provided");
}
#
# This port is dead-simple, so it's safe to do it from this script
......@@ -335,14 +352,29 @@ Phase "ports", "Installing ports", sub {
if (!ExecQuiet("$PKG_INFO -e $FS_PORT")) {
PhaseSkip("Ports already installed");
}
if ($packagedir) {
PhaseSkip("Package directory provided");
}
chdir "$PORTSMISCDIR/emulab-fs" or
PhaseFail "Unable to change to $PORTSMISCDIR/emulab-fs: $!";
ExecQuietFatal("make -DBATCH install");
};
Phase "php4-pinstall", "Installing PHP4 ports (may take a while)", sub {
if (!ExecQuiet("$PKG_INFO -e $PHP4_PORT")) {
PhaseSkip("Ports already installed");
}
chdir "$PORTSMISCDIR/emulab-php4" or
PhaseFail "Unable to change to $PORTSMISCDIR/emulab-php4: $!";
ExecQuietFatal("make -DBATCH install");
};
if ($MAILMANSUPPORT) {
Phase "mailman-pinstall", "Installing mailman ports", sub {
if (!ExecQuiet("$PKG_INFO -x -e mailman")) {
PhaseSkip("Ports already installed");
}
chdir "$PORTSMISCDIR/emulab-mailman" or
PhaseFail("Unable to change to ".
"$PORTSMISCDIR/emulab-mailman: $!");
ExecQuietFatal("make -DBATCH install");
};
}
chdir $pwd;
};
......@@ -353,10 +385,10 @@ Phase "portfixup", "Fixing up packages", sub {
PhaseSkip("rsync already installed");
}
PhaseFail("Must have PKG_PATH environment variable set")
if (!exists($ENV{"PKG_PATH"}));
ExecQuietFatal("$PKG_ADD rsync-2.6.3_1");
PhaseFail("Must provide -p (packagedir) argument!")
if (!$packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD rsync-2.6.3_1");
};
if ($WINSUPPORT) {
Phase "samba", "Looking for Samba and installing", sub {
......@@ -367,10 +399,10 @@ Phase "portfixup", "Fixing up packages", sub {
PhaseSkip("samba already installed");
}
PhaseFail("Must have PKG_PATH environment variable set")
if (!exists($ENV{"PKG_PATH"}));
ExecQuietFatal("$PKG_ADD samba-3.0.7,1");
PhaseFail("Must provide -p (packagedir) argument!")
if (!$packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD samba-3.0.7,1");
};
Phase "gcc30", "Looking for GCC 3.0 and installing", sub {
if ($FBSD_VERSION > 4 ||
......@@ -378,10 +410,10 @@ Phase "portfixup", "Fixing up packages", sub {
PhaseSkip("GCC 3.0 already installed");
}
PhaseFail("Must have PKG_PATH environment variable set")
if (!exists($ENV{"PKG_PATH"}));
ExecQuietFatal("$PKG_ADD gcc30-3.0.4_1");
PhaseFail("Must provide -p (packagedir) argument!")
if (!$packagedir);
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD gcc30-3.0.4_1");
};
}
};
......@@ -398,6 +430,16 @@ Phase "patches", "Applying patches", sub {
}
ExecQuietFatal("$PATCH -f -l -p0 -i $patchfile");
};
if ($MAILMANSUPPORT) {
Phase "mailmanpatch", "Patching mailman", sub {
my $patchfile = $MAILMAN_PATCH;
if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $patchfile")) {
PhaseSkip("$patchfile already applied");
}
ExecQuietFatal("$PATCH -f -l -p0 -i $patchfile");
};
}
};
Phase "rc.conf", "Adding testbed content to rc.conf", sub {
......@@ -875,6 +917,92 @@ Phase "database", "Setting up database", sub {
};
};
if ($MAILMANSUPPORT) {
my $MAILMANDIR = "/usr/local/mailman";
my $MAILMANCFG = "$MAILMANDIR/Mailman/mm_cfg.py";
my $MAILMANLISTS = "$MAILMANDIR/lists";
my $MAILMANPWD = "$ETCDIR/mailman.pwd";
my $MAILMANALIAS = "/etc/mail/aliases.mailman";
my $TBOPSEMAIL = "@TBOPSEMAIL@";
Phase "Mailman", "Setting up Mailman", sub {
PhaseSkip("mailman not supported on ops")
if ($FBSD_VERSION == 4);
# Patch for broken install
ExecQuietFatal("$CHMOD 2770 $MAILMANDIR/archives/private");
# Get a password for the mailman installation.
Phase "password", "Generating mailman password", sub {
DoneIfExists($MAILMANPWD);
my $string = substr(GenSecretKey(), 0, 10);
PhaseFail("Invalid password supplied")
if (!defined($string) || $string eq "");
CreateFileFatal("$MAILMANPWD", "$string");
ExecQuietFatal("$CHMOD 750 $MAILMANPWD");
ExecQuietFatal("$CHGRP tbadmin $MAILMANPWD");
};
my $secret = `cat $MAILMANPWD`;
chomp($secret);
Phase "config", "Editing local config file", sub {
DoneIfEdited("$MAILMANCFG");
AppendToFileFatal($MAILMANCFG,
"DEFAULT_EMAIL_HOST = '${OURDOMAIN}'",
"DEFAULT_URL_HOST = '${USERNODE}'",
"add_virtualhost(DEFAULT_URL_HOST, ".
"DEFAULT_EMAIL_HOST)");
};
Phase "mailman", "Creating mailman list", sub {
PhaseSkip("List already created")
if (-d "$MAILMANLISTS/mailman");
ExecQuietFatal("cd $MAILMANDIR; ".
"bin/newlist -q mailman $TBOPSEMAIL $secret");
};
Phase "subscribe", "Subscribing testbed-ops", sub {
PhaseSkip("Already subscribed")
if (ExecQuiet("$MAILMANDIR/bin/list_members mailman | ".
"fgrep -q -s $TBOPSEMAIL") == 0);
ExecQuietFatal("cd $MAILMANDIR; ".
"echo $TBOPSEMAIL | ".
" bin/add_members -r - -w n -a n mailman");
};
# Can do this as many times as we like. No way to know.
ExecQuietFatal("cd $MAILMANDIR; ".
"bin/config_list -i data/sitelist.cfg mailman");
# Ditto
ExecQuietFatal("cd $MAILMANDIR; ".
"bin/mmsitepass $secret; ".
"bin/mmsitepass -c $secret");
Phase "config", "Editing $SENDMAIL_CF", sub {
PhaseSkip("Already edited")
if (ExecQuiet("fgrep AliasFile $SENDMAIL_CF | ".
"fgrep -q -s mailman") == 0);
ExecQuietFatal("sed -i .orig -e ".
" 's,\\(AliasFile.*\\),\\1\\,$MAILMANALIAS,' ".
"$SENDMAIL_CF");
};
Phase "aliases", "Creating $MAILMANALIAS", sub {
DoneIfExists($MAILMANALIAS);
CreateFileFatal($MAILMANALIAS);
};
Phase "newaliases", "Running newaliases", sub {
PhaseSkip("No new aliases") if PhaseWasSkipped("aliases");
ExecQuietFatal($NEWALIASES);
};
};
}
exit(0)
if ($ELABINELAB);
print "----------------------------------------------------------------------\n";
print "Installation completed succesfully!\n";
print "Please reboot this machine before proceeding with boss setup\n";
......
# New ports collection makefile for: emulab-mailman
# Date created: 23 February 2006
# Whom: stoller@flux.utah.edu
#
# We happen to run the web server as "nobody"
#
CGI_GID= nobody
#
# This prevents the option screen.
#
BATCH=yes
#
# But need this too!
#
.MAKEFLAGS+= -DBATCH CGI_GID=nobody
MASTERDIR= ${.CURDIR}/../../mail/mailman
.include "${MASTERDIR}/Makefile"
Meta-port to build mailman properly, but as a separate module for Emulab.
@comment This packing list left intentionally empty
......@@ -7,7 +7,7 @@
PORTSDIR=/usr/ports
PORTSUBDIR=misc
SRCDIR=`dirname $0`
PORTS="elvind emulab-boss emulab-fs emulab-ops libelvin emulab-tftp-hpa p5-GD-old ulsshxmlrpcpp emulab-iperf emulab-php4"
PORTS="elvind emulab-boss emulab-fs emulab-ops libelvin emulab-tftp-hpa p5-GD-old ulsshxmlrpcpp emulab-iperf emulab-php4 emulab-mailman"
for PORT in $PORTS
do
......
Index: /usr/local/mailman/Mailman/Cgi/options.py
===================================================================
--- options.py.save
+++ options.py
@@ -320,6 +320,13 @@
_('You are already using that email address'))
print doc.Format()
return
+ # Emulab hack.
+ listowner, domain_parts = Utils.ParseEmail(mlist.owner[0])
+ if listowner == "testbed-ops":
+ options_page(mlist, doc, user, cpuser, userlang,
+ _('You are not allowed to change your address'))
+ print doc.Format()
+ return
# If they're requesting to subscribe an address which is already a
# member, and they're /not/ doing it globally, then refuse.
# Otherwise, we'll agree to do it globally (with a warning
Index: /usr/local/mailman/Mailman/SecurityManager.py
===================================================================
--- SecurityManager.py.save
+++ SecurityManager.py
@@ -295,7 +295,7 @@
prefix = self.internal_name() + '+user+'
for k in c.keys():
if k.startswith(prefix):
- usernames.append(k[len(prefix):])
+ usernames.append(urllib.unquote(k[len(prefix):]))
# If any check out, we're golden. Note: `@'s are no longer legal
# values in cookie keys.
for user in [Utils.UnobscureEmail(u) for u in usernames]:
......@@ -93,6 +93,9 @@ my $hostname = `hostname`;
chomp($hostname);
my ($bossname, $outer_bossip) = tmccbossinfo();
# Outer FS node name. See below.
my $fsname;
# Cert stuff to give the inner emulab
my $RPCCERT = "/usr/testbed/etc/outer_emulab.pem";
#my $RPCPORT = 7778;
......@@ -263,6 +266,19 @@ sub doboot()
$emulabconfig{BOSS_PKG} = "emulab-boss-2.0";
}
# Figure out where /share is coming from (outer fs node). We need
# that below.
$fsname = `mount | grep /users | head -1`;
if ($?) {
fatal("Could not get mount information!");
}
if ($fsname =~ /^([-\w\.]+):/) {
$fsname = $1;
}
else {
fatal("Could not determine the name of the outer FS node!");
}
if ($emulabconfig{"ROLE"} eq "fs") {
SetupFsNode();
}
......@@ -720,21 +736,13 @@ sub SetupOpsNode($)
$ENV{"PKG_PATH"} = $emulabconfig{OPS_PKG_DIR};
mysystem("pkg_add $emulabconfig{OPS_PKG} >/tmp/perrs 2>&1");
if ($WINSUPPORT && $FBSD_VERSION == 4) {
mysystem("pkg_add gcc30-3.0.4_1 >/tmp/perrs.gcc 2>&1");
}
else {
mysystem("pkg_add $PHP4_PKG >>/tmp/perrs 2>&1");
}
if ($isfs) {
# XXX if not set, derive from the OPS info
if (!$emulabconfig{FS_PKG_DIR} || !$emulabconfig{FS_PKG}) {
$emulabconfig{FS_PKG_DIR} = $emulabconfig{OPS_PKG_DIR};
($emulabconfig{FS_PKG} = $emulabconfig{OPS_PKG}) =~ s/ops/fs/;
}
print "Installing the fs metaport.\n";
$ENV{"PKG_PATH"} = $emulabconfig{FS_PKG_DIR};
mysystem("pkg_add $emulabconfig{FS_PKG} >/tmp/fs-perrs 2>&1");
}
skippkg:
......@@ -765,6 +773,15 @@ sub SetupOpsNode($)
mysystem("mkdir /users /proj /groups /share");
}
#
# Lets mount the package dir so that we can pass off some stuff to
# the install scripts;
#
if (! -d "/packages") {
mysystem("mkdir /packages");
}
mysystem("mount ${fsname}:" . $emulabconfig{OPS_PKG_DIR} . " /packages");
#
# Need these for rc.conf.
#
......@@ -853,10 +870,11 @@ sub SetupOpsNode($)
#
# Create the ops node.
#
my $pkg = "-P $emulabconfig{OPS_PKG} " .
$ENV{"PKG_PATH"} = "/packages";
my $pkg = "-P $emulabconfig{OPS_PKG} -p /packages " .
($isfs ? "-F $emulabconfig{FS_PKG}" : "");
mysystem("cd ${TBDIR}/testbed/obj/testbed/install; ".
" perl ops-install $pkg -b -w ElabInElab");
" perl ops-install $pkg -b -w ElabInElab ");
#
# And install the ops side.
......@@ -1068,17 +1086,6 @@ sub SetupBossNode()
$ENV{"PKG_PATH"} = $emulabconfig{BOSS_PKG_DIR};
mysystem("pkg_add -f $emulabconfig{BOSS_PKG} >/tmp/perrs 2>&1");
if ($WINSUPPORT && $FBSD_VERSION == 4) {
mysystem("pkg_add gcc30-3.0.4_1 >/tmp/perrs.gcc 2>&1");
}
else {
mysystem("pkg_add $PHP4_PKG >>/tmp/perrs 2>&1");
}
#
# Extra stuff to fix up php package stuff. Ask Rob!
#
# mysystem("tar xzf ${TBDIR}/testbed/stuff/extras.tar.gz -C /");
skippkg:
#
......@@ -1086,7 +1093,16 @@ sub SetupBossNode()
# so we can mount new NFS filesystems in their proper places.
#
mysystem("umount -A -t nfs");
#
# Lets mount the package dir so that we can pass off some stuff to
# the install scripts.
#
if (! -d "/packages") {
mysystem("mkdir /packages");
}
mysystem("mount ${fsname}:" . $emulabconfig{BOSS_PKG_DIR} . " /packages");
#
# Need to create an /etc/rc.conf that is more suitable for boss.
# I took most of this from our real ops node. It will be modified
......@@ -1171,7 +1187,8 @@ sub SetupBossNode()
#
# Create the boss node. This will also install the software.
#
my $pkg = "-P $emulabconfig{BOSS_PKG}";
$ENV{"PKG_PATH"} = "/packages";
my $pkg = "-P $emulabconfig{BOSS_PKG} -p /packages";
mysystem("cd ${TBDIR}/testbed/obj/testbed/install; ".
" perl boss-install $pkg -b -w ElabInElab");
......@@ -1457,6 +1474,15 @@ sub CreateDefsFile($)
print OUTDEFS "FRISEBEEMCASTPORT=\"6000\"\n";
last SWITCH;
};
/^MAILMANSUPPORT$/ && do {
if ($FBSD_VERSION == 6) {
print OUTDEFS "MAILMANSUPPORT=1\n";
}
else {
print OUTDEFS "MAILMANSUPPORT=0\n";
}
last SWITCH;
};
print OUTDEFS $_;
}
......
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