Commit graph

1284 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
820e7d5fe9
ui: create /run/user/ dirs with proper permissions
"$XDG_RUNTIME_DIR defines the base directory relative to which user-specific
non-essential runtime files and other file objects (such as sockets,
named pipes, ...) should be stored. The directory MUST be owned by the
user, and he MUST be the only one having read and write access to it.
Its Unix access mode MUST be 0700."

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
2022-10-18 00:15:25 +02:00
Gustavo Iñiguez Goia
b2ccb34c17
ui,rules: allow to filter by fields of the rules
Requested here: #756
2022-10-15 12:01:48 +02:00
Gustavo Iñiguez Goia
040d4bf921
ui, rules editor: allow to select multicast range
Closes #755
2022-10-14 01:20:54 +02:00
Gustavo Iñiguez Goia
728c2554ad
ui minor fixes
- Firewall dialog: disable widget when firewall is not active.
- Firewall rule dialog: enforce quotas units format.
- Nodes: fixed exception.
2022-10-14 00:59:00 +02:00
Gustavo Iñiguez Goia
7cbfca6b1f
ebpf: increased ring buffer size, hook execveat
Increased perf map buffer size to avoid lose events under heavy loads.

Hook execveat to intercept executions from memory.
2022-10-13 01:44:23 +02:00
Gustavo Iñiguez Goia
09e9a8ac79
fw: report initialization errors
Allow send fw initialization errors to the server (UI).
2022-10-13 00:08:52 +02:00
Gustavo Iñiguez Goia
6c9eb35456
Merge pull request #757 from tioguda/master
Update Brazilian Portuguese translation
2022-10-12 15:32:40 +02:00
tioguda
a812b26719
Update Brazilian Portuguese translation 2022-10-12 09:45:48 -03:00
Gustavo Iñiguez Goia
477e6aadb0
new feature: send alerts to the server/UI
Up until now some error and warning messages were only logged out to the
system, not allowing the user know what was happening under the hood.

Now the following events are notified:
 - eBPF related errors.
 - netfilter queue errors.
 - configuration errors.

WIP, we'll keep improving it and build new features on top of this one.
2022-10-12 13:31:45 +02:00
Gustavo Iñiguez Goia
915b325a00
ui: allow to configure (local) server address
Up until now, the daemon communicated with the GUI via a unix socket,
stored in /tmp.

/tmp however can be erased at any time (tmpreaper, systemd-tmpfiles.d),
which may lead to remove our unix socket file, and hence losing
connectiong with the daemon.

Now the user has the option to store the socket file under
/run/user/$uid/opensnitch/
https://www.linuxbase.org/betaspecs/fhs/fhs.html#runRuntimeVariableData

In the future we may switch to this path by default.
2022-10-06 13:57:52 +02:00
Gustavo Iñiguez Goia
cfeba55515
systemd service: start the daemon earlier
The daemon doesn't need network connectivity to work, so we don't need
to wait until we're online.

Closes #723
2022-10-05 22:10:04 +02:00
Gustavo Iñiguez Goia
09182fad2e
ebpf,action: compile modules when a change is pushed
Build eBPF modules whenever a change to the modules is pushed.
It'll fail if there're some warnings.

The action compiles *and publishes* the modules for several branches and
kernels.

Hopefully this will help to automate this process and be more transparent.
It'll also help on issues like this one: #454
2022-10-05 16:38:58 +02:00
Gustavo Iñiguez Goia
fb3a8ccb37
added helper script to compile eBPF modules 2022-10-05 14:51:00 +02:00
Gustavo Iñiguez Goia
31c420ad60
ebpf dns module: fixed compilation warning 2022-10-05 14:33:05 +02:00
Gustavo Iñiguez Goia
fe3de13875
build and test daemon only if changed 2022-10-05 14:13:03 +02:00
Gustavo Iñiguez Goia
8f70af47e2
resolve absolute path of a process if it's relative
We may receive relative paths from kernel (eBPF), so we need to resolve
the absolute path of the process in order to create valid rules.
2022-10-01 22:27:07 +02:00
Gustavo Iñiguez Goia
814ed52331
ui, fw: added helper to allow inbound connections
Added a helper to easily allow inbound connections, just by selecting
the port where a service is listening on.

