Some kernels or systems may not have tracefs mounted or available
by default.
We need the path /sys/kernel/tracing to be mounted, in order to add
syscalls ebpf probes.
So from now on we'll try to mount /sys/kernel/tracing if it's not
already mounted.
-check-requirements parameter updated to check if this option is
available.
Closes#1450.
now you can open multiple rules editor dialogs from the rules list.
Right click on the rules list to edit the selected rule, then right
click on another rule to edit a new rule.
When editing a rule from the detailed view (after double clicking on a
rule), it'll only allow to open one dialog.
Closes#1455.
This change modifies the StatsDialog class to use the show() method instead of overriding showEvent(). This resolves a recursion error.
Changes made:
- Replaced the showEvent() method override with a show() method
- Maintained the same functionality including:
- Emitting the _shown_trigger signal
- Setting window state to active and unminimized
- Updating the window title with version information
- Removed the event parameter since show() doesn't receive event arguments
- Preserved all existing logic for address checking and window title formatting
Co-authored-by: Gustavo Iñiguez Goia <gooffy1@gmail.com>
This change fixes an issue where the statistics dialog would not properly restore its maximized state when reopening. The previous implementation attempted to manually set the window geometry to simulate a maximized state, but this approach was unreliable and didn't properly handle screen boundaries or multi-monitor setups.
The fix replaces the manual geometry setting with a proper call to showMaximized() when the dialog is visible, ensuring that Qt's window management correctly handles the maximized state restoration. This provides consistent behavior across different platforms and display configurations.
Changes made:
- Removed the manual geometry calculation that attempted to simulate maximized state
- Added proper isVisible() check before calling showMaximized() to ensure the window is properly initialized
- Simplified the maximized state restoration logic to use Qt's built-in functionality
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"]
For now we won't detect it automatically, because we're using
QtCore.QLocale.system().name() to detect the language. This function
usually returns the language and country (en_UK, ...), but this
translation is not tied to any specific country (ar).
It can be configured manually from the Preferences, UI tab.
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.
Restrict permissions to 127.0.0.1 and ::1 instead of the whole loopback
range.
This way, we allow localhost connections from common processes (dirmngr,
kdeinit5, xbrlapi, etc.), while giving users control to allow or deny
DNS queries to the local DNS stub resolver (which for example usually
listens on 127.0.0.53).
More info: #1416.
Added a new task to schedule files downloads.
Whenever the task is loaded, the files will be downloaded. From that on,
files will be downloaded according to the duration specified in the
"interval" field.
The format of the interval field is time.Duration:
https://pkg.go.dev/time#Duration
configuration example:
/etc/opensnitchd/tasks/tasks.json:
{
"tasks":[
{
"enabled": false,
"name": "downloader",
"configfile": "/etc/opensnitchd/tasks/downloader/downloader.json"
}
]
}
/etc/opensnitchd/downloader/downloader.json:
{
"name": "downloader",
"parent": "downloader",
"description": "",
"data": {
"interval": "6h",
"timeout": "5s",
"urls": [
{
"name": "adaway",
"enabled": true,
"remote": "https://adaway.org/hosts.txt",
"localfile": "/tmp/bl3/ads-adaway-hosts.txt"
}
],
"notify": {
"enabled": true
}
}
Now it's possible to load tasks from disk.
There's a central file which contains the defined tasks:
/etc/opensnitchd/tasks/tasks.json
with this format:
{
"tasks": [
{
"enabled": false,
"name": "downloader",
"configfile":
"/etc/opensnitchd/tasks/downloader/downloader.json",
}
]
}
The field "name" defines the type of task to load, defined in each task.
It's static.
Whenever the tasks.json is modified, if the tasks are enabled, the task
configuration file defined in the "configfile" field will be loaded.
Configuration format of each task:
{
"name": "downloader",
"parent": "downloader",
"data": {}
}
The field "name" is dynamic, unique, and identifies the instance of the
task. If there're two tasks configured with the same name, only one will
be loaded.
The "parent" field is used to know what's the base task. If it's not
specified, we'll try to use the "name" as the base task.
This allows you to run multiple instances of the same task with
different configurations: a downloader to update malware blocklists,
another to update IP blocklists, etc.
The "data" field depends of each task. It's generic, and each task is
responsible for defining it. For example for the Downloader task:
"data": {
"interval": "1h",
"timeout": "5s",
"urls": [
{
"name": "adaway",
"enabled": true,
"remote": "https://adaway.o/hosts.txt",
"localfile": "/tmp/blocklist/ads-adaway-hosts.txt"
}
]
}
The tasks configuration file are also monitored for changes, and
whenever a change is detected the task is reloaded.
----
Notifications (WIP)
It's not yet fully defined and it'll change, but this is the state as
of today.
For real-time tasks, like pid-monitor, sockets monitor and node monitor,
the GUI initiates the task with a unique ID (a timestamp), to know who
is sending what, and display the data properly on the GUI.
For permanent tasks we use a unique ID defined for each task.
Right now, if we don't have the notifications channel opened and the
notification ID corresponds with one of the tasks, we'll post an alert
to the GUI, to display a desktop notification.
Each task can define if send notifications or not. For example:
{
"name": "downloader",
"data": {
(...)
"notify": {
"enabled": true
}
}
}
then in each task, act accordingly to what is defined in the
configuration.
With PyQt5 we used plupdate5 + *.pro file to update the translations
file with new strings, extracted from the source code and UI forms.
In PyQt6, pylupdate6 doesn't support parsing .pro files, so we need to do it
manually.