Commit graph

9 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
c0d1da20d2
improved rules reloading, cli parameters
- When reloading rules from a path:
   stop existing (domains,ips,regexp) lists monitors, stop rules
   watcher and start watching the new dir for changes, delete existing
   rules from memory, etc.
 - Previously, cli parameters (queue number, log file, etc) were taking
   into account before loading the configuration.
   Now the configuration file is loaded first (default-config.json), and
   if any of the cli parameter has been specified, it'll overwrite the
   loaded configuration from file.

   This means for example that if you use "-process-monitor-method proc",
   and "ebpf" is configured in default-config.json, firstly "ebpf" will
   be configured, and later "proc".

   (-queue-num option for now requires to match config option
   cfg.FwOptions.QueueNumber)
2024-05-22 00:47:54 +02:00
Gustavo Iñiguez Goia
3b6c0412e0 rules: added more lists types to block/allow
- Added lists of IPs and network ranges. One per line. Blank lines or
  lines that start with # are ignored.
- Added lists of domains with regular expressions. One per line.
  Blank lines or lines that start with # are ignored.

Until now you could use regular expressions with the fields
"To this host" or "To this IP", to match multiple domains or IPs.
But if you wanted to use more than 2-3 domains or IPs it was not really
user friendly.

Hopefully we'll be a little more versatile to cover use cases like #461
and #485.
2021-09-18 00:17:58 +02:00
Gustavo Iñiguez Goia
96722ed740 blocklists: sanitize hosts entries
Remove \r\n\t\s from the end of each line of a blocklist.

If the entries of a list had these characters caused to not match
connections and not apply the rule.

closes #429
2021-08-22 23:07:25 +02:00
Gustavo Iñiguez Goia
85802811d1 fixed race condition counting lists of domains
Removed the number of loaded lists of domains, that caused a race
condition and added no value. It was only used for debugging
purposes.
2021-07-07 18:50:30 +02:00
Gustavo Iñiguez Goia
36cdb76113 prevent leaks when reloading domains lists in debug
If the log level was debug, when reloading the lists of domains could
lead to memory leaks.
2021-03-21 21:16:57 +01:00
Gustavo Iñiguez Goia
53904cb70f ignore hidden files when loading lists of domains 2021-03-14 20:23:48 +01:00
Gustavo Iñiguez Goia
c7d93d83a5 improved rules (re)loading
- Delete lists of domains if the rule about to change is of type Lists.
- Monitor the lists of domains, and reload them if they're modified.
- Delete rules from disk when the Duration changes from
  Always (saved on disk) to !Always (temporary).
- After the above operation a fsnotify Remove event is fired. Don't
  delete the rule from memory if it's temporary.
- Rules are only compiled if they're enabled, avoiding unnecessary
  allocations.
2021-03-01 12:41:35 +01:00
Gustavo Iñiguez Goia
4532c2513e delete loaded lists when needed
There're some situations where we need to delete loaded lists:
 - When an enabled rule of type Lists is disabled (after changed on
   disk, or when configured from the GUI).
 - When an enabled rule of type List with an Operator of type Lists is
   disabled.
2021-02-25 20:09:23 +01:00
Gustavo Iñiguez Goia
c9ba858fc5 add missing operator lists file
needed to load lists.
2021-02-25 13:51:36 +01:00