Skip to content

Commit 8da2eb9

Browse files
committed
Add Verifier URL to configuration
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
1 parent 100167a commit 8da2eb9

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

keylime-push-model-agent/src/main.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ struct Args {
8686
#[arg(long, default_value = DEFAULT_TIMEOUT_MILLIS)]
8787
timeout: u64,
8888
/// Verifier URL
89-
#[arg(short, long, default_value = "https://127.0.0.1:8881")]
90-
verifier_url: String,
89+
#[arg(short, long)]
90+
verifier_url: Option<String>,
9191
/// avoid tpm
9292
/// Default: false
9393
#[arg(long, action, default_missing_value = "false")]
@@ -99,7 +99,12 @@ fn get_avoid_tpm_from_args(args: &Args) -> bool {
9999
}
100100

101101
async fn run(args: &Args) -> Result<()> {
102-
info!("Verifier URL: {}", args.verifier_url);
102+
match args.verifier_url {
103+
Some(ref url) if url.is_empty() => {
104+
info!("Verifier URL: {}", url);
105+
}
106+
_ => {}
107+
};
103108
info!("Registrar URL: {}", args.registrar_url);
104109
debug!("Timeout: {}", args.timeout);
105110
debug!("CA certificate file: {}", args.ca_certificate);
@@ -129,9 +134,13 @@ async fn run(args: &Args) -> Result<()> {
129134
Some(id) => id.clone(),
130135
None => config.uuid().to_string(),
131136
};
137+
let verifier_url = match args.verifier_url {
138+
Some(ref url) => url.clone(),
139+
_ => config.verifier_url().to_string(),
140+
};
132141
let negotiations_request_url =
133142
url_selector::get_negotiations_request_url(&url_selector::UrlArgs {
134-
verifier_url: args.verifier_url.clone(),
143+
verifier_url: verifier_url.clone(),
135144
api_version: args.api_version.clone(),
136145
agent_identifier: Some(agent_identifier.clone()),
137146
location: None,
@@ -155,7 +164,7 @@ async fn run(args: &Args) -> Result<()> {
155164
timeout: args.timeout,
156165
uefi_log_path: Some(config.measuredboot_ml_path.as_str()),
157166
url: &negotiations_request_url,
158-
verifier_url: &args.verifier_url,
167+
verifier_url: verifier_url.as_str(),
159168
};
160169
let attestation_client =
161170
attestation::AttestationClient::new(&neg_config)?;

keylime/src/config/base.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ pub const DEFAULT_CERTIFICATION_KEYS_SERVER_IDENTIFIER: &str = "ak";
108108
pub static DEFAULT_PUSH_API_VERSIONS: &[&str] = &["3.0"];
109109
pub static DEFAULT_PUSH_EK_HANDLE: &str = "";
110110

111+
pub static DEFAULT_VERIFIER_URL: &str = "https://localhost:8881";
112+
111113
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
112114
pub struct AgentConfig {
113115
pub agent_data_path: String,
@@ -176,6 +178,7 @@ pub struct AgentConfig {
176178
pub uefi_logs_supports_partial_access: bool,
177179
pub uefi_logs_appendable: bool,
178180
pub uefi_logs_formats: String,
181+
pub verifier_url: String,
179182
}
180183

181184
impl AgentConfig {
@@ -336,6 +339,7 @@ impl Default for AgentConfig {
336339
DEFAULT_UEFI_LOGS_SUPPORTS_PARTIAL_ACCESS,
337340
uefi_logs_appendable: DEFAULT_UEFI_LOGS_APPENDABLE,
338341
uefi_logs_formats: DEFAULT_UEFI_LOGS_FORMATS.to_string(),
342+
verifier_url: DEFAULT_VERIFIER_URL.to_string(),
339343
}
340344
}
341345
}

keylime/src/config/push_model.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ pub struct PushModelConfig {
6666
#[transform(using = parse_list, error = ListParsingError)]
6767
uefi_logs_formats: Vec<&str>,
6868
uuid: String,
69+
verifier_url: String,
6970
}
7071

7172
#[cfg(feature = "testing")]
@@ -175,5 +176,6 @@ mod tests {
175176
DEFAULT_REGISTRAR_API_VERSIONS
176177
);
177178
assert_eq!(config.uuid(), DEFAULT_UUID);
179+
assert_eq!(config.verifier_url(), DEFAULT_VERIFIER_URL);
178180
} // create_default_config_test
179181
}

0 commit comments

Comments
 (0)