Adds support for drop in and systemd unit based nft rules
Find a file
2026-10-31 02:00:21 -04:00
00-core.nft Revised setup to use rule adds vs independent tables 2025-12-12 15:20:33 -05:00
50-dynamic-rules.nft Revised setup to use rule adds vs independent tables 2025-12-12 15:20:33 -05:00
99-catchall.nft fixed syntax error in 99-catchall.nft 2026-10-18 00:02:40 -04:00
create-dynamic-rule.sh removed junk in create-dynamic-rule script 2026-10-18 00:27:48 -04:00
delete-dynamic-rule.sh Moved to atomically add/remove new rulesets 2026-10-17 23:45:12 -04:00
dynamic-nftables.conf Moved to atomically add/remove new rulesets 2026-10-17 23:45:12 -04:00
gen-nftable Finished first fully working version 2025-12-12 16:24:16 -05:00
LICENSE Add MIT License to the project 2026-01-31 15:36:59 -05:00
nft-forward-rule@.service Moved to atomically add/remove new rulesets 2026-10-17 23:45:12 -04:00
nft-input-rule@.service Moved to atomically add/remove new rulesets 2026-10-17 23:45:12 -04:00
nft-output-rule@.service Moved to atomically add/remove new rulesets 2026-10-17 23:45:12 -04:00
nftables-dropin.conf Fixed nftables to remain after exit for use in units 2026-10-18 00:21:18 -04:00
PKGBUILD Generated pkgbuild checksums directly on project 2026-10-31 02:00:21 -04:00
README.md Added a basic readme 2026-01-31 16:10:35 -05:00

Dynamic Nftables

Dynamic Nftables is a small project to make managing nftable rules slightly easier for your desktop or (secure) server.

It uses base rules taken from the Archlinux default /etc/nftable.conf.

Usage

Note that this project by default OVERRIDES your default systemd nftable service and how it fires. If you modify the service yourself make sure that this override is not overriding or messing up your own modifications.

Note this project assumes you will have 3 different locations available for writing rules and follows Systemd-like designations for these files. /etc/nftables/ for user/admin specified nftable rules, /usr/lib/nftables for package/distro provided nftable rules, and /run/nftables/ for generated nftable rules. Each of these directories have an identical directory layout. For the rest of this readme the <root> directory will refer to any of the 3.

Static Rules

  • Static rules are constant (always on) rules
  • Stored under <root>/static.
  • Activated when nftables.service activates.
  • Files are loaded in the order /usr/lib/nftables/, /etc/nftables/, and finally /run/nftables/ with overlapping names overwriting a previously occuring entry
  • Files are sorted in the same manner as systemd before being written.

Dynamic Rules

  • Dynamic rules are nftable rules loadable as systemd services.
  • Stored under <root>/dynamic
  • Activated via nft-forward-rule@<file>.service, nft-input-rule@<file>.service, and nft-output-rule@<file>.service
  • Files are loaded in the order /usr/lib/nftables/, /etc/nftables/, and finally /run/nftables/ with overlapping names overwriting a previously occuring entry
  • Files MUST be written as if they are inside of a chain (because they will loaded as such)