Commit 1f6ba160 authored by Mike Hibler's avatar Mike Hibler

Differentiate SECUREBOOT and SECURELOAD.

parent 4d23690e
......@@ -140,8 +140,8 @@ my $TB_OSID_MBKERNEL = TB_OSID_MBKERNEL;
# Special PXEBOOT state machine that all local nodes use.
my $PXEKERNEL = "PXEKERNEL";
# Even special-er SECURELOAD state machine that local nodes may use.
my $SECURELOAD = "SECURELOAD";
# Even special-er SECUREBOOT state machine that local nodes may use.
my $SECUREBOOT = "SECUREBOOT";
# Protos.
sub debug(@);
......@@ -628,14 +628,23 @@ sub stateTransition($$) {
!$valid{$mode}{$oldstate}{$newstate}) {
notify("Invalid transition for node $node from $mode/$oldstate " .
"to $newstate\n");
# XXX: Bad hack for TPM booting paper: this ought to be in the
# database, not harcoded here for a specific op_mode
# Let specifc op_modes drive nodes into particular states on invalid
# transitions
if ($mode eq TBDB_NODEOPMODE_SECURELOAD) {
#
# Machines in the secure boot path are not allowed to jump
# willy-nilly into unknown states.
#
if ($mode eq TBDB_NODEOPMODE_SECUREBOOT ||
$mode eq TBDB_NODEOPMODE_SECURELOAD) {
$newstate = TBDB_NODESTATE_SECVIOLATION;
notify("Moving $node to $newstate because it's in $mode\n");
}
#
# And nodes that are in the SECVIOLATION state already are
# not allowed to leave!
#
elsif ($oldstate eq TBDB_NODESTATE_SECVIOLATION) {
$newstate = TBDB_NODESTATE_SECVIOLATION;
notify("$node tried to leave SECVIOLATION (to $newstate)\n");
}
}
my $now = time();
......@@ -729,16 +738,29 @@ sub stateTransition($$) {
}
next;
};
/^SECURELOAD$/ && do {
/^$SECUREBOOT$/ && do {
#
# Force machine into the SECUREBOOT/LOAD op_mode.
# Currently triggered by receipt of GPXEBOOTING state.
# This could come from any state as it just indicates that
# a machine with a gPXE dongle has rebooted.
#
# Force machine into the SECURELOAD op_mode.
# Currently triggered only by receipt of GPXEBOOTING state.
# To differentiate BOOT from LOAD we check next_op_mode.
# It will be set to SECURELOAD when we need to go there,
# otherwise we force it to SECUREBOOT.
#
debug("Running $SECURELOAD trigger\n");
if ($mode ne $SECURELOAD) {
info("$node: Forcing mode transition into $SECURELOAD!\n");
opModeTransition($node, $SECURELOAD, 1);
$mode=$SECURELOAD;
debug("Running $SECUREBOOT trigger\n");
my $query_result =
DBQueryWarn("select next_op_mode from nodes ".
"where node_id='$node'");
my ($nextmode) = $query_result->fetchrow();
if (!$nextmode || $nextmode ne TBDB_NODEOPMODE_SECURELOAD) {
$nextmode = TBDB_NODEOPMODE_SECUREBOOT;
}
if ($mode ne $nextmode) {
info("$node: Forcing mode transition to $nextmode!\n");
opModeTransition($node, $nextmode, 1);
$mode=$nextmode;
}
next;
};
......@@ -843,12 +865,8 @@ sub stateTransition($$) {
objname => $node);
next;
};
(/^$TBPOWERCYCLE$/) && do {
handleCommand($node,$TBPOWERCYCLE);
next;
};
(/^$TBPOWEROFF$/) && do {
handleCommand($node,$TBPOWEROFF);
(/^$TBPOWERCYCLE$/ || /^$TBPOWEROFF$/) && do {
handleCommand($node,$trig);
next;
};
(/^EMAILNOTIFY$/) && do {
......
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