Commit graph

17 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
9891d106cc
init services moved to data/init/ 2025-11-24 00:07:07 +01:00
Gustavo Iñiguez Goia
66ee50bf7d
tasks: allow to load tasks from disk
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.
2025-09-11 12:19:38 +02:00
Gustavo Iñiguez Goia
8c3fa40cf4
distribute default rules with the pkgs
Some checks failed
CI - build eBPF modules / build (6.0, 1.5.0) (push) Has been cancelled
CI - build eBPF modules / build (6.0, master) (push) Has been cancelled
Test resources validation / Install tools (push) Has been cancelled
Build status / Build (push) Has been cancelled
- distribute daemon/data/rules/ with the daemon packages.
 - added a new system fw rule to allow localhost connections (disabled
   by default).

Closes: #965.
2025-08-08 13:45:26 +02:00
Gustavo Iñiguez Goia
7d2ca8d039
updated network_aliases.json path
- Load network_aliases.json by default from /etc/opensnitchd.
 - Don't exit if network_aliases.json doesn't exist.
 - Updated Makefile to install network aliases definitions.
2024-12-17 00:38:30 +01:00
clayton craft
8f49816dee
daemon/Makefile: improvements to make distro packaging easier (#780)
* daemon/Makefile: add support for PREFIX, DESTDIR, SYSCONFDIR in install

This is helpful for package maintainers who need to install components
into specific locations for building packages of this project.

example:
$ make \
    PREFIX=/usr \
    DESTDIR=/some/package/dir \
    SYSCONFDIR=/foo/etc \
    install

* daemon/Makefile: use 'install' to copy files / make dirs
2022-12-21 10:35:52 +01:00
themighty1
35975bc760
need to generate go.sum otherwise we get errors 2021-09-15 04:28:56 +00:00
themighty1
be0c051205 makefile:
rename, remove unused targets
    trigger targets only when relevant files actually are changed
git:
    do not track files which are generated during make
github actions fix to not rely on a pre-built ui.pb.go
2021-02-13 18:48:49 +03:00
Gustavo Iñiguez Goia
f751dc13c6 removed sudo from Makefiles
Documentation must be updated to indicate when to use sudo.

closes #291
2020-12-11 23:42:47 +01:00
Raphael
1248a2326c remove go dep from Makefile 2020-07-16 23:04:11 +02:00
Gustavo Iñiguez Goia
6ebd6cca99 added a default configuration file
Some people has asked where they can change the daemon configuration.

As we can't change it from the GUI yet, and we're providing deb
packages, we need to distribute a default config.

That way the users will see it and will be able to customize it.
2020-03-08 20:25:05 +01:00
evilsocket
494cf1ab1a
migrating from glide to dep (closes #147) 2018-04-15 16:51:58 +02:00
evilsocket
d37cd40495
implemented process.env.ENV_VAR_NAME operand (closes #152) 2018-04-15 16:18:49 +02:00
evilsocket
ec6ecea8b4
UI is now using python3 2018-04-11 15:35:29 +02:00
evilsocket
4e820db6c7
install rules and systemd integration (closes #118) 2018-04-10 19:16:29 +02:00
evilsocket
de3b9216b6
daemon -> opensnitchd (ref #118) 2018-04-10 18:38:04 +02:00
evilsocket
11c19d2c50
misc: small fix or general refactoring i did not bother commenting 2018-04-07 15:52:58 +02:00
evilsocket
6659350085
started working on ui gRPC protocol 2018-04-02 17:54:56 +02:00