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

Convert the PROTOGENI_PASSWORD to an encryption hash.

parent 203cc28b
......@@ -3042,7 +3042,13 @@ sub CreateDefsFile($)
}
my $protogeni_password = "";
if (defined($emulabconfig{"PROTOGENI_PASSWORD"})) {
$protogeni_gmocpswd = lc($emulabconfig{"PROTOGENI_PASSWORD"});
#
# Convert to an encrypted hash.
#
my @salt_chars = ('a'..'z','A'..'Z','0'..'9');
my $salt = $salt_chars[rand(@salt_chars)] .
$salt_chars[rand(@salt_chars)];
$protogeni_password = crypt($PROTOGENI_PASSWORD, "\$1\$${salt}");
}
print OUTDEFS "PROTOGENI_SUPPORT=1\n";
print OUTDEFS "PROTOGENI_GENIRACK=$config_genirack\n";
......
......@@ -267,6 +267,7 @@ $APACHE_KEYFILE_OPS = "$APACHE_ETCDIR/ssl.key/${USERNODE}.key";
$PROTOGENI_RPCNAME = "@PROTOGENI_RPCNAME@";
$PROTOGENI_RPCPORT = "@PROTOGENI_RPCPORT@";
$PROTOGENI_EMAIL = "@PROTOGENI_EMAIL@";
$PROTOGENI_PASSWORD = "@PROTOGENI_PASSWORD@";
$DHCPD_CONF = "/usr/local/etc/dhcpd.conf";
$DHCPD_TEMPLATE = "/usr/local/etc/dhcpd.conf.template";
......
......@@ -363,13 +363,13 @@ Phase "geniuser", "Creating user $geniuserid", sub {
$geniuser = User->Lookup($geniuserid);
PhaseFail("$geniuserid did not create properly")
if (!defined($geniuser));
#
# This comes in as an encrypted hash.
#
if ($PROTOGENI_PASSWORD ne "") {
my @salt_chars = ('a'..'z','A'..'Z','0'..'9');
my $salt = $salt_chars[rand(@salt_chars)] .
$salt_chars[rand(@salt_chars)];
my $encpass = crypt($PROTOGENI_PASSWORD, "\$1\$${salt}");
$geniuser->SetPassword($encpass, "date_add(now(), interval 10 year)");
$geniuser->SetPassword($PROTOGENI_PASSWORD,
"date_add(now(), interval 10 year)");
}
ExecQuietFatal("$SUDO -u $PROTOUSER $WAP $TBACCT verify $geniuserid");
};
......
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