Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix java probe message config #678

Merged
merged 1 commit into from
Aug 21, 2024
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
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
Loading