Iptables duplicate work for each family and is using a socket protocol which is far too static. Xtables2 is an ongoing effort to evolve the packet filter.
It aims at providing finer frained modification (and not the whole ruleset modification).
rule packing: increase cache hit.
family independent: no more IPv4 and IPv6 specific code. Only the hook remains specific as they are dependant of core network.
xt extension support
atomic replace support
xtables syntax is quite similar but not the same. libxtadm is a high-level library for ruleset inspection/manipulation.
netsniff-ng, a high-performance zero-copy analyzer, pcap capturing and replaying tool
trafgen, a high-performance zero-copy network traffic generator
mausezahn, a packet generator and analyzer for HW/SW appliances with a Cisco-CLI
bpfc, a Berkeley Packet Filter (BPF) compiler with Linux extensions
ifpps, a top-like kernel networking and system statistics tool
flowtop, a top-like netfilter connection tracking tool
curvetun, a lightweight multiuser IP tunnel based on elliptic curve cryptography
astraceroute, an autonomous system (AS) trace route utility
netsniff-ng can be used to capture with advanced option like using a dedicated CPU or using a BPF filter compiled via bpfc instead of a tcpdump like expression.
trafgen can used to generate high speed traffic, using multiple CPUs, and complex configuration/setup even including fuzzing.
A description of the packet can be given where each element is built using different functions.
It can even be combined with tc (for example netem to simulate specific network condition).
The future include to find a way to utilize multicore efficiently with packet_fanout and disk writing.
ConnMan is a connection manager which integrate all critical networking components. It provides a smart D-Bus API to develop an User Interface. It is plugin oriented and all different network stacks are implemented in different modules.
Connection sharing (aka tethering) is using Netfilter to setup NAT masquerading. So it is a simple usage.
Switching to nftables
Application connectivity is a more advanced part involving Netfilter as it makes a use of statistics and differenciated routing. For example, in a car, service data must be sent to manufacturer operator and not on the owner network.
To do so a session system has been implemented. Application can be modified to open a session to ConnMan. This allow to define a per-session policy for routing and accounting.
ConnMan team wanted to use a C API to do rules modification but this was difficult with iptables and xtables. This is not an official API so it is subject to bugs and change.
ConnMan team has then switch to nftables and is currently working on stabilizing nftables to ensure the acceptation of the project and of the maintainability of their solution in the long time. This work is not yet upstream but there is good chance it will be accepted.
Centralized firewall design does not scale well when dealing with a lot of servers. It begins to collapse after a few thousands rules.
Furthermore, to be able to have an application A to connect to server B, it would take a workflow and possibly 3 weeks to get the opening.
From Service Oriented Architecture to Service Oriented Security
Service are autonomous. They call each other using a standard protocol. The architecture is described by a list of dependencies between services.
You can then specify security via things like ACCEPT Caching TO Frontend ON PORT 80.
But this force you to do provisioning each time a server start.
Using Chef for firewall provisioning
Chef is an open source automation server that is queried by server to get information about their configuration.
Chef maintains a centralized database of all services and so it can derived from that the security policy. So if we manage to express the contraint in term of Netfilter rules, we will be able to build a firewall policy.
AFW is using a service oriented syntax where object like destination can be specified by doing a Chef search. Thus, each time Chef is launched, the object get reevaluated and the filtering rules is updated to the current state of the network.
Custom rules can be added using traditional iptables syntax. AFW is writing outbound rules using the owner target. This allow to define a policy per service and this policy can be easily searched by the developper by simply looking user policy.
The JSON document pushed to the chef node contains everything and it can be modified by the server. So it is possible for a server to trigger opening of ports by changing some of its parameters. A solution is to split chef in a chef for configuration and a chef for policy.
nftable is a kernel packet filtering framework to replaces iptables. It brings no changes in the core (conntrack, hooks).
Match logic is changed: you fetch keys and once you have your key set, you make operation on them. Advanced and specialized matchs are built upon this system.
nftables vs iptables
In iptables, extension were coded in separate files and they must be put in iptables source tree. To act, they must modify on a binary array storing the ruleset and injecting it back to the kernel. So every update involve a full download and upload of the whole ruleset.
nftables is working on a message based basis (exchanged via netlink) and thus allow better handling of incremental modification.
nftables will provide a high level library which can be used to manipulate ruleset in dedicated tools.
From userspace, backward compatibility is here with utilities fully compatible iptables and ip6tables. Even script wil not have been changed
But there is some new things brought by the change:
event notifications: can have a software listening to rules change and logging the change. This is an interesting feature as tracability is often asked in secure environment
Better incremental rule update support
Enable or disable the chains per table you want (will provide performance optimisation)
There is work in progress on a new utility nft. It will provide a new syntax that will allow to do more efficient matching. It will be possible to form couple of keys and do high speed matching on them.