Commit Graph

32 Commits

Author SHA1 Message Date
Lin Jian
f3a93440fb
Merge pull request #285813 from jerrita/nft-precheck-flatten
nixos/nftables: add option for flattening rulesetFile
2024-02-11 10:41:17 +08:00
jerrita
e686847d20
nixos/nftables: add option for flattening rulesetFile
Co-authored-by: Lin Jian <me@linj.tech>
2024-02-05 11:27:16 +08:00
Andreas Stührk
fc6c92faf3 nixos/nftables: remove default systemd dependencies
With DefaultDependencies enabled, systemd adds "After=basic.target" to
service units. `basic.target` has a dependency on `sockets.target`, so
the `nftables` has (amongst others) the following order constraints:

* Before=network-pre.target
* After=sockets.target

Those constraints are often unsatisfiable. For example, `systemd-networkd`
has a dependency `After=network-pre.target`. When a socket unit now uses
`BindToDevice=` on a device managed by `networkd`, a timeout occurs
because `networkd` waits for `network-pre.target`, but
`network-pre.target` depends (through nftables) on `sockets.target`, but
the device to bind the socket to is never brought up, as this would
happen through `networkd`.

This is fixed by removing the implicit dependency on `basic.target`.
2024-01-31 23:26:05 +01:00
Bjørn Forsman
142074c2a8 nixos: fix bad mkEnableOption descriptions
Fix descriptions that don't account for (1) the "Whether to enable"
prefix or (2) the automatically added trailing dot.
2023-10-20 16:22:40 +01:00
Sandro Jäckel
9a85d77152
nixos/networkmanager: default firewallBackend to nftables, remove firewallBackend
Co-authored-by: Florian Klink <flokli@flokli.de>

Co-authored-by: Lin Jian <me@linj.tech>
2023-09-21 16:18:57 +02:00
Maciej Krüger
ca6ed1cc8d
Merge pull request #241680 from 4z3/networking.nftables.checkRulesetRedirects 2023-09-04 22:07:50 +02:00
Maciej Krüger
369e18f1c7
networking/nftables: ensure deletions 2023-08-28 00:44:16 +02:00
Maciej Krüger
6658b3fcf1
networking/nftables: make ruleset+rulesetFile non-exclusive 2023-08-28 00:40:22 +02:00
Maciej Krüger
a1dd69d761
networking/nftables: enable flushRuleset by default if rulset{,File} used 2023-08-28 00:40:21 +02:00
Maciej Krüger
55213b54f0
nixos/nftables: save deletions to file and run them afterwards
Co-authored-by: duament
2023-08-28 00:40:20 +02:00
Maciej Krüger
5f300ad70c
networking/nftables: only delete our tables if flushRuleset is set to false 2023-08-28 00:40:19 +02:00
Maciej Krüger
d5a0826686
networking/nftables: remove no longer relevant conflict warnings 2023-08-28 00:40:18 +02:00
Maciej Krüger
cd3af25932
networking/nftables: enable flushing ruleset for older versions
Co-authored-by: Naïm Favier <n@monade.li>
2023-08-28 00:35:39 +02:00
Maciej Krüger
048ef0d455
networking/nftables: add .tables property and disable ruleset flushing by default
This allows for other unmanaged tables to co-exist peacefully on the os,
by having the nixos-managed tables be re-created atomically and the other
tables will simply be left untouched.
2023-08-28 00:30:28 +02:00
tv
0ab3a1fd78 nixos/nftables: add redirect for /etc/hosts 2023-07-05 13:56:27 +02:00
tv
75e405c156 nixos/nftables: use environment.etc for redirects 2023-07-05 13:56:16 +02:00
tv
9e51ec86e7 nixos/nftables: add checkRulesetRedirects option 2023-07-05 13:55:34 +02:00
Yureka
55da71c10e
nixos/nftables: add checkRuleset option (#216531)
* nixos/nftables: add checkRuleset option

* lkl: 2022-05-18 -> 2023-01-27
2023-03-02 10:28:01 +01:00
Rvfg
a43c7b2a70
nixos/{firewall, nat}: add a nftables based implementation 2022-12-23 00:49:24 +08:00
figsoda
6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
pennae
1013069f52 nixos/*: convert more partially-md option descriptions
this mostly means marking options that use markdown already
appropriately and making a few adjustments so they still render
correctly. notable for nftables we have to transform the md links
because the manpage would not render them correctly otherwise.
2022-08-31 16:32:14 +02:00
pennae
51a11254a7 nixos/*: literalDocBook -> literalMD
no change to rendered output
2022-08-27 19:18:29 +02:00
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Jess Schallenberg
0a16b05ea9
nixos/nftables: Allow use with iptables (#121517)
* nixos/nftables: Allow use with iptables

Since iptables and nftables do not actually conflict with each other, there's no real reason to artificially prevent people from combining them.
In fact, this practice is known to cause issues like #88643, which is fixed by this commit.
2022-01-30 13:59:56 +01:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Maxine Aubrey
ea125a5fd9
nixos/nftables: set nm's firewallBackend when on
when enabled, switch networkmanager's firewallBackend option to nftables
2021-07-21 19:27:30 +02:00
Klemens Nanni
e438d4a04f
nftables: Warn about correct firewall setting
services.networking.firewall might have existed during import of this
module in 2016, but it is unknown as of today.

Point to the proper boolean knob to avoid confusion.
2020-10-02 00:25:57 +02:00
Tony Olagbaiye
c1c9905aae nixos/nftables: fix typo in ruleset example 2020-04-10 23:48:52 +01:00
Shea Levy
fec543436d
nixos: Move uses of stdenv.shell to runtimeShell. 2018-03-01 14:38:53 -05:00
Richard Zetterberg
dc10688edb nftables: adds information regarding nftables and Docker (#24326) 2017-03-25 16:34:02 +01:00
Jörg Thalheim
6c36d9fa20
nftables: make default configuration null
reason:
 - We currently have an open discussion regarding a more modular
   firewall (https://github.com/NixOS/nixpkgs/issues/23181) and
   leaving null makes future extension easier.
 - the current default might not cover all use cases (different ssh port)
   and might break setups, if applied blindly
2017-02-26 16:24:20 +01:00
Jookia
e2c95b46e5
nftables module: Add new module for nftables firewall settings
fixes #18842
2017-02-26 13:41:14 +01:00