From 46c3b1ff887e096f89cb1eae9b2567c5dd4272d3 Mon Sep 17 00:00:00 2001 From: Topi Miettinen Date: Sun, 22 May 2022 15:17:24 +0300 Subject: core: firewall integration with DynamicUserNFTSet= New directive `DynamicUserNFTSet=` provides a method for integrating configuration of dynamic users into firewall rules with NFT sets. Example: ``` table inet filter { set u { typeof meta skuid } chain service_output { meta skuid != @u drop accept } } ``` ``` /etc/systemd/system/dunft.service [Service] DynamicUser=yes DynamicUserNFTSet=inet:filter:u ExecStart=/bin/sleep 1000 [Install] WantedBy=multi-user.target ``` ``` $ sudo nft list set inet filter u table inet filter { set u { typeof meta skuid elements = { 64864 } } } $ ps -n --format user,group,pid,command -p `pgrep sleep` USER GROUP PID COMMAND 64864 64864 55158 /bin/sleep 1000 ``` --- man/systemd.exec.xml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'man/systemd.exec.xml') diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 50c5c89703..9798a8d999 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -3163,6 +3163,40 @@ StandardInputData=V2XigLJyZSBubyBzdHJhbmdlcnMgdG8gbG92ZQpZb3Uga25vdyB0aGUgcnVsZX + + Firewall Integration + + + + DynamicUserNFTSet=family:table:set + This setting provides a method for integrating DynamicUser= + configuration into firewall rules with NFT sets. This option expects a whitespace separated list of + NFT set definitions. Each definition consists of a colon-separated tuple of NFT address family (one + of arp, bridge, inet, ip, + ip6, or netdev), table name and set name. The names of tables + and sets must conform to lexical restrictions of NFT table names. When the unit starts, the user ID + will be appended to the NFT sets and it will be removed when the unit is stopped. Failures to manage + the sets will be ignored. + + Example: + [Service] +DynamicUserNFTSet=inet:filter:u + Corresponding NFT rules: + table inet filter { + set u { + typeof meta skuid + } + chain service_output { + meta skuid != @u drop + accept + } +} + + + + + + System V Compatibility -- cgit v1.2.1