Skip to content

Commit 599e769

Browse files
committed
keylimectl: do not make requests to the agent in push model
Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
1 parent 6571e13 commit 599e769

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

keylimectl/src/commands/agent.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -784,13 +784,17 @@ async fn add_agent(
784784

785785
let api_version =
786786
verifier_client.api_version().parse::<f32>().unwrap_or(2.1);
787-
let is_push_model = api_version >= 3.0;
787+
788+
// Use push model if explicitly requested via --push-model flag
789+
// This skips direct agent communication but still uses the detected API version
790+
// for verifier requests
791+
let is_push_model = params.push_model;
788792

789793
debug!("Detected API version: {api_version}, using push model: {is_push_model}");
790794

791-
// Determine agent connection details (needed for legacy API < 3.0)
795+
// Determine agent connection details (needed for pull model)
792796
let (agent_ip, agent_port) = if !is_push_model {
793-
// Legacy pull model: need agent IP/port for direct communication
797+
// Pull model: need agent IP/port for direct communication
794798
let agent_ip = params
795799
.ip
796800
.map(|s| s.to_string())
@@ -802,7 +806,7 @@ async fn add_agent(
802806
.ok_or_else(|| {
803807
CommandError::invalid_parameter(
804808
"ip",
805-
"Agent IP address is required for API < 3.0".to_string(),
809+
"Agent IP address is required for pull model (use --push-model to skip)".to_string(),
806810
)
807811
})?;
808812

@@ -816,7 +820,7 @@ async fn add_agent(
816820
.ok_or_else(|| {
817821
CommandError::invalid_parameter(
818822
"port",
819-
"Agent port is required for API < 3.0".to_string(),
823+
"Agent port is required for pull model (use --push-model to skip)".to_string(),
820824
)
821825
})?;
822826

@@ -826,9 +830,9 @@ async fn add_agent(
826830
("localhost".to_string(), 9002)
827831
};
828832

829-
// Step 3: Perform legacy attestation for API < 3.0
833+
// Step 3: Perform attestation for pull model
830834
let attestation_result = if !is_push_model {
831-
output.step(3, 4, "Performing legacy TPM attestation (API < 3.0)");
835+
output.step(3, 4, "Performing TPM attestation (pull model)");
832836

833837
// Create agent client for direct communication
834838
let agent_client = AgentClient::builder()
@@ -851,11 +855,7 @@ async fn add_agent(
851855
)
852856
.await?
853857
} else {
854-
output.step(
855-
3,
856-
4,
857-
"Skipping direct attestation (push model, API >= 3.0)",
858-
);
858+
output.step(3, 4, "Skipping agent attestation (push model)");
859859
None
860860
};
861861

0 commit comments

Comments
 (0)