Integrate signed agent catalog, tenant enrollment and HTTPS installers
This commit is contained in:
@@ -63,7 +63,12 @@ pub async fn open(
|
||||
);
|
||||
let mut tx = rmm_persistence::tenant_tx(&state.pool, tenant).await?;
|
||||
control_lock(&mut tx, tenant, agent).await?;
|
||||
let generation:i64=sqlx::query_scalar("UPDATE agent_installations SET connection_generation=connection_generation+1,capabilities=$2,transport=$3,connection_boot_id=$4,restore_blocked=restore_blocked OR $5<=last_sequence,sequence_regressed=sequence_regressed OR $5<=last_sequence,sync_required=$6,sync_ready=NOT $6,helper_sync_ready=false,last_sequence=$5 WHERE agent_id=$1 AND revoked_at IS NULL RETURNING connection_generation").bind(agent).bind(serde_json::to_value(&client.capabilities)?).bind(transport).bind(Uuid::parse_str(&e.boot_id)?).bind(i64::try_from(e.sequence)?).bind(client.capabilities.iter().any(|c|c=="rmm.sync.v1")).fetch_one(&mut *tx).await?;
|
||||
anyhow::ensure!(
|
||||
client.agent_version.len() <= 64
|
||||
&& client.agent_version.bytes().all(|b| b.is_ascii_graphic()),
|
||||
"invalid agent version"
|
||||
);
|
||||
let generation:i64=sqlx::query_scalar("UPDATE agent_installations SET connection_generation=connection_generation+1,capabilities=$2,transport=$3,connection_boot_id=$4,restore_blocked=restore_blocked OR $5<=last_sequence,sequence_regressed=sequence_regressed OR $5<=last_sequence,sync_required=$6,sync_ready=NOT $6,helper_sync_ready=false,last_sequence=$5,reported_agent_version=NULLIF($7,'') WHERE agent_id=$1 AND revoked_at IS NULL RETURNING connection_generation").bind(agent).bind(serde_json::to_value(&client.capabilities)?).bind(transport).bind(Uuid::parse_str(&e.boot_id)?).bind(i64::try_from(e.sequence)?).bind(client.capabilities.iter().any(|c|c=="rmm.sync.v1")).bind(&client.agent_version).fetch_one(&mut *tx).await?;
|
||||
tx.commit().await?;
|
||||
Ok(reply(
|
||||
e,
|
||||
|
||||
Reference in New Issue
Block a user