Commit graph

524 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
ba770fdf0d audit: insert new processes at the top of the list.
And avoid to sort the list of known processes every time we add a new
one.

Code formatted and documented.
2020-03-07 00:23:33 +01:00
Gustavo Iñiguez Goia
ef04667cdb cache of pids: insert new processes at the top of the list
code formatted and documented a little bit.
2020-03-06 23:23:16 +01:00
Gustavo Iñiguez Goia
1c04e95fdc audit: search for a process using the ppid
auditd events provides the parent pid of a process which has created
a connection. If we don't find the socket inode under the pid of the
process, use the ppid.

This is normally the case when systemd-* spawns a new process which
creates a new connection.
2020-03-06 23:21:24 +01:00
Gustavo Iñiguez Goia
9e6860fe63 formatted connman/ 2020-03-06 21:44:47 +01:00
Gustavo Iñiguez Goia
6e3336258c firewall/rules.go formatted and documented. 2020-03-06 21:28:22 +01:00
Gustavo Iñiguez Goia
7cbcc4d736 reformatted netlink/ sources, fixed typo 2020-03-06 21:02:34 +01:00
Gustavo Iñiguez Goia
63b6ba6f94 added description for netlink/GetSocketInfo 2020-03-06 20:32:19 +01:00
Gustavo Iñiguez Goia
2137a395d1 audit: Fixed 32bits socket monitoring. 2020-03-05 20:57:37 +01:00
Gustavo Iñiguez Goia
461118e321 replace ReplaceAll() by Replace() to compile with go <= 11 2020-03-05 19:39:35 +01:00
Gustavo Iñiguez Goia
010a657f64 audit: get rid of mozilla/libaudit-go
mozilla/libaudit-go does not support i386/arm/etc, and we were using it
only for parsing audit messages.

So do not use it and parse raw messages directly. WIP.
2020-03-05 01:54:27 +01:00
Gustavo Iñiguez Goia
db22e83de1 pids cache: delete from cache non existent PIDs 2020-03-04 01:56:48 +01:00
Gustavo Iñiguez Goia
7ef15faf62 cache of known pids: update lastSeen field when we have a match 2020-03-04 01:31:36 +01:00
Gustavo Iñiguez Goia
3d6beb5ec3 Added new processes monitor method: audit
Use auditd events to keep a list of PIDs which open sockets, reading
them from the audisp af_unix plugin.

- Install auditd and audisp-plugins
- Enable the af_unix plugin (/etc/audisp-plugin/af_unix, active = yes)
- Start opensnitch with -process-monitor-method audit.

If the choosen method is audit but it's not active or not installed,
it'll fallback to /proc anyway.

If it's properly configured, a debug trace will be written to the logs:
"PID found via audit events ..."
2020-03-03 23:51:25 +01:00
Gustavo Iñiguez Goia
4407b82346 deb package: added logrotate file, lower daemon log level
Added a logrotate file to limit the size of the log and rotate as
needeed.
Changed daemon log level to important.
2020-03-01 00:40:58 +01:00
Gustavo Iñiguez Goia
6a82cdbac1 Allow to select which log level to use
Let the user choose which level log to use. For now it must be set
manually and when starting the daemon.
2020-02-28 10:24:08 +01:00
Gustavo Iñiguez Goia
c5a3fb5132 Allow to select what process search method to use
Until now OpenSnitch used ftrace(debugfs) to search for running
processes (PIDs) and obtain the process path.

On some systems, this filesystem is not mounted or available, so we have
to rely on /proc.

After several weeks of use, I think that it's faster and more accurate
the 2nd method, search pids/cmdlines in /proc. So we offer the user to
choose which one to use.
2020-02-26 19:13:42 +01:00
Gustavo Iñiguez Goia
fe8789526a Apply default action in case of communication failure with the server
If we can't communicate with the server (UI), apply the default
configured action. For example, if the UI is doing too much work and it
reaches the timeout, or if there's a programming error (python exception
for instance).
2020-02-26 09:53:48 +01:00
Gustavo Iñiguez Goia
f296e0b72f added more screenshots 2020-02-25 22:39:32 +01:00
Gustavo Iñiguez Goia
aaf4c449a0 Updated github action build name 2020-02-25 22:23:09 +01:00
Gustavo Iñiguez Goia
331b40570b
Update README.md 2020-02-25 01:52:37 +01:00
Gustavo Iñiguez Goia
9ff47bda54
Update README.md 2020-02-25 01:52:01 +01:00
Gustavo Iñiguez Goia
9d0f7c27ca
Update go.yml 2020-02-25 01:41:18 +01:00
Gustavo Iñiguez Goia
aad5eb8a48
Update go.yml 2020-02-25 01:39:24 +01:00
Gustavo Iñiguez Goia
e617dd834f
Update go.yml 2020-02-25 01:36:04 +01:00
Gustavo Iñiguez Goia
de956b1bf4 Fixed DNS responses firewall rule not deleted on exit
Sometimes the INPUT rule for to queue DNS responses was not deleted.
The code has also been reorganized.

