Commit graph

894 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
8af290e970 Bump versions to 1.4.0rc1 2021-03-26 00:59:16 +01:00
Gustavo Iñiguez Goia
6048b0ef64 more cache improvements
- don't clean cache by number of items.
- clean inodes from cache every 2' if the descriptor symlink doesn't exist
  anymore, or if the lastSeen time is more than 5 minutes.
- launch cache cleaners before start a new process monitoring method,
  and start it only once for the life time of the daemon.
- do not store in cache the Time objects, only the nanoseconds of
  the last updated time.
- if the inode of a connection is found in cache, reorder the
  descriptors to push the descritptor to the top of the list.
  Also add cached the inode.

It turns out that when a new connection is about to be established,
when the process resolves the domain, the same inode is used to open the
tcp connection to the target. So if it's cached we save CPU cycles.

This also occurs when we block a connection and the process retries it,
or when a connection timeouts and the process retries it
(telnet 1.1.1.1).
2021-03-24 01:16:47 +01:00
Gustavo Iñiguez Goia
7b9a57b788 added -version cli option
closes #374
2021-03-22 17:51:31 +01:00
gnuhead-chieb
f8607d8619
[Locale]Add Japanese Translation (#375)
Added Japanese Translation
2021-03-21 22:23:47 +01:00
Gustavo Iñiguez Goia
630e3717dd auditd: cache new Proc objects 2021-03-21 21:55:59 +01: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
Flávio Costa
7cd16c6f3d
Update Brazilian Portuguese translation (#372) 2021-03-20 10:42:37 +01:00
Gustavo Iñiguez Goia
1a61a2dca9 cache improvements
- update the descriptors/inodes of a PID when it's found in cache.
- when a descriptor/inode is found in cache, push it to the top
  of the descriptors list. The next time it's found in cache it'll be in
  the 1st position of the list, saving CPU time.
- added test cases and benchmark helpers to help analyzing performance.
2021-03-19 19:05:45 +01:00
Gustavo Iñiguez Goia
b29283805e updated spanish translation 2021-03-19 13:28:34 +01:00
Gustavo Iñiguez Goia
7b7e110537
Merge pull request #352 from tioguda/translation
Update Brazilian Portuguese translation
2021-03-18 00:31:14 +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
0d2e8b56ea added operator tests
fixed lists operator tests.
added domain lists tests.
2021-03-05 01:10:01 +01:00
Gustavo Iñiguez Goia
408150073a fix deadlock
closes #365
2021-03-04 12:10:53 +01:00
Gustavo Iñiguez Goia
0362a0b780 ui, pop-ups: added app description, better icon discovery
Added the description of an app to the pop-ups, to help users know
what an application is or does.

The discovery of app icons has been improved for those edge cases where
the system is not properly configured and we were not able to get the
icon of the app.
2021-03-03 23:57:25 +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
1528fabfca
Merge pull request #362 from themighty1/master
flush conntrack at start
2021-02-28 15:23:15 +01:00
themighty1
616681e44d flush conntrack at start 2021-02-28 15:21:07 +03:00
Gustavo Iñiguez Goia
0b978c0c1f
Merge pull request #361 from themighty1/master
clean up the obsolete "drop marked"
2021-02-28 10:01:18 +01:00
themighty1
b5bf4edec7 clean up the obsolete "drop marked" 2021-02-28 11:30:26 +03:00
Gustavo Iñiguez Goia
1d277efd01 updated operator and loader tests 2021-02-27 01:56:49 +01:00
Gustavo Iñiguez Goia
44e8561e0c load/reload rules from disk one by one
Any rule changed on disk caused reloading of all rules, usually
up to three times. This caused some problems.

- Don't compile Operators if the rule is disabled.
- Empty lists of domains if the user disables the rule.
- Delete rule from disk if the duration is not Always anymore.
2021-02-27 01:39:04 +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
Gustavo Iñiguez Goia
26671ded24 added support for list of domains
Initial support to filter connections using lists of domains.

The lists must be in hosts format:
- 0.0.0.0 www.domain.com
- 127.0.0.1 www.domain.com

From the rules editor, create a new rule, and select
[x] To this lists of domains

Select a directory with files in hosts format, select [x] Priority rule,
select [x] Deny and click on Apply.

An example of a list in hosts format:
https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt

Note: you can also add a list of domains to allow, not only domains to
block.

TODOs:
- support for URLs besides directories (local lists).
- support for scheduled updates of the above URLs.

related #298
2021-02-25 13:38:48 +01:00
Gustavo Iñiguez Goia
fab5d97cd8
Merge pull request #356 from themighty1/upstreammaster
github action fix
2021-02-23 16:26:32 +01:00
themighty1
9b0f400c5e github action fix 2021-02-23 18:11:27 +03:00
Gustavo Iñiguez Goia
484be33b08
Merge pull request #346 from themighty1/master
makefile:
2021-02-22 16:36:55 +01:00
Gustavo Iñiguez Goia
a325876641 improved connection parsing
Sometimes when querying the kernel for a given connection, the inode of
the connection is 0, i.e.: invalid (or not yet valid).

In these cases we search for the connection in /proc/net/. It turns out
that some connections are found in netstat but the inode is still 0, and
we were accepting them erronously.

As a result, when looking for the inode under /proc we didn't find it,
so an "Unknown process" dialog was shown to the user.

Discarding this type of connections avoids unknown process dialogs when
using Epiphany in particular. It retries to establish the connection
several times, and finally we're able to find the PID of the process.
2021-02-20 23:53:22 +01:00
Gustavo Iñiguez Goia
0dbd8e00ee
Merge pull request #355 from themighty1/upstreammaster
wait for success when sending packet to chan, don't error out after f…
2021-02-19 12:47:14 +01:00
themighty1
6f6e91ac41 wait for success when sending packet to chan, don't error out after first failed attempt.
When testing this patch under a heavy load of 300 new connections per second running for 12 hours, I saw a few timeouts.
This means that there are legitimate cases when sending the packet to the channel will not go through
no matter how long we wait.
However, compared to the old behavior, the amount of dropped packets decreased by a factor of 100x.

The value of timeout is chosen to be 1 millisecond, because it feels reasonable that if after so long the packet did
not go through, it is not due to a congested channel but due to some other error which will not go away even if we wait longer.
2021-02-19 09:01:01 +03:00
Gustavo Iñiguez Goia
b066b11c47 improved complex rules
Every rule has an entry point besides a constructor, which configures
all it needs to match connections, based on user defined criteria (ip,
regexp, etc).

This only needs to be done the first time we load a rule, because the
fields of a rule are static. However for rules of type "lists" we were
iniatializing each rule of this type once per connection that it
matched.
2021-02-19 01:03:45 +01:00
Gustavo Iñiguez Goia
72a2162577
Merge pull request #354 from themighty1/upstreammaster
do not block connection processing when GUI popup is active.
2021-02-18 20:50:16 +01:00
themighty1
53bf4f7925 do not block connection processing when GUI popup is active. 2021-02-18 19:43:27 +03:00
Gustavo Iñiguez Goia
aee92d8d0e
Merge pull request #353 from themighty1/fixlogging
fix logging when flag is passed on command line
2021-02-16 21:11:08 +01:00
themighty1
c9ae47fe01 fix logging when flag is passed on command line 2021-02-16 21:19:54 +03:00
tioguda
cf67387ca0
Fix Brazilian Portuguese translation 2021-02-16 05:52:51 -03:00
tioguda
ba0e068656
Update Brazilian Portuguese translation 2021-02-15 23:05:26 -03:00
Gustavo Iñiguez Goia
8a204c081d ui, db: allow to save events to disk
Added option to save events to disk, instead on memory.
2021-02-16 01:25:09 +01:00
Gustavo Iñiguez Goia
2d57c00df7
Merge pull request #350 from xenDE/patch-1
fixed urls in readme
2021-02-15 11:11:00 +01:00
xenDE
84dac012da
fixed urls
changed /gustavo-iniguez-goya/ to /evilsocket/
2021-02-15 11:03:18 +01:00
Gustavo Iñiguez Goia
510a351053 ui, rules: replace rules received from the daemon
We added UPSERTS, to update the time of a rule when a connection matched
that rule.

However UPSERTS in SQLite weren't introduced until v3.24.x, thus it
causes errors on older versions (like the ones shipped with Ubuntu
16/18).

On the other hand, we need to replace the rules once we receive them
from the daemon, to reflect on the GUI any change made on the rules by hand.

More info: #344
2021-02-13 19:55:47 +01:00
Gustavo Iñiguez Goia
f0384fb7e5 deb: fixed debian/changelog 2021-02-13 18:19:11 +01:00
Gustavo Iñiguez Goia
2599c784ac
Merge pull request #347 from themighty1/go_vet_fixes
minor fixes to prevent go vet from complaining
2021-02-13 18:09:50 +01:00
themighty1
1d23e73566
test for activepids.go (#345)
* test for activepids.go

* test file

Co-authored-by: themighty1 <you@example.com>
2021-02-13 18:07:51 +01:00
themighty1
41172b65e5 minor fixes to prevent go vet from complaining 2021-02-13 19:18:38 +03: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
5e1a398bc6
Merge pull request #341 from tioguda/translation
Update Brazilian Portuguese translation
2021-02-10 21:58:22 +01:00
Gustavo Iñiguez Goia
d33cf8b8ba Bump version to 1.3.6 2021-02-10 20:17:02 +01:00
Gustavo Iñiguez Goia
7995d7b5db ui, pop-up: fixed expanding labels
In some KDE versions, the cmdline and args labels of a process were not
being expanded properly.
2021-02-10 01:08:28 +01:00
Gustavo Iñiguez Goia
2d907142cd ui: added pause state icon
When the user pauses the interception from the events window, update the
systray icon as well. Otherwise it looks like the interception is on.

- #339
2021-02-08 16:41:52 +01:00