Skip to content

Commit

Permalink
Fixed unit tests in Linux, added rules configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
okynos committed Apr 25, 2024
1 parent 44446aa commit 42dad6d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions config/linux/rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rules:
- id: 1
path: /etc
rule: '\.sh$'
message: "Shell script present in /etc folder."
5 changes: 5 additions & 0 deletions config/macos/rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rules:
- id: 1
path: /etc
rule: '\.sh$'
message: "Shell script present in /etc folder."
11 changes: 5 additions & 6 deletions config/windows/rules.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
monitor:
- path: C:\tmp\
id: 7
rule: '\.php$'
message: "This is a test"
labels: ["windows", "test"]
rules:
- id: 1
path: C:\
rule: '\.ps1$'
message: "Powershell script present in root directory."
1 change: 0 additions & 1 deletion src/auditevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ impl fmt::Debug for Event {
mod tests {
use super::*;
use crate::auditevent::Event;
use crate::appconfig::*;
use tokio_test::block_on;
use std::fs;

Expand Down
4 changes: 2 additions & 2 deletions src/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ mod tests {
// ------------------------------------------------------------------------

#[cfg(any(target_os = "linux", target_os = "darwin"))]
pub fn create_dummy_event_unix(path: &str, operation: &str) -> Event {
Event{
pub fn create_dummy_event_unix(path: &str, operation: &str) -> MonitorEvent {
MonitorEvent{
id: "Test_id".to_string(),
timestamp: "Timestamp".to_string(),
hostname: "Hostname".to_string(),
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ async fn main() {
let (cfg, ruleset) = init();

let (tx, rx) = mpsc::channel();
let rotator_cfg = cfg.clone();
match thread::Builder::new()
.name("FIM_Rotator".to_string()).spawn(|| rotator::rotator(cfg)){
.name("FIM_Rotator".to_string()).spawn(|| rotator::rotator(rotator_cfg)){
Ok(_v) => info!("FIM rotator thread started."),
Err(e) => error!("Could not start FIM rotator thread, error: {}", e)
};
Expand Down

0 comments on commit 42dad6d

Please sign in to comment.