diff options
author | Topi Miettinen <toiwoton@gmail.com> | 2022-05-22 14:21:02 +0300 |
---|---|---|
committer | Topi Miettinen <topimiettinen@users.noreply.github.com> | 2022-06-08 16:12:25 +0000 |
commit | c0548df0a2f78f3422d77c77c2149d8a7f50d8f6 (patch) | |
tree | 4e363ae5071b1c60622f3f8e9ffa621bbeff3150 /man/systemd.resource-control.xml | |
parent | ab51fd9dbdc59f9a37acd8acaea3e9088d092bba (diff) | |
download | systemd-c0548df0a2f78f3422d77c77c2149d8a7f50d8f6.tar.gz |
core: firewall integration with ControlGroupNFTSet=
New directive `ControlGroupNFTSet=` provides a method for integrating services
into firewall rules with NFT sets.
Example:
```
table inet filter {
...
set timesyncd {
type cgroupsv2
}
chain ntp_output {
socket cgroupv2 != @timesyncd counter drop
accept
}
...
}
```
/etc/systemd/system/systemd-timesyncd.service.d/override.conf
```
[Service]
ControlGroupNFTSet=inet:filter:timesyncd
```
```
$ sudo nft list set inet filter timesyncd
table inet filter {
set timesyncd {
type cgroupsv2
elements = { "system.slice/systemd-timesyncd.service" }
}
}
```
Diffstat (limited to 'man/systemd.resource-control.xml')
-rw-r--r-- | man/systemd.resource-control.xml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index 1397b886c5..23b2d0f390 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -1173,6 +1173,35 @@ DeviceAllow=/dev/loop-control </para> </listitem> </varlistentry> + <varlistentry> + <term><varname>ControlGroupNFTSet=</varname><replaceable>family</replaceable>:<replaceable>table</replaceable>:<replaceable>set</replaceable></term> + <listitem> + <para>This setting provides a method for integrating dynamic cgroup IDs 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 <literal>arp</literal>, + <literal>bridge</literal>, <literal>inet</literal>, <literal>ip</literal>, <literal>ip6</literal>, + or <literal>netdev</literal>), table name and set name. The names of tables and sets must conform + to lexical restrictions of NFT table names. When a control group for a unit is realized, the cgroup + ID will be appended to the NFT sets and it will be be removed when the control group is + removed. Failures to manage the sets will be ignored.</para> + + <para>Example: + <programlisting>[Unit] +ControlGroupNFTSet=inet:filter:my_service +</programlisting> + Corresponding NFT rules: + <programlisting>table inet filter { + set my_service { + type cgroupsv2 + } + chain x { + socket cgroupv2 level 2 @my_service accept + drop + } +}</programlisting> + </para> + </listitem> + </varlistentry> </variablelist> </refsect1> |