Skip to content
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
10 changes: 10 additions & 0 deletions keylime-push-model-agent/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ pub struct ResponseInformation {
pub body: String,
}

impl Default for ResponseInformation {
fn default() -> Self {
Self {
status_code: StatusCode::OK,
headers: HeaderMap::new(),
body: String::new(),
}
}
}

#[derive(Debug, Clone)]
pub struct NegotiationConfig<'a> {
pub avoid_tpm: bool,
Expand Down
12 changes: 11 additions & 1 deletion keylime-push-model-agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod url_selector;
const DEFAULT_TIMEOUT_MILLIS: &str = "5000";
const DEFAULT_METHOD: &str = "POST";
const DEFAULT_MESSAGE_TYPE_STR: &str = "Attestation";
const DEFAULT_ATTESTATION_INTERVAL_SECONDS: u64 = 60;

pub enum MessageType {
Attestation,
Expand Down Expand Up @@ -92,6 +93,10 @@ struct Args {
/// Default: false
#[arg(long, action, default_missing_value = "false")]
avoid_tpm: Option<bool>,
/// Interval in seconds between the attestations happening after the first successful attestation
/// Default: 60
#[arg(long, default_value_t = DEFAULT_ATTESTATION_INTERVAL_SECONDS)]
attestation_interval_seconds: u64,
}

fn get_avoid_tpm_from_args(args: &Args) -> bool {
Expand All @@ -101,7 +106,7 @@ fn get_avoid_tpm_from_args(args: &Args) -> bool {
async fn run(args: &Args) -> Result<()> {
match args.verifier_url {
Some(ref url) if url.is_empty() => {
info!("Verifier URL: {}", url);
info!("Verifier URL: {url}");
}
_ => {}
};
Expand Down Expand Up @@ -173,6 +178,7 @@ async fn run(args: &Args) -> Result<()> {
attestation_client,
neg_config,
ctx_info,
args.attestation_interval_seconds,
);
state_machine.run().await;
Ok(())
Expand Down Expand Up @@ -208,6 +214,8 @@ mod tests {
method: None,
attestation_index: None,
session_index: None,
attestation_interval_seconds:
DEFAULT_ATTESTATION_INTERVAL_SECONDS,
};
let res = run(&args);
assert!(res.await.is_err());
Expand All @@ -233,6 +241,8 @@ mod tests {
method: None,
attestation_index: None,
session_index: None,
attestation_interval_seconds:
DEFAULT_ATTESTATION_INTERVAL_SECONDS,
};
let avoid_tpm = get_avoid_tpm_from_args(&args);
assert!(avoid_tpm);
Expand Down
Loading