Skip to content

Commit

Permalink
[keys] Cleanup keys/certs and consolidate keys with auditors (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
mssun committed Dec 12, 2019
1 parent b3978e8 commit 86898b6
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 42 deletions.
12 changes: 0 additions & 12 deletions .gitignore
@@ -1,26 +1,14 @@
**/ias_*
**/Cargo.lock **/Cargo.lock
**/target **/target
**/Enclave_u*
**/Enclave_t*
**/*.o **/*.o
**/*.pyc **/*.pyc
**/*.a **/*.a
**/*.so **/*.so
**/*.swp **/*.swp
**/.DS_Store **/.DS_Store
bin
out
cov.info cov.info
cov_report cov_report
# Makefile will help use to prepare a proper Cargo.toml and .cargo/config
/Cargo.toml
.cargo
/**/pkg_name /**/pkg_name
examples/**/*.log
*.sha256
/examples/image_resizing/logo.jpg
/cert/spid.txt
.vscode/* .vscode/*
# ignore the build dir which usually for cmake # ignore the build dir which usually for cmake
/build /build
Expand Down
12 changes: 0 additions & 12 deletions cert/client.crt

This file was deleted.

5 changes: 0 additions & 5 deletions cert/client.pkcs8

This file was deleted.

1 change: 0 additions & 1 deletion cert/mr_signer

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/scripts/prep.sh
Expand Up @@ -18,7 +18,7 @@ mkdir -p ${MESATEE_OUT_DIR} ${MESATEE_TARGET_DIR} ${MESATEE_SERVICE_INSTALL_DIR}
${MESATEE_EXAMPLE_INSTALL_DIR} ${MESATEE_BIN_INSTALL_DIR} ${MESATEE_LIB_INSTALL_DIR} \ ${MESATEE_EXAMPLE_INSTALL_DIR} ${MESATEE_BIN_INSTALL_DIR} ${MESATEE_LIB_INSTALL_DIR} \
${MESATEE_TEST_INSTALL_DIR} ${MESATEE_AUDITORS_DIR} ${MESATEE_EXAMPLE_AUDITORS_DIR} ${MESATEE_TEST_INSTALL_DIR} ${MESATEE_AUDITORS_DIR} ${MESATEE_EXAMPLE_AUDITORS_DIR}
# copy auditors to install directory to make it easy to package all built things # copy auditors to install directory to make it easy to package all built things
cp -RT ${CMAKE_SOURCE_DIR}/auditors/ ${MESATEE_AUDITORS_DIR}/ cp -RT ${CMAKE_SOURCE_DIR}/keys/auditors/ ${MESATEE_AUDITORS_DIR}/
cp ${CMAKE_SOURCE_DIR}/teaclave_config/runtime.config.toml ${MESATEE_SERVICE_INSTALL_DIR} cp ${CMAKE_SOURCE_DIR}/teaclave_config/runtime.config.toml ${MESATEE_SERVICE_INSTALL_DIR}
cp ${CMAKE_SOURCE_DIR}/teaclave_config/runtime.config.toml ${MESATEE_TEST_INSTALL_DIR} cp ${CMAKE_SOURCE_DIR}/teaclave_config/runtime.config.toml ${MESATEE_TEST_INSTALL_DIR}
# create the following symlinks to make remapped paths accessible and avoid repeated building # create the following symlinks to make remapped paths accessible and avoid repeated building
Expand Down
2 changes: 1 addition & 1 deletion cmake/scripts/sgx_link_sign.sh
Expand Up @@ -33,7 +33,7 @@ ${CMAKE_C_COMPILER} libEnclave_t.o -o \
-Wl,--defsym,__ImageBase=0 \ -Wl,--defsym,__ImageBase=0 \
-Wl,--gc-sections \ -Wl,--gc-sections \
-Wl,--version-script=${MESATEE_PROJECT_ROOT}/cmake/scripts/Enclave.lds -Wl,--version-script=${MESATEE_PROJECT_ROOT}/cmake/scripts/Enclave.lds
${SGX_ENCLAVE_SIGNER} sign -key ${MESATEE_PROJECT_ROOT}/cert/Enclave_private.pem \ ${SGX_ENCLAVE_SIGNER} sign -key ${MESATEE_PROJECT_ROOT}/keys/enclave_signing_key.pem \
-enclave ${CUR_MODULE_NAME}.enclave.so \ -enclave ${CUR_MODULE_NAME}.enclave.so \
-out ${CUR_INSTALL_DIR}/${CUR_MODULE_NAME}.enclave.signed.so \ -out ${CUR_INSTALL_DIR}/${CUR_MODULE_NAME}.enclave.signed.so \
-config ${MESATEE_PROJECT_ROOT}/${CUR_MODULE_PATH}/Enclave.config.xml \ -config ${MESATEE_PROJECT_ROOT}/${CUR_MODULE_PATH}/Enclave.config.xml \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions keys/sp_root_ca_key.pem
@@ -0,0 +1,8 @@
-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIYNTGhDVj0XKpNhlaHZhv8R8kZopjQg+3lLUiKWJpe2oAoGCCqGSM49
AwEHoUQDQgAEbVU0oGETuO9OYCGAPIyyN5i3RrFZqWBaBPBCFj8VsjoAMOagumK+
FxY7ULghfAjmAmvEERHmA2U0fcb6rHWU9A==
-----END EC PRIVATE KEY-----
10 changes: 5 additions & 5 deletions teaclave_config/build.config.toml
@@ -1,16 +1,16 @@
# Teaclave Build Config # Teaclave Build Config


# Service provider's root CA certificate to verify clients # Service provider's root CA certificate to verify clients
sp_root_ca_cert = { path = "../cert/ca.crt" } sp_root_ca_cert = { path = "../keys/sp_root_ca_cert.pem" }


# Intel Attestation Service root CA certificate to verify attestation report # Intel Attestation Service root CA certificate to verify attestation report
ias_root_ca_cert = { path = "../cert/AttestationReportSigningCACert.pem" } ias_root_ca_cert = { path = "../keys/ias_root_ca_cert.pem" }


# Auditors' public keys to verify their endorsement signatures # Auditors' public keys to verify their endorsement signatures
auditor_public_keys = [ auditor_public_keys = [
{ path = "../auditors/godzilla/godzilla.public.der" }, { path = "../keys/auditors/godzilla/godzilla.public.der" },
{ path = "../auditors/optimus_prime/optimus_prime.public.der" }, { path = "../keys/auditors/optimus_prime/optimus_prime.public.der" },
{ path = "../auditors/albus_dumbledore/albus_dumbledore.public.der"}, { path = "../keys/auditors/albus_dumbledore/albus_dumbledore.public.der"},
] ]


# RPC max message size # RPC max message size
Expand Down
9 changes: 8 additions & 1 deletion teaclave_config/build.rs
@@ -1,6 +1,7 @@
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::str;


fn main() { fn main() {
let is_sim = env::var("SGX_MODE").unwrap_or_else(|_| "HW".to_string()); let is_sim = env::var("SGX_MODE").unwrap_or_else(|_| "HW".to_string());
Expand All @@ -22,5 +23,11 @@ fn main() {
]) ])
.output() .output()
.expect("Cannot generate build_config.rs"); .expect("Cannot generate build_config.rs");
assert!(c.status.success()); if !c.status.success() {
panic!(
"stdout: {:?}, stderr: {:?}",
str::from_utf8(&c.stderr).unwrap(),
str::from_utf8(&c.stderr).unwrap()
);
}
} }
10 changes: 6 additions & 4 deletions teaclave_config/config_gen/main.rs
Expand Up @@ -24,7 +24,7 @@ enum ConfigSource {
fn display_config_source(config: &ConfigSource) -> String { fn display_config_source(config: &ConfigSource) -> String {
match config { match config {
ConfigSource::Path(p) => { ConfigSource::Path(p) => {
let content = &fs::read(p).unwrap(); let content = &fs::read(p).expect(&format!("Failed to read file: {}", p.display()));
let mut output = String::new(); let mut output = String::new();
output.push_str("&["); output.push_str("&[");
for b in content { for b in content {
Expand All @@ -43,7 +43,7 @@ fn main() {
panic!("Please specify the path of build config toml and output path."); panic!("Please specify the path of build config toml and output path.");
} }
let contents = fs::read_to_string(&args[1]).expect("Something went wrong reading the file"); let contents = fs::read_to_string(&args[1]).expect("Something went wrong reading the file");
let config: BuildConfigToml = toml::from_str(&contents).unwrap(); let config: BuildConfigToml = toml::from_str(&contents).expect("Failed to parse the config.");


let sp_root_ca_cert = display_config_source(&config.sp_root_ca_cert); let sp_root_ca_cert = display_config_source(&config.sp_root_ca_cert);
let ias_root_ca_cert = display_config_source(&config.ias_root_ca_cert); let ias_root_ca_cert = display_config_source(&config.ias_root_ca_cert);
Expand Down Expand Up @@ -81,6 +81,8 @@ fn main() {
)); ));


let dest_path = Path::new(&args[2]); let dest_path = Path::new(&args[2]);
let mut f = File::create(&dest_path).unwrap(); let mut f =
f.write_all(build_config_generated.as_bytes()).unwrap(); File::create(&dest_path).expect(&format!("Failed to create file: {}", dest_path.display()));
f.write_all(build_config_generated.as_bytes())
.expect(&format!("Failed to write file: {}", dest_path.display()));
} }

0 comments on commit 86898b6

Please sign in to comment.