Help defining the next system firewall configuration #592
Replies: 4 comments 10 replies
-
One option I would like to have is the rate limit option like with the ufw tool : ufw limit "$SSH_Port"/tcp I can see that it produce these nft rules :
|
Beta Was this translation helpful? Give feedback.
-
status update: Finished:
TODO:
|
Beta Was this translation helpful? Give feedback.
-
I'll publish a branch soon. |
Beta Was this translation helpful? Give feedback.
-
branch published: https://github.com/evilsocket/opensnitch/tree/firewall-policies Please, if you can compile the branch, test it and post any feedback: if it works, if it's intuitive, if it crashes, etc, etc. Prerequisites:
Notes:
I'll document everything on the System-rules wiki page. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
Right now we can add system rules (i.e.: iptables/nftables rules) by adding them to the file
/etc/opensnitchd/system-fw.json
.It has served well to workaround some problems (like allowing ICMP), and for adding extra functionality without having to modify the code (like intercept connections initiated by apps from containers).
The current implementation has 3 downsides: doesn't work with nftables, you cannot create custom chains/targets, and you cannot configure policies (only rules).
In order to solve these problems we need to modify the current json:
by something like:
(This ^ is a working fw configuration that I'm using right now)
With iptables we can simply compose the rule and execute the command. But for nftables I decided to use google/nftables lib, not to depend on the nft binary.The problem is that while the first half and the end of a nftables rule can be easily mapped to json fields (inet -> Family, input ->Table, filter -> Type, ... accept -> Target), mapping aaall the options of each protocol would create a json from the hell.That's why I decided to add the field "Parameters", and parse it by code.Features and doubts:
/etc/opensnitchd/system-fw.d/input.json, ....
Notes:
Important:
In iptables there are several tables (filter, nat) and chains (FORWARD, INPUT...) by default. In nftables, there are no default tables/chains.
[0]Convention is though to use the iptables names by default
[1]iptbles-nft
creates the same rules structure than iptables:But firewalld creates its own structure, so I have no idea what chain/rule will take precedence if it's duplicated on different tables.
[0] https://wiki.debian.org/nftables#What_are_the_major_differences.3F
[1] https://openwrt.org/docs/guide-user/firewall/misc/nftables
Ideas, comments, things that I overlooked...?
Beta Was this translation helpful? Give feedback.
All reactions