Skip to content

Commit

Permalink
func: disable proc_scan, fanotify, arf, and fullscan with proc
Browse files Browse the repository at this point in the history
  • Loading branch information
kulukami committed Dec 26, 2024
1 parent 51b8da8 commit 4251d77
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion plugins/scanner/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ flock_path = "/var/run/elkeid_scanners_plugin.pid"
### cgroup max mem limit, defult 256Mb
cgroup_name = "clamav_"
### mega byte
cgroup_mem_limit = 256
cgroup_mem_limit = 300
### %
cgroup_cpu_limit = 39

Expand Down
26 changes: 14 additions & 12 deletions plugins/scanner/src/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ impl Detector {
clamav::clamav_init().unwrap();
let recv_worker = thread::spawn(move || {
let mut _arf_t: Option<HoneyPot> = None;
/*
let s_arf_worker = task_sender.clone();
let s_arf_lock = recv_worker_s_locker.clone();
Expand All @@ -342,6 +343,7 @@ impl Detector {
None
}
};
*/

loop {
match r_client.receive() {
Expand All @@ -365,10 +367,10 @@ impl Detector {
),
};
if let Err(e) = r_client
.send_record(&end_flag.to_record_token(&t.get_token()))
{
warn!("send err, should exit : {:?}", e);
};
.send_record(&end_flag.to_record_token(&t.get_token()))
{
warn!("send err, should exit : {:?}", e);
};
continue;
}
let task_map: HashMap<String, String> =
Expand All @@ -380,9 +382,9 @@ impl Detector {
data: "failed".to_string(),
error: format!("recv serde_json err {:?}", t.data),
};
if let Err(e) = r_client
.send_record(&end_flag.to_record_token(&t.get_token()))
{
if let Err(e) = r_client.send_record(
&end_flag.to_record_token(&t.get_token()),
) {
warn!("send err, should exit : {:?}", e);
};
continue;
Expand Down Expand Up @@ -458,7 +460,7 @@ impl Detector {
break;
}
Some(Err(_err)) => {
/*
/*
let end_flag = ScanFinished {
data: "failed".to_string(),
error: _err.to_string(),
Expand All @@ -468,10 +470,10 @@ impl Detector {
) {
warn!("send err, should exit : {:?}", e);
};
break;
break;
*/
warn!("walkdir continue with: {:?}", _err);
continue
continue;
}
Some(Ok(entry)) => entry,
};
Expand All @@ -484,8 +486,8 @@ impl Detector {
if fsize <= 4 || fsize > 1024 * 1024 * 100 {
continue;
}
}else{
continue
} else {
continue;
}

let task = ScanTaskUserTask::with_path(
Expand Down
3 changes: 2 additions & 1 deletion plugins/scanner/src/model/functional/cronjob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ impl Cronjob {
let mut proc_crobjob_is_first_run = true;
let mut scaned_cache = LruCache::new(20480);
let job_proc = thread::spawn(move || loop {
std::thread::sleep(Duration::from_secs(30));
continue;
let start_timestamp = Clock::now_since_epoch().as_secs();
info!("[CronjobProc] Scan started at : {}", start_timestamp);

Expand Down Expand Up @@ -230,7 +232,6 @@ impl Cronjob {
};
}
last_scaned_timestamp = Clock::now_since_epoch().as_secs();
std::thread::sleep(Duration::from_secs(30));
proc_crobjob_is_first_run = false;
});
return Self { job_dir, job_proc };
Expand Down
5 changes: 3 additions & 2 deletions plugins/scanner/src/model/functional/fulldiskscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ pub fn FullScan(
let job = thread::spawn(move || {
// step-1
// proc scan
info!("[FullScan] step-1: /proc/pid/exe");
info!("[FullScan] step-1: /proc/pid/exe skiped");
/*
let dir_p = fs::read_dir("/proc").unwrap();
for each in dir_p {
Expand Down Expand Up @@ -273,7 +274,7 @@ pub fn FullScan(
}
};
}

*/
// step-2
info!("[FullScan] step-2: fulldisk");
match fullscan_mode {
Expand Down

0 comments on commit 4251d77

Please sign in to comment.