So, to keep on the up-to-date good way of doing things, I find out it's not a good things to use iptables anymore. New cool toy seems to be ntftables.
What a pain !
First things first: I'm not very good with network, to stay nice.
Before, I was doing an iptables conf file just sending the rules at each boot while a service was made to be enabled and run theses rules. Was perfectly working, specially my needs were merely to disable everything and allow 80/443/22, plus a few stuff as ICMP.
It seems almost the same with nftables, from what I read on the wiki, but way more sophiscated (and complicated).
From what I understand, it works with at least a configuration files, which can call other modules files with their own sets of rules (DCHP, ICMP, SSH…).
So far as I was used to, there was three type of rules (with IPTables): IN, OUT and FORWARDED.
I tried to follow this page, by doing the magic thinking (while reading a bit what it was adding) and so from the wiki page I have now theses files:
- /etc/nftables.rules
- /etc/nftables.conf.d/:
00-definitions.rules 01-drop-policy.rules 01-icmp.rules 05-dhcp.rules 05-lan-nat.rules 21-ntp.rules 22-ssh.rules
Without modification from the wiki.
Then I try to test the configuration, and the first problem arise:
Code: Select all
Mephistopheles /etc # nft -c -f nftables.rules
Mephistopheles /etc # nft -c -f nftables.conf.d/00-definitions.rules
Mephistopheles /etc # nft -c -f nftables.conf.d/01-drop-policy.rules
Mephistopheles /etc # nft -c -f nftables.conf.d/01-icmp.rules
nftables.conf.d/01-icmp.rules:14:14-26: Error: No such file or directory
ip saddr @trusted_nets icmp type $trusted_icmp_types counter accept
^^^^^^^^^^^^^
nftables.conf.d/01-icmp.rules:15:14-26: Error: No such file or directory
ip daddr @trusted_nets icmp type $trusted_icmp_types counter accept
^^^^^^^^^^^^^
Code: Select all
If this error is printed for every chain of a table definition make sure, that the table's family is available through the kernel. This happens for example if the table uses family inet and the kernel configuration did not enable mixed IPv4 and IPv6 rules (CONFIG_NF_TABLES_INET). Honnestly, that makes me want to drop it, if I need to modify the kernel to allow a firewall to works, in this case with a mix of IPv4 & IPv6…
I am not opening this topic to vent ! But it is really necessary to suffer to block everything and only allow a few services ?
Should I, from what I read, check and, if so, modify my kernel and recompile it ?
Regards,
GASPARD DE RENEFORT Kévin




