Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/registry: Require SGX for non-test compute runtimes using km #3159

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changelog/3159.breaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go/registry: Require SGX for non-test compute runtimes using a key manager

Note: Existing deployments might need to alter the state dump to fix any
existing compute runtimes that registered without SGX hardware and have
keymanager runtime configured.
6 changes: 6 additions & 0 deletions go/genesis/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ func TestGenesisSanityCheck(t *testing.T) {
AdmissionPolicy: registry.RuntimeAdmissionPolicy{
AnyNode: &registry.AnyNodeRuntimeAdmissionPolicy{},
},
TEEHardware: node.TEEHardwareIntelSGX,
Version: registry.VersionInfo{
TEE: cbor.Marshal(registry.VersionInfoIntelSGX{
Enclaves: []sgx.EnclaveIdentity{{}},
}),
},
}
signedTestRuntime := signRuntimeOrDie(signer, testRuntime)

Expand Down
9 changes: 9 additions & 0 deletions go/registry/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,15 @@ func VerifyRegisterComputeRuntimeArgs(ctx context.Context, logger *logging.Logge
)
return ErrInvalidArgument
}

// Currently the keymanager implementation assumes SGX. Unless this is a
// test runtime, using a keymanager without using SGX is unsupported.
if !rt.ID.IsTest() && rt.TEEHardware != node.TEEHardwareIntelSGX {
logger.Error("RegisterRuntime: runtime without SGX using key manager",
"id", rt.ID,
)
return fmt.Errorf("%w: compute runtime without SGX using key manager", ErrInvalidArgument)
}
}

return nil
Expand Down
30 changes: 29 additions & 1 deletion go/registry/tests/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,35 @@ func testRegistryRuntime(t *testing.T, backend api.Backend, consensus consensusA
true,
true,
},
// Runtime with key manager set.
// Runtime with key manager set, without SGX.
{
"NoSGXWithKM",
func(rt *api.Runtime) {
rt.KeyManager = &rtMapByName["KeyManager"].ID
// Set non-test runtime.
rt.ID = newNamespaceFromSeed([]byte("NoSGXWithKM"), 0)
},
false,
false,
},
// SGX Runtime with key manager set.
{
"SGXWithKM",
func(rt *api.Runtime) {
rt.KeyManager = &rtMapByName["KeyManager"].ID
rt.TEEHardware = node.TEEHardwareIntelSGX

vi := api.VersionInfoIntelSGX{
Enclaves: []sgx.EnclaveIdentity{{}},
}
rt.Version.TEE = cbor.Marshal(vi)
// Set non-test runtime.
rt.ID = newNamespaceFromSeed([]byte("SGXWithKM"), 0)
},
false,
true,
},
// Test Runtime with key manager set.
{
"WithKM",
func(rt *api.Runtime) {
Expand Down