Especially useful when the inbound policy is drop and you want to allow a
service (ssh, nfs, etc).
2022-10-01 15:07:40 +02:00
Gustavo Iñiguez Goia
acac68126b
ui, events: show the cmdline
Add the column cmdline to the events log, and allow to configure it.

Closes #745
2022-09-29 15:31:14 +02:00
Gustavo Iñiguez Goia
564c263d71
packaging: moving files out of the gui/daemon dirs 2022-09-26 23:03:49 +02:00
Gustavo Iñiguez Goia
3c82f58b85
ui: added network interface option to the editor
Closes #744
2022-09-24 20:40:58 +02:00
Gustavo Iñiguez Goia
b7c5785a00
fixed conman/ tests 2022-09-24 17:24:12 +02:00
Gustavo Iñiguez Goia
4a0f7a3e2b
rules: allow to filter by network interface name
Now you can create rules to filter network interface name.
Regular expresions allowed: "eth[0-9]"

Closes #726
2022-09-24 17:12:09 +02:00
Gustavo Iñiguez Goia
92e5240b08
pop-ups: filter by process path if cmdline is relative
It's a good practice to filter by command line + process path (and
others parameters), to limit what an application can do.

Thus, if the user selects "from this command line", and the command
launched is not an absolute path to the binary, we'll create a rule
to filter by process path + process cmdline.
2022-09-22 13:08:51 +02:00
Gustavo Iñiguez Goia
96cccb8b8c
ui, fw: more options to filter connections by pack
Added more options to filter connections by packets' metainformation.
Added: uid, gid, l4proto, protocol and priority.

+ When filtering connections by in/out interface, list the available
  interfaces in the system, only if the selected node is local.