And a minor tweak to make an if{} more idiomatic.
2020-02-25 01:30:24 +01:00
Gustavo Iñiguez Goia
2a85a27685
Update go.yml 2020-02-25 00:26:50 +01:00
Gustavo Iñiguez Goia
7cb0a25119 Bump version to v1.0.0rc5 2020-02-24 20:07:22 +01:00
Gustavo Iñiguez Goia
4abe3ee4cc
Update go.yml 2020-02-24 20:03:04 +01:00
Gustavo Iñiguez Goia
2b1cfcd6ef Merged UI fixes. 2020-02-24 20:00:33 +01:00
Gustavo Iñiguez Goia
a34f215252 UI deb package: added qt sqlite lib dependency
On LinuxMint 19.3 it was not installed as part of the other packages,
so the UI couldn't load the driver.
2020-02-24 19:53:08 +01:00
Gustavo Iñiguez Goia
4479bb5155 UI: exit cleanly if there's no QtSql driver available 2020-02-24 19:39:34 +01:00
Gustavo Iñiguez Goia
be89865cd1 fixed UI autostart on Cinnamon 2020-02-24 10:18:44 +01:00
Gustavo Iñiguez Goia
d3eadd0edf
Update README.md 2020-02-23 23:02:33 +01:00
Gustavo Iñiguez Goia
13f4670be0
Update README.md 2020-02-23 23:01:45 +01:00
Gustavo Iñiguez Goia
f114439dba
Update go.yml 2020-02-23 16:16:17 +01:00
Gustavo Iñiguez Goia
8719286853
Update go.yml 2020-02-23 16:11:58 +01:00
Gustavo Iñiguez Goia
ceb5290b13
Create go.yml 2020-02-23 08:52:48 +01:00
Gustavo Iñiguez Goia
cad5339695 Fixed typo in ui/debian/postinst 2020-02-23 01:17:39 +01:00
Gustavo Iñiguez Goia
0f171f87d4 UI deb package improvements
* Purge files when using apt remove --purge
* Display a message to uninstall installed pkgs from pypi when invoking
apt remove
* link autostart .desktop file to /usr/share/applications instead of
copying it
2020-02-22 17:22:28 +01:00
Gustavo Iñiguez Goia
e3b0287e2e Merge UI fixes and enhancements from ui2.0 2020-02-22 01:00:24 +01:00
Gustavo Iñiguez Goia
401329171a Workaround for crashes parsing .desktop files
We parse .desktop files to get the icon of a program, but sometimes we
can't parse the Name translation due to unicode encoding problems.

Besides, on some distributions there're .desktop files without Exec=
line, so we also crash.

With this workaround we miss (mainly) the icon of a program, but at
least we won't crash.

It should help with #5.
2020-02-22 00:53:10 +01:00
Gustavo Iñiguez Goia
c4a9a21afa fixed HighDpi scaling
This should fix the warning message:
"Attribute Qt::AA_EnableHighDpiScaling must be set before
QCoreApplication is created."

Which should fix the small fonts reported by some users.
We may also need AA_UseHighDpiPixmaps.
2020-02-22 00:48:19 +01:00
Gustavo Iñiguez Goia
2c7472f06d firewall: check rules every 5s
Every 5s check if our rules are loaded, and if they aren't, add them
again.
2020-02-22 00:27:35 +01:00
Gustavo Iñiguez Goia
7f2f40b64d UI, stats: display dst_port on process details view 2020-02-21 00:57:11 +01:00
Gustavo Iñiguez Goia
8b579ece28 procmon: split cache functionality to a new file 2020-02-20 09:58:19 +01:00
Gustavo Iñiguez Goia
848f72de68 Fixed netlink socket querying
man sock_diag:
"If the nlmsg_flags field of the struct nlmsghdr header has the
NLM_F_DUMP flag set, it means that a list of sockets is being
requested; otherwise it is a query about an individual socket."
2020-02-20 01:45:02 +01:00
Gustavo Iñiguez Goia
189cffb00f Merge UI crash fixes and improvements 2020-02-20 00:27:45 +01:00
Gustavo Iñiguez Goia
8d88a4c13a Fixed advanced button height on some systems
Like Ubuntu Mate 16.04
2020-02-20 00:23:32 +01:00
Gustavo Iñiguez Goia
6ae1857538 Fixed prompt dialog exception and improved backward compatibility
Improved compatibility with old regex lib versions.
Fixed exception.
2020-02-19 23:14:25 +01:00
Gustavo Iñiguez Goia
b409eca0ed Fixed UI crash when configuring high dpi scaling on some systems
On LinuxMint18 even with a compatible PyQt lib, it crashes, so just
don't set this option.
2020-02-19 01:04:58 +01:00