Commit graph

13 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
1a063d10e2
tests: added new sys fw tests
- Added counter tests.
- Added ethernet addresses tests.

Added comments to some functions.
2023-07-07 00:46:09 +02:00
Gustavo Iñiguez Goia
344819eb30
sys,fw: export more internal funcs 2023-07-06 14:09:54 +02:00
Gustavo Iñiguez Goia
d474e7f57a
sys,fw: export some internal utils. 2023-07-06 13:36:57 +02:00
Gustavo Iñiguez Goia
9f71c15e57
sys,fw: fixed race condition creating system rules
Hard to reproduce, but not impossible
2023-05-24 14:26:58 +02:00
Gustavo Iñiguez Goia
6c456aefba
sys fw: fixed race condition reloading rules 2023-05-19 01:35:20 +02:00
Gustavo Iñiguez Goia
b546fb9e7a
Bump nftables-go lib version to 0.1.0 2023-01-22 14:40:08 +01:00
Gustavo Iñiguez Goia
9dfcca295a
fixed adding interception chains on old kernels (4.x) 2023-01-07 22:28:52 +01:00
Gustavo Iñiguez Goia
d31c4e86bf
fixed adding interception rule on some kernels
On some kernels (4.19), adding the interception rule to the
inet-mangle-output chain failed.

According to the nftables wiki, the mangle-output chain have (must?) to
be of type Route:
"route type: ... mangle table ... for the output hook (for other
hooks use type filter instead)."

https://wiki.nftables.org/wiki-nftables/index.php/Configuring_chains#Base_chain_types

So if we fail adding the interception rule, we retry it with type Filter
instead of Route.

Related: #781 , ced9a24
2023-01-04 21:44:46 +01:00
Gustavo Iñiguez Goia
05e63e97a7
sys fw: improved chains creation
This is part of latest commit ced9a24933

 - When reusing a chain, configure the new policy.
 - Don't backup existing rules when reloading the configuration.
2022-12-23 00:50:22 +01:00
Gustavo Iñiguez Goia
ced9a24933
nftables: fixed adding interception rules
On some systems after disabling and enabling the interception, the
DNS rule was not being re-added, with error: chain already exists.

When the interception is disabled, we firstly remove the rules,
and secondly if the chain and table is empty we try to remove them
as well.

However, on some systems even if "nft list ruleset" didn't list the
chains to hold our rules, it failed with error "already exists".

Before adding a chain now we check if it exists, and if it does we
reuse it.

Closes #781
2022-12-22 00:19:16 +01:00
Gustavo Iñiguez Goia
23b1a6b75e
fw: restore chains policy where applicable
If the user configures chains' policy to Drop, we need to restore it to
Accept when exiting, otherwise we could block connections
unintentionally.
2022-12-11 14:15:17 +01:00
Gustavo Iñiguez Goia
2e2f1768f2
improved errors printing 2022-12-11 11:41:47 +01:00
Gustavo Iñiguez Goia
d9e0c59158
Allow to configure firewall rules from the GUI (#660)
* Allow to configure firewall rules from the GUI (WIP)

New features:
- Configure and list system firewall rules from the GUI (nftables).
- Configure chains' policies.
- Add simple rules to allow incoming ports.
- Add simple rules to exclude apps (ports) from being intercepted.

This feature is only available for nftables. iptables is still supported,
you can add rules to the configuration file and they'll be loaded, but
you can't configure them from the GUI.

More information: #592
2022-05-03 22:05:12 +02:00