X Tutup
Skip to content

Commit 4c2cf15

Browse files
committed
man: document new varlink service
1 parent 4751364 commit 4c2cf15

File tree

4 files changed

+68
-4
lines changed

4 files changed

+68
-4
lines changed

docs/USER_GROUP_API.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ example, introspection is not available, and the resolver logic is not used.
108108

109109
## Other Services
110110

111-
The `systemd` project provides two other services implementing this
111+
The `systemd` project provides three other services implementing this
112112
interface. Specifically:
113113

114114
1. `io.systemd.DynamicUser` → This service is implemented by the service
@@ -119,6 +119,10 @@ interface. Specifically:
119119
and provides records for the users and groups defined by the home
120120
directories it manages.
121121

122+
3. `io.systemd.Machine` → This service is implemented by
123+
`systemd-machined.service` and provides records for the users and groups used
124+
by local containers that use user namespacing.
125+
122126
Other projects are invited to implement these services too. For example it
123127
would make sense for LDAP/ActiveDirectory projects to implement these
124128
interfaces, which would provide them a way to do per-user resource management

man/nss-systemd.xml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> (for its
3636
<varname>DynamicUser=</varname> feature, see
3737
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
38-
details) or
39-
<citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
38+
details),
39+
<citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, or <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
4040

4141
<para>This module also ensures that the root and nobody users and groups (i.e. the users/groups with the UIDs/GIDs
4242
0 and 65534) remain resolvable at all times, even if they aren't listed in <filename>/etc/passwd</filename> or
@@ -55,7 +55,7 @@
5555
</refsect1>
5656

5757
<refsect1>
58-
<title>Example</title>
58+
<title>Configuration in <filename>/etc/nsswitch.conf</filename></title>
5959

6060
<para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
6161
<command>nss-systemd</command> correctly:</para>
@@ -77,6 +77,47 @@ netgroup: nis</programlisting>
7777

7878
</refsect1>
7979

80+
<refsect1>
81+
<title>Example: Mappings provided by <filename>systemd-machined.service</filename></title>
82+
83+
<para>The container <literal>rawhide</literal> is spawned using
84+
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>:
85+
</para>
86+
87+
<programlisting># systemd-nspawn -M rawhide --boot --network-veth --private-users=pick
88+
Spawning container rawhide on /var/lib/machines/rawhide.
89+
Selected user namespace base 20119552 and range 65536.
90+
...
91+
92+
$ machinectl --max-addresses=3
93+
MACHINE CLASS SERVICE OS VERSION ADDRESSES
94+
rawhide container systemd-nspawn fedora 30 169.254.40.164 fe80::94aa:3aff:fe7b:d4b9
95+
96+
$ getent passwd vu-rawhide-0 vu-rawhide-81
97+
vu-rawhide-0:*:20119552:65534:vu-rawhide-0:/:/usr/sbin/nologin
98+
vu-rawhide-81:*:20119633:65534:vu-rawhide-81:/:/usr/sbin/nologin
99+
100+
$ getent group vg-rawhide-0 vg-rawhide-81
101+
vg-rawhide-0:*:20119552:
102+
vg-rawhide-81:*:20119633:
103+
104+
$ ps -o user:15,pid,tty,command -e|grep '^vu-rawhide'
105+
vu-rawhide-0 692 ? /usr/lib/systemd/systemd
106+
vu-rawhide-0 731 ? /usr/lib/systemd/systemd-journald
107+
vu-rawhide-192 734 ? /usr/lib/systemd/systemd-networkd
108+
vu-rawhide-193 738 ? /usr/lib/systemd/systemd-resolved
109+
vu-rawhide-0 742 ? /usr/lib/systemd/systemd-logind
110+
vu-rawhide-81 744 ? /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
111+
vu-rawhide-0 746 ? /usr/sbin/sshd -D ...
112+
vu-rawhide-0 752 ? /usr/lib/systemd/systemd --user
113+
vu-rawhide-0 753 ? (sd-pam)
114+
vu-rawhide-0 1628 ? login -- zbyszek
115+
vu-rawhide-1000 1630 ? /usr/lib/systemd/systemd --user
116+
vu-rawhide-1000 1631 ? (sd-pam)
117+
vu-rawhide-1000 1637 pts/8 -zsh
118+
</programlisting>
119+
</refsect1>
120+
80121
<refsect1>
81122
<title>See Also</title>
82123
<para>
@@ -85,6 +126,9 @@ netgroup: nis</programlisting>
85126
<citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
86127
<citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
87128
<citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
129+
<citerefentry><refentrytitle>systemd-userdbd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
130+
<citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
131+
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
88132
<citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
89133
<citerefentry project='man-pages'><refentrytitle>getent</refentrytitle><manvolnum>1</manvolnum></citerefentry>
90134
</para>

man/systemd-machined.service.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@
116116
<citerefentry><refentrytitle>systemd-importd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
117117
is also available, which implements importing, exporting, and downloading of container and VM images.
118118
</para>
119+
120+
<para>For each container registered with <filename>systemd-machined.service</filename> that employs user
121+
namespacing, users/groups are synthesized for the used UIDs/GIDs. These are made available to the system
122+
using the <ulink url="https://systemd.io/USER_GROUP_API">User/Group Record Lookup API via
123+
Varlink</ulink>, and thus may be resolved with
124+
<citerefentry><refentrytitle>userdbctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> or the
125+
usual glibc NSS calls.</para>
119126
</refsect1>
120127

121128
<refsect1>

man/userdbctl.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@
186186
available to the system.</para></listitem>
187187
</varlistentry>
188188

189+
<varlistentry>
190+
<term><constant>io.systemd.Machine</constant></term>
191+
192+
<listitem><para>This service is provided by
193+
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
194+
and synthesizes records for all users/groups used by a container that employs user
195+
namespacing.</para></listitem>
196+
</varlistentry>
197+
189198
<varlistentry>
190199
<term><constant>io.systemd.Multiplexer</constant></term>
191200

0 commit comments

Comments
 (0)
X Tutup