Skip to content

Commit

Permalink
edb debug: Persist credentials unsealed before initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockSquirrel committed Nov 5, 2024
1 parent fd0a45e commit c2bab24
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions go/enclave/storage/init/edgelessdb/edgelessdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const (
// - verbose logging on EDB
// - write the edb.pem file out for connecting to Edgeless DB services manually
// - versions of files created with a '.unsealed' suffix that can be used to connect to the database using mysql-client
debugMode = false
debugMode = true // DO NOT MERGEz

initFile = "001_init.sql"

Expand Down Expand Up @@ -258,12 +258,8 @@ func performHandshake(enclaveConfig enclaveconfig.EnclaveConfig, edbCfg *Config,
if err != nil {
return nil, fmt.Errorf("failed to marshal manifest to json - %w", err)
}
logger.Info("Initialise edgelessdb with script", "script", string(manifestJSON))
err = initialiseEdgelessDB(edbCfg.Host, manifest, edbHTTPClient, logger)
if err != nil {
return nil, err
}

// persist the credentials before we initialise the edgeless DB
edbCreds := &Credentials{
EDBCACertPEM: edbPEM,
CACertPEM: caCertPEM,
Expand All @@ -289,6 +285,12 @@ func performHandshake(enclaveConfig enclaveconfig.EnclaveConfig, edbCfg *Config,
_ = unsealedFile.Close()
}

logger.Info("Initialise edgelessdb with script", "script", string(manifestJSON))
err = initialiseEdgelessDB(edbCfg.Host, manifest, edbHTTPClient, logger)
if err != nil {
return nil, err
}

return edbCreds, nil
}

Expand Down

0 comments on commit c2bab24

Please sign in to comment.