diff options
author | Topi Miettinen <toiwoton@gmail.com> | 2022-05-22 14:17:24 +0200 |
---|---|---|
committer | Topi Miettinen <topimiettinen@users.noreply.github.com> | 2022-06-08 18:12:25 +0200 |
commit | 46c3b1ff887e096f89cb1eae9b2567c5dd4272d3 (patch) | |
tree | f834624ca67c0a8b8dbf586dcbb6b1a3a14045c0 /man | |
parent | core: firewall integration with ControlGroupNFTSet= (diff) | |
download | systemd-46c3b1ff887e096f89cb1eae9b2567c5dd4272d3.tar.xz systemd-46c3b1ff887e096f89cb1eae9b2567c5dd4272d3.zip |
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
```
Diffstat (limited to 'man')
-rw-r--r-- | man/org.freedesktop.systemd1.xml | 24 | ||||
-rw-r--r-- | man/systemd.exec.xml | 34 |
2 files changed, 58 insertions, 0 deletions
diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index 6625a74073..b9b5768bf0 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -2785,6 +2785,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b DynamicUser = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly a(iss) DynamicUserNFTSet = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b RemoveIPC = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly a(say) SetCredential = [...]; @@ -3332,6 +3334,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { <!--property DynamicUser is not documented!--> + <!--property DynamicUserNFTSet is not documented!--> + <!--property RemoveIPC is not documented!--> <!--property SetCredential is not documented!--> @@ -3940,6 +3944,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { <variablelist class="dbus-property" generated="True" extra-ref="DynamicUser"/> + <variablelist class="dbus-property" generated="True" extra-ref="DynamicUserNFTSet"/> + <variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/> <variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/> @@ -4679,6 +4685,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b DynamicUser = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly a(iss) DynamicUserNFTSet = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b RemoveIPC = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly a(say) SetCredential = [...]; @@ -5250,6 +5258,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { <!--property DynamicUser is not documented!--> + <!--property DynamicUserNFTSet is not documented!--> + <!--property RemoveIPC is not documented!--> <!--property SetCredential is not documented!--> @@ -5852,6 +5862,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { <variablelist class="dbus-property" generated="True" extra-ref="DynamicUser"/> + <variablelist class="dbus-property" generated="True" extra-ref="DynamicUserNFTSet"/> + <variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/> <variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/> @@ -6480,6 +6492,8 @@ node /org/freedesktop/systemd1/unit/home_2emount { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b DynamicUser = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly a(iss) DynamicUserNFTSet = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b RemoveIPC = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly a(say) SetCredential = [...]; @@ -6979,6 +6993,8 @@ node /org/freedesktop/systemd1/unit/home_2emount { <!--property DynamicUser is not documented!--> + <!--property DynamicUserNFTSet is not documented!--> + <!--property RemoveIPC is not documented!--> <!--property SetCredential is not documented!--> @@ -7499,6 +7515,8 @@ node /org/freedesktop/systemd1/unit/home_2emount { <variablelist class="dbus-property" generated="True" extra-ref="DynamicUser"/> + <variablelist class="dbus-property" generated="True" extra-ref="DynamicUserNFTSet"/> + <variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/> <variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/> @@ -8254,6 +8272,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b DynamicUser = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly a(iss) DynamicUserNFTSet = [...]; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b RemoveIPC = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly a(say) SetCredential = [...]; @@ -8739,6 +8759,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { <!--property DynamicUser is not documented!--> + <!--property DynamicUserNFTSet is not documented!--> + <!--property RemoveIPC is not documented!--> <!--property SetCredential is not documented!--> @@ -9245,6 +9267,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { <variablelist class="dbus-property" generated="True" extra-ref="DynamicUser"/> + <variablelist class="dbus-property" generated="True" extra-ref="DynamicUserNFTSet"/> + <variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/> <variablelist class="dbus-property" generated="True" extra-ref="SetCredential"/> 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 @@ -3164,6 +3164,40 @@ StandardInputData=V2XigLJyZSBubyBzdHJhbmdlcnMgdG8gbG92ZQpZb3Uga25vdyB0aGUgcnVsZX </refsect1> <refsect1> + <title>Firewall Integration</title> + <variablelist class='unit-directives'> + + <varlistentry> + <term><varname>DynamicUserNFTSet=</varname><replaceable>family</replaceable>:<replaceable>table</replaceable>:<replaceable>set</replaceable></term> + <listitem><para>This setting provides a method for integrating <varname>DynamicUser=</varname> + 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 <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 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.</para> + + <para>Example: + <programlisting>[Service] +DynamicUserNFTSet=inet:filter:u</programlisting> + Corresponding NFT rules: + <programlisting>table inet filter { + set u { + typeof meta skuid + } + chain service_output { + meta skuid != @u drop + accept + } +}</programlisting> + </para> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1> <title>System V Compatibility</title> <variablelist class='unit-directives'> |