Commit graph

49 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
3a3363cb9a rules: delete file from disk if Duration changes
If the user changed the Duration of a rule, from Always to !Always
(temporary), we were not deleting from disk the file of the old
rule.
2021-01-04 12:48:05 +01:00
themighty1
078faa9fda
unittest: test live reloading of rules (#317)
* unittest: test live reloading of rules

* data files for the previous commit

* tests: move files under /testdata; give better names to rules

Co-authored-by: themighty1 <themighty1>
2020-12-28 12:59:29 +01:00
Gustavo Iñiguez Goia
9b035ca66e added unit tests for process parsing and rules 2020-12-19 19:31:09 +01:00
Gustavo Iñiguez Goia
e59133beb2 rules: skip checking not enabled rules 2020-12-18 16:42:34 +01:00
Gustavo Iñiguez Goia
4443673ed1 fixed how we check rules
- Rules are checked in alphabetical order.
- Deny and Priority rules must take precedence.
- If a rule matches and it's Allow-NoPriority, then return the rule.
- Otherwise we'll return nil.
2020-12-15 16:09:28 +01:00
Gustavo Iñiguez Goia
b6cbc6769e fixed rules Enabled check 2020-12-13 11:50:58 +01:00
Gustavo Iñiguez Goia
719c906267 fixed regexp rules when using case-sensitive strings 2020-12-11 22:03:00 +01:00
Gustavo Iñiguez Goia
d47e75d76f fixed filtering by dst network, fixed regression
- Fixed complex rules.
- Fixed filtering by destination network.
2020-12-10 23:09:24 +01:00
Gustavo Iñiguez Goia
e13015ce67 updated import paths 2020-12-09 18:18:42 +01:00
Gustavo Iñiguez Goia
1f415a5799 added option to filter by destination network
Now you can filter by destination network, for example:
- 127.0.0.1/8
- 192.168.1.0/24

This will ease to solve the request #89 .

Some common network ranges have also been added so you can select them
from a combo box. More info #73.

Added process.id operator operand for future use, in order to filter by
PID.
2020-12-04 01:11:47 +01:00
Gustavo Iñiguez Goia
820a6f2930 added option to set priority on the rules
If a rule has the priority flag set, no others rules will be checked.
So if you name the rule as 000-allow-xx and set the priority flag, the
rule wil lbe the only one that will be checked if it matches a
connection.

See #36 to know more on this feature.
2020-10-23 00:02:16 +02:00
Gustavo Iñiguez Goia
c2ee61076d sort rules by name
Sort rules by name, so they're checked in alphabetical order.

This way, you can place deny rules at the top of the list to get better
performance, since it won't check the rest of the rules.

Discussion: #36
2020-10-21 08:13:41 +02:00
Gustavo Iñiguez Goia
4949ab1e4e allow to filter connections by protocol
Added option to filter connections by protocol.

Just add an operand "protocol" as follow:
```
  "operator": {
    "type": "simple",
    "operand": "protocol",
    "sensitive": false,
    "data": "tcp",
    "list": []
  }
```

closes #64
2020-10-20 19:00:00 +02:00
Gustavo Iñiguez Goia
bc70423997 make rules case-insensitive by default
Destination host, process path and process arguments are now case
insensitive by default.

There's a new rule operator field (sensitive), to change this behaviour:
```
      {
        "type": "simple",
        "operand": "dest.host",
        "sensitive": false,
        "data": "opensnitch.io",
        "list": null
      }
```

Rules without this field will evaluate as false by default.

closes #45
2020-10-19 00:25:04 +02:00
Gustavo Iñiguez Goia
6d24c5464c fixed race conditions when manipulating rules 2020-06-20 18:58:59 +02:00
Gustavo Iñiguez Goia
fc2212f073 return better errors if a regexp rule fails to compile
If a regexp rule fails to compile, return the reason instead of a
generic error. It'll help to debug problems.
2020-06-19 18:02:09 +02:00
Gustavo Iñiguez Goia
cfc32cbd1c fixed race condition when deleting a rule 2020-06-14 20:30:19 +02:00
Gustavo Iñiguez Goia
78c0da83c0 increase default timeout to ask for a rule
Explained here: https://github.com/gustavo-iniguez-goya/opensnitch/issues/28#issuecomment-637484501
2020-06-04 00:38:11 +02:00
Gustavo Iñiguez Goia
6bbf3b33be misc: sources formatting 2020-05-30 01:36:43 +02:00
Gustavo Iñiguez Goia
061d7a2ecd ignore malformed rules
Don't exist if a rule is malformed.

Reported by @jonau01 here #17
2020-05-11 10:39:56 +02:00
Gustavo Iñiguez Goia
c44fdf4342 added delete, getall, replace to the rules loader 2020-05-10 17:33:39 +02:00
Gustavo Iñiguez Goia
43898bc4c9 Allow to configure if a rule is enabled or not. 2020-05-10 17:17:05 +02:00
Gustavo Iñiguez Goia
9207465d58 Do not panic if we can't parse a Regex type rule
If for some reason a Regex type rule can not be parsed, opensnitchd
panics and exit. We drop regex.MustCompile() in favor of
regex.Compile(), and in case of failure we just drop the packet.

In either case, the daemon should not panic but it should not received
an invalid rule either, specially from the UI.

Closes #4
2020-02-14 23:15:14 +01:00
Gustavo Iñiguez Goia
cc27be2bae Added initial support for advanced rules (lists)
Probably not the best UI, just the one I came up with.
2019-11-20 10:27:28 +01:00
Gustavo Iñiguez Goia
912f85f5d1 Added more timeout options (30s, 5m, 15m, 30m, 1h)
Added 30s, 5m, 15m, 30m and 1h timeout options to deny or allow
connections.

It helps to avoid repetitive new connection dialogs, while at the same
time it allows you to deny/allow a connection for a short period of time,
and apply the default for the rest.
2019-11-09 01:35:13 +01:00
Gustavo Iñiguez Goia
ce71c383a9 fixed missing funcs declarations and non used var 2019-10-21 00:04:15 +02:00
Gustavo Iñiguez Goia
067d0d8eed Merge branch 'fixed_unwanted_rules_reloading' of github.com:gustavo-iniguez-goya/opensnitch into main 2019-10-20 23:46:04 +02:00
Gustavo Iñiguez Goia
a7e9b5072f project import paths changed 2019-10-20 21:51:35 +02:00
Gustavo Iñiguez Goia
843924fff4 Fixed unwanted rules reloading after adding a new one
fixes #271
2019-08-13 19:19:17 +02:00
Jerzy Kozera
616fef6e83 Add a 'list' rule type 2018-11-21 22:51:33 +01:00
evilsocket
d37cd40495
implemented process.env.ENV_VAR_NAME operand (closes #152) 2018-04-15 16:18:49 +02:00
evilsocket
4e9117c9de
new process.command operand 2018-04-15 14:58:23 +02:00
evilsocket
3a5932de38
misc: small fix or general refactoring i did not bother commenting 2018-04-10 20:04:59 +02:00
evilsocket
026d2fad6f
misc: small fix or general refactoring i did not bother commenting 2018-04-10 14:25:02 +02:00
evilsocket
6803808137
misc: small fix or general refactoring i did not bother commenting 2018-04-10 14:21:29 +02:00
evilsocket
fb5ccb03a3
added the number of loaded rules in the statistics 2018-04-08 17:20:37 +02:00
evilsocket
ead3725bbe
added rules live reloading (closes #128) 2018-04-08 16:36:12 +02:00
evilsocket
8009743d60
when the thc kicks in and you find a better logic, better naming, better design and new ideas 2018-04-08 15:32:20 +02:00
evilsocket
a33c463ffb
support rules with type=regexp (closes #127) 2018-04-07 13:52:25 +02:00
evilsocket
e9902d2761
misc: small fix or general refactoring i did not bother commenting 2018-04-06 18:31:16 +02:00
evilsocket
5cef91e534
better protocol file manag. 2018-04-06 15:58:19 +02:00
evilsocket
b6bdeb7173
misc: small fix or general refactoring i did not bother commenting 2018-04-05 23:56:07 +02:00
evilsocket
8cd2917ba1
misc: small fix or general refactoring i did not bother commenting 2018-04-05 20:16:04 +02:00
evilsocket
aa63a47bc1
misc: small fix or general refactoring i did not bother commenting 2018-04-05 16:37:51 +02:00
evilsocket
50e8be10f3
misc: small fix or general refactoring i did not bother commenting 2018-04-05 16:27:48 +02:00
evilsocket
2bda290899
python ui server 2018-04-05 12:01:33 +02:00
evilsocket
540335056b
misc: small fix or general refactoring i did not bother commenting 2018-04-03 14:51:58 +02:00
evilsocket
08da06acb7
ui service to test and benchmark gRPC IPC 2018-04-02 19:10:42 +02:00
evilsocket
534ec8cd73
misc: small fix or general refactoring i did not bother commenting 2018-04-02 05:25:32 +02:00