2022-09-21 16:01:32 +02:00
Gustavo Iñiguez Goia
fc96b24000
sys fw: added more meta options (uid,gid,l4proto..
Added more options to match connections against packets metainformation:
 skuid, skgid, l4proto, protocol

Fixed setting mark on packets via meta (although it results in an error
-> [invalid type]).
2022-09-16 14:01:41 +02:00
Gustavo Iñiguez Goia
ec83f83752
Merge pull request #740 from 0xphk/master
sys firewall: fixed wrong wireguard protocol
2022-09-15 16:52:52 +02:00
phk
cb19716ebc sys firewall: fixed wrong wireguard protocol
Changed 'tcp' to 'udp' to make wireguard rule work
2022-09-15 15:36:49 +02:00
Gustavo Iñiguez Goia
7fcf864499
ui, fw: allow to configure rate limits
For example to ratelimit downloads to 1MB/s (using the GUI):

Source Port: 443
Limit: 1/mbytes/second
Direction: IN
Action: DROP
2022-09-15 00:30:29 +02:00
Gustavo Iñiguez Goia
b8d6ead363
sys firewall: fixed matching ip protocols
Fixed using: ip protocol ah (or tcp, udp, gre, l2tp, etc)
2022-09-14 22:03:14 +02:00
Gustavo Iñiguez Goia
25bd8251be
fixed deadlock stopping ebpf monitor method
+ init events streamer as soon as possible.

Closes #739
2022-09-14 14:37:16 +02:00
Gustavo Iñiguez Goia
09ec8692f7
firewall: fixed adding rules with IPs
Instead of "ip daddr 1.1.1.1", "nh,128,32 16843009" was added.

Reproduced on ubuntu 20/22, manjaro, with different kernels (5.1x)
2022-09-13 21:58:52 +02:00
Gustavo Iñiguez Goia
93260177b3
ui, fw: fixed missing var 2022-09-12 22:36:07 +02:00
Gustavo Iñiguez Goia
97b141e947
ui, fw: allow to set quotas, more log options
- Allow to set quotas on connections.
  (For example: drop packets if transmitted bytes to port 443 and
  ip 1.2.3.4 is over 1GB.)
- Allow to configure log levels.
- Better errors when adding/editing rules.
2022-09-12 21:37:42 +02:00
Gustavo Iñiguez Goia
5c7b1c1558
fw: allow to set rules log level
Allow to set log level in (system) firewall rules.

  "Statement": {
   "Op": "",
   "Name": "log",
   "Values": [
     {
       "Key": "prefix",
       "Value": "invalid-in-packet"
     },
     {
       "Key": "level",
       "Value": "emerg"
     }
   ]
  }

https://github.com/evilsocket/opensnitch/wiki/System-rules#examples-of-supported-statements
2022-09-12 01:14:39 +02:00
Gustavo Iñiguez Goia
f3d1bae603
ui: fixed displaying delete button
Closes #724
2022-09-10 22:59:43 +02:00
Gustavo Iñiguez Goia
2a56b3cb46 ui,fw: set rules protocol when loading a rule
- When loading a rule, set the protocol of the rule.
- Do not verify if a port is integer, if it contains , or -.
2022-09-10 21:10:34 +02:00
Gustavo Iñiguez Goia
c28643d3fa ui, fw: allow to add/edit complex rules
Now you can configure complex firewall rules, for example:

tcp dst port 22 ip daddr 1.2.3.4 log prefix "ssh" accept

Closes #731
2022-09-10 16:49:29 +02:00
Gustavo Iñiguez Goia
f0a9d02e94 fw: fixed adding daddr/saddr to inet tables
If the table family where we're adding a daddr/saddr is inet, we need to
specify the protocol of the IP being added.

Otherwise, listing the rules they appear as:
@nh,128,32 3232235777 accept
instead of: daddr 192.168.1.111 accept

seen here: #704
2022-07-30 00:25:28 +02:00
Gustavo Iñiguez Goia
96a031ad12 ui,rules: improved regular expressions
Up until now we detected automatically if a rule was a regular
expression. But if the path or cmdline of a process had certain
characters (backslash), it was not easy to autodetect it, because the
backslash in particular is sent and received encoded (\\).

With this change the user will have to mark manually if the
path/cmdline of a process is a regular expression or no.

Closes #706
2022-07-21 17:53:05 +02:00
Gustavo Iñiguez Goia
77f52574fc Bump versions to v1.6.0rc2 2022-07-14 12:29:02 +02:00
Gustavo Iñiguez Goia
fc3d7382de ebpf: get cmdline arguments from kernel
- Get cmdline arguments from kernel along with the absolute path to the
  binary.
  If the cmdline has more than 20 arguments, or one of the arguments is
  longer than 256 bytes, get it from ProcFS.
- Improved stopping ebpf monitor method.
2022-07-12 15:40:01 +02:00
Gustavo Iñiguez Goia
7557faf3a6 prevent crash resolving /proc/self/exe 2022-07-09 22:17:17 +02:00
Gustavo Iñiguez Goia
45212db908 clean path of a process if it's needed
Sometimes the path of a path has " (deleted)" added or the path is
reported as "/proc/self/exe" which is a link and needs to be resolved.

 -> #694
2022-07-08 21:59:11 +02:00
Gustavo Iñiguez Goia
72483bdcde improved process detection
latest changes to detect short-lived processes caused undesired
behaviour (#694)

Closes #685
2022-07-08 17:15:57 +02:00
Gustavo Iñiguez Goia
c9650cbc49 update_adlists.sh updated
set output directory to /etc/opensnitchd/blocklists/domains/
2022-07-07 21:48:20 +02:00
Gustavo Iñiguez Goia
c3a356bdb8 update_adlists.sh updated
- TOP_EU_US_Ads_Trackers_HOST list is no longer available, and the new
  list is not in hosts format.
- curben malware list moved to malware-filter.gitlab.io
- some improvements

Closes #695
2022-07-07 13:18:15 +02:00
Gustavo Iñiguez Goia
868974f593 don't send events to gui is nolog is true
part of 6666eb8ccf
2022-07-06 16:26:28 +02:00
Gustavo Iñiguez Goia
f289d94677 ui, pop-ups: reverted change to adjust window size
Closes #693
2022-07-06 12:37:30 +02:00
Gustavo Iñiguez Goia
560f5c3fd9 ui, pop-ups: improved actions logic 2022-07-05 15:58:56 +02:00
Gustavo Iñiguez Goia
521f97bf94 ui,pop-ups: added reject option
Added option to reject new connections from the pop-ups:

- Configurable from the preferences, Default Action option.
- By default there're 2 buttons as always: Deny - Allow
  - If the Default Action is Reject: Reject - Allow
- The Deny button now has an activable menu, from where you can select
  non-default options (ex: reject connections while the Default Action
  is Allow/Deny).

Closes #613 #571
2022-07-04 23:45:50 +02:00