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

Add key command #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
113 changes: 113 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ keywords = ["aws", "nitro", "enclave"]
clap = {version = "4.0", features = ["derive"]}
aws-config = "0.49.0"
aws-sdk-cloudformation = "0.19.0"
aws-sdk-kms = "0.19.0"
failure = "0.1.8"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
Expand All @@ -21,3 +22,8 @@ home = "0.5.4"
rust-embed = "6.4.2"
rand = "0.8.5"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
gtmpl = "0.7"
gtmpl_derive = "0.5"
gtmpl_value = "0.5"
uuid = {version = "1.2.2", features = ["v4", "fast-rng"]}
19 changes: 18 additions & 1 deletion src/bin/nitrogen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::time::Duration;
use aws_sdk_cloudformation::Client;
use clap::{Parser, Subcommand};
use failure::Error;
use nitrogen::commands::{build, delete, deploy, logs, setup};
use nitrogen::commands::{build, delete, deploy, key, logs, setup};
use nitrogen::template::SETUP_TEMPLATE;
use tracing::{debug, info};

Expand Down Expand Up @@ -113,6 +113,13 @@ enum Commands {
#[arg(short, long, default_value_t = String::from("0.0.0.0/0"))]
ssh_location: String,
},
Key {
principal_arn: String,

/// input EIF location
#[arg(short, long, default_value_t = String::from("nitrogen.eif"))]
eif: String,
},
}

#[tokio::main]
Expand Down Expand Up @@ -281,6 +288,16 @@ async fn main() -> Result<(), Error> {

info!("{:?}", out);

Ok(())
}
Commands::Key { principal_arn, eif } => {
let shared_config = aws_config::from_env().load().await;
let client = aws_sdk_kms::Client::new(&shared_config);

let out = key(&client, &principal_arn, &eif).await?;

info!("{:?}", out);

Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub async fn build(
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
"-v",
&format!("{}:/root/build", eif_dir,),
&format!("{}:/root/build", eif_dir),
"capeprivacy/eif-builder:latest",
"build-enclave",
"--docker-uri",
Expand Down