Commit c3b1e225 authored by Leigh B Stoller's avatar Leigh B Stoller

Add option -c to run in Utah, which need some extra work cause of the

ClearingHouse certificate.
parent 0bf47b73
...@@ -13,10 +13,11 @@ use Getopt::Std; ...@@ -13,10 +13,11 @@ use Getopt::Std;
# #
sub usage() sub usage()
{ {
print STDERR "Usage: $0\n"; print STDERR "Usage: $0 [-c]\n";
exit(-1); exit(-1);
} }
my $optlist = ""; my $optlist = "c";
my $asch = 0;
# Configure ... # Configure ...
my $TB = "@prefix@"; my $TB = "@prefix@";
...@@ -52,6 +53,9 @@ my %options = (); ...@@ -52,6 +53,9 @@ my %options = ();
if (! getopts($optlist, \%options)) { if (! getopts($optlist, \%options)) {
usage(); usage();
} }
if (defined($options{"c"})) {
$asch = 1;
}
usage() usage()
if (@ARGV); if (@ARGV);
...@@ -61,15 +65,17 @@ system("/bin/mkdir $stash") == 0 or ...@@ -61,15 +65,17 @@ system("/bin/mkdir $stash") == 0 or
fatal("Could not mkdir $stash"); fatal("Could not mkdir $stash");
print "Copying current certificates to backup directory\n"; print "Copying current certificates to backup directory\n";
system("/bin/cp -p $CMCERT $SACERT $stash"); system("/bin/cp -p $CMCERT $SACERT $CHCERT $stash");
system("/bin/cp -p $SESCERT $stash") if (-e $SESCERT); system("/bin/cp -p $SESCERT $stash") if (-e $SESCERT);
# if (!$asch) {
# Grab the CH certificate from Utah. #
# # Grab the CH certificate from Utah.
print "Fetching clearinghouse certificate from Utah ...\n"; #
system("$FETCH -q -o $CHCERT http://boss.emulab.net/genich.pem") == 0 print "Fetching clearinghouse certificate from Utah ...\n";
or fatal("Could not fetch clearinghouse certificate from Utah"); system("$FETCH -q -o $CHCERT http://boss.emulab.net/genich.pem") == 0
or fatal("Could not fetch clearinghouse certificate from Utah");
}
# #
# Update our local certs. Certs are updated in place, old one saved. # Update our local certs. Certs are updated in place, old one saved.
...@@ -86,6 +92,15 @@ print "Updating $SACERT\n"; ...@@ -86,6 +92,15 @@ print "Updating $SACERT\n";
system("$UPDATECERT $SACERT") == 0 or system("$UPDATECERT $SACERT") == 0 or
fatal("Could not update $SACERT"); fatal("Could not update $SACERT");
if ($asch) {
print "Updating $CHCERT\n";
system("$UPDATECERT $CHCERT") == 0 or
fatal("Could not update $CHCERT");
system("$ADDAUTHORITY -c $CHCERT ma") == 0
or fatal("Could not add CH certificate to CH DB");
}
# #
# Add certs to the local SA database. # Add certs to the local SA database.
# #
...@@ -107,13 +122,13 @@ system("$ADDAUTHORITY -a $CMCERT cm") == 0 ...@@ -107,13 +122,13 @@ system("$ADDAUTHORITY -a $CMCERT cm") == 0
or fatal("Could not add CM certificate to CM DB"); or fatal("Could not add CM certificate to CM DB");
# #
# ReRegister our certs at the CM. # ReRegister our certs at the CH.
# #
system("$REREGISTER") == 0 system("$REREGISTER") == 0
or fatal("Could not reregister certificates at the Clearinghouse"); or fatal("Could not reregister certificates at the Clearinghouse");
# #
# ReRegister our resources. # ReRegister our resources at the CH.
# #
print "Registering resources at Clearinghouse\n"; print "Registering resources at Clearinghouse\n";
system("$SUDO -u $PROTOUSER $REGRESOURCES -r") == 0 system("$SUDO -u $PROTOUSER $REGRESOURCES -r") == 0
......
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