Commit graph

10 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
55ac4b7fa4
tasks improvements
- fixed some race conditions.
- added more errors logging.
2025-11-28 00:02:52 +01:00
Gustavo Iñiguez Goia
543241f7cd
improved tasks stopping
We don't need to close the channels on stopping a task. We use a Context
to exit from the task results loop.
2025-11-20 01:25:31 +01:00
Gustavo Iñiguez Goia
24f7e6ff1b
tasks,iocscanner: improved running cmds
Sometimes we never reset the running status of the command.
2025-11-14 01:12:57 +01:00
Gustavo Iñiguez Goia
906ad17b12
tasks, iocscanner: minor changes
added tools name as constants, and explain how to use them.

The name of a tool identifies an instance of that tool. Each tool has
its own configuration and logic.

In order to create multiple instances of a tool (for example to run
multiple commands or scripts), just append details to the tool name:

 "name": "script",
 "cmd": ["/usr/bin/clamscan"]

 "name": "script-unhide",
 "cmd": ["/usr/sbin/unhide"]
2025-11-14 00:52:39 +01:00
Gustavo Iñiguez Goia
ab6638f9a0
tasks, iocscanner: simplify messages to the GUI 2025-11-14 00:35:08 +01:00
Gustavo Iñiguez Goia
450adf6485
tasks, iocscanner: updated README 2025-11-12 01:11:08 +01:00
Gustavo Iñiguez Goia
3d2d99648f
tasks: iocscanner minor improvements
- stop scheduler properly.
 - skip closing channels for now.
2025-11-12 00:52:12 +01:00
Gustavo Iñiguez Goia
cb2feeb6a3
tasks: updated iocscanner README.md 2025-09-24 12:50:16 +02:00
Gustavo Iñiguez Goia
be34c8e84f
tasks: added iocscanner README 2025-09-22 19:11:44 +02:00
Gustavo Iñiguez Goia
1673856037
tasks: added IOC scanner
Preliminary version of a task for scanning IOCs in background
(Indicator Of Compromise).

It can execute scripts and commands in background periodically.

 - Added a new task scheduler to configure when the task is launched.
   Previously we only had an "Interval" field to run the task
periodically. Now it's possible to select the day of the week, specify
multiple times, hours or minutes.

        "schedule": [
            {
                "weekday": [5,6],
                "time": ["09:55:00", "20:15:20"],
            },
            {
                "weekday": [0,1,2,3,4],
                "time": ["15:00:00"],
            }
        ],
   Used only in this task for now.

 - This task supports 4 "tools": yara, scripts and debsums/dpkg.

   * The "yara" tool acts as a frontend to the yara cli tool, used to scan
     for IOCs with YARA rules.
   * The "debsums"/"dpkg" tools can be used to:
     - report changes in the MD5 checksums of installed Debian
       packages (debsums -c).
     - report changes in configuration files of installed Debian
       packages (debsums -ce).
     - verify the integrity of Debian packages (dpkg --verify, dpkg
       --verify <package1> <packag2>).
       The output of the format (rpm) is not parsed yet.

Configuration example of the task to report the output of the command
debsums:
{
  "name": "IOC-scanner",
  "data": {
     "interval": "15s",
     "schedule": [
         {
             "weekday": [0,1,2,3,4,5,6],
             "time": ["22:00:00"]
         }
     ],
     "tools": [
     {
         "name": "debsums",
         "msgStart": "IOC scanner debsums started",
         "msgEnd": "IOC scanner debsums finished",
         "enabled": false,
         "cmd": ["debsums", "-c"],
         "options": {
             "dirs": [],
             "files": [],
             "reports": {
                 "path": "/etc/opensnitchd/tasks/iocscanner/reports",
                 "format": ""
             }
         }
     }
   ]
}

The field "name" defines which tool to use. It's also used to parse and
format the output of the specified command.

The output of the command is sent to the GUI as an alert, and the
results can be reviewed under the Rules tab -> Alerts.
2025-09-22 00:11:28 +02:00