Skip to content

Commit

Permalink
fix java probe message config
Browse files Browse the repository at this point in the history
  • Loading branch information
yoloyyh committed Aug 21, 2024
1 parent f02b590 commit 4ec3c67
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
12 changes: 9 additions & 3 deletions rasp/librasp/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ impl RASPManager {
})
}
}
let mut need_write_config = true;
for m in messages.iter() {
if m.message_type >= 12 && m.message_type <= 14 {
need_write_config = false;
}
if let Some(uuid) = &m.data.uuid {
if uuid == "" {
valid_messages.push(PidMissingProbeConfig {
Expand Down Expand Up @@ -259,8 +263,10 @@ impl RASPManager {
}
}

let valid_messages_string = serde_json::to_string(&valid_messages)?;
self.write_message_to_config_file(pid, nspid, valid_messages_string)?;
if need_write_config {
let valid_messages_string = serde_json::to_string(&valid_messages)?;
self.write_message_to_config_file(pid, nspid, valid_messages_string)?;
}

Ok(())
}
Expand Down Expand Up @@ -903,7 +909,7 @@ impl RASPManager {
if !Path::new(&config_dir).exists() {
fs_extra::dir::create(&config_dir, true)?;
}
fs::set_permissions(&config_dir, fs::Permissions::from_mode(0o666))?;
fs::set_permissions(&config_dir, fs::Permissions::from_mode(0o777))?;
fs_extra::file::write_all(&config_path_bak, message.as_str())?;
fs::set_permissions(&config_path_bak, fs::Permissions::from_mode(0o777))?;
let mut option = fs_extra::file::CopyOptions::new();
Expand Down
1 change: 0 additions & 1 deletion rasp/plugin/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ impl Operator {
.namespace_info.clone().ok_or(anyhow!("unable fetch namespace"))?
.mnt.ok_or(anyhow!("unable fetch namespace"))?;
// self.rasp_manager.write_message_to_config_file(pid, process_info.nspid, probe_message.clone());
self.rasp_manager.delete_config_file(pid, process_info.nspid)?;
self.rasp_manager.send_message_to_probe(pid, &mnt_namespace, probe_message)
}

Expand Down
2 changes: 1 addition & 1 deletion rasp/rasp_server/src/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ pub async fn looping(
}
}
None => {
log::warn!("tx recv ctrl stop");
log::warn!("tx recv ctrl stop, pid: {}", pid);
let _ = tx_ctrl.stop();
//drop(framed_rx.get_mut());
return
Expand Down

0 comments on commit 4ec3c67

Please sign in to comment.