Debian Codegraph @

man/systemd-ssh-generator.xml

raw
1 <?xml version="1.0"?>
2 <!--*-nxml-*-->
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
5 <!ENTITY % entities SYSTEM "custom-entities.ent" >
6 %entities;
7 ]>
8 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
9 <refentry id="systemd-ssh-generator"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>systemd-ssh-generator</title>
14 <productname>systemd</productname>
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>systemd-ssh-generator</refentrytitle>
19 <manvolnum>8</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>systemd-ssh-generator</refname>
24 <refpurpose>Generator for binding a socket-activated SSH server to local <constant>AF_VSOCK</constant>
25 and <constant>AF_UNIX</constant> sockets</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <para><filename>/usr/lib/systemd/system-generators/systemd-ssh-generator</filename></para>
30 </refsynopsisdiv>
31
32 <refsect1>
33 <title>Description</title>
34
35 <para><command>systemd-ssh-generator</command> binds a socket-activated SSH server to local
36 <constant>AF_VSOCK</constant> and <constant>AF_UNIX</constant> sockets under certain conditions. It only
37 has an effect if the
38 <citerefentry project="man-pages"><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
39 binary is installed. Specifically, it does the following:</para>
40
41 <itemizedlist>
42 <listitem><para>If invoked in a VM with <constant>AF_VSOCK</constant> support, a socket-activated SSH
43 per-connection service is bound to <constant>AF_VSOCK</constant> port 22.</para></listitem>
44
45 <listitem><para>If invoked in a container environment with a writable directory
46 <filename>/run/host/unix-export/</filename> pre-mounted it binds SSH to an <constant>AF_UNIX</constant>
47 socket <filename>/run/host/unix-export/ssh</filename>. The assumption is that this directory is bind
48 mounted to the host side as well, and can be used to connect to the container from there. See <ulink
49 url="https://systemd.io/CONTAINER_INTERFACE">Container Interface</ulink> for more information about
50 this interface.</para></listitem>
51
52 <listitem><para>A local <constant>AF_UNIX</constant> socket
53 <filename>/run/ssh-unix-local/socket</filename> is also bound, unconditionally. This may be used for
54 SSH communication from the host to itself, without involving networking, for example to traverse
55 security boundaries safely and with secure authentication.</para></listitem>
56
57 <listitem><para>Additional <constant>AF_UNIX</constant> and <constant>AF_VSOCK</constant> sockets are
58 optionally bound, based on the <varname>systemd.ssh_listen=</varname> kernel command line option or the
59 <filename>ssh.listen</filename> system credential (see below).</para></listitem>
60 </itemizedlist>
61
62 <para>See
63 <citerefentry><refentrytitle>systemd-ssh-proxy</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
64 details on how to connect to these sockets via the <command>ssh</command> client.</para>
65
66 <para>The <varname>ssh.authorized_keys.root</varname> credential can be used to allow specific public keys
67 to log in over SSH. See
68 <citerefentry><refentrytitle>systemd.system-credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry>
69 for more information.</para>
70
71 <para>The generator will use a packaged <filename>[email protected]</filename> service template file if one
72 exists, and otherwise generate a suitable service template file.</para>
73
74 <para><command>systemd-ssh-generator</command> implements
75 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
76 </refsect1>
77
78 <refsect1>
79 <title>Kernel Command Line</title>
80
81 <para><command>systemd-ssh-generator</command> understands the following
82 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>
83 parameters:</para>
84
85 <variablelist class='kernel-commandline-options'>
86 <varlistentry>
87 <term><varname>systemd.ssh_auto=</varname></term>
88
89 <listitem><para>This option takes an optional boolean argument, and defaults to yes. If enabled, the
90 automatic binding to the <constant>AF_VSOCK</constant> and <constant>AF_UNIX</constant> sockets
91 listed above is done. If disable, this is not done, except for those explicitly requested via
92 <varname>systemd.ssh_listen=</varname> on the kernel command line or via the
93 <varname>ssh.listen</varname> system credential.</para>
94
95 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
96 </varlistentry>
97
98 <varlistentry>
99 <term><varname>systemd.ssh_listen=</varname></term>
100
101 <listitem><para>This option configures an additional socket to bind SSH to. It may be used multiple
102 times to bind multiple sockets. The syntax should follow the one of <varname>ListenStream=</varname>,
103 see
104 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
105 for details. This functionality supports all socket families
106 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> supports,
107 including <constant>AF_INET</constant> and <constant>AF_INET6</constant>.</para>
108
109 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
110 </varlistentry>
111 </variablelist>
112 </refsect1>
113
114 <refsect1>
115 <title>Credentials</title>
116
117 <para><command>systemd-ssh-generator</command> supports the system credentials logic. The following
118 credentials are used when passed in:</para>
119
120 <variablelist class='system-credentials'>
121 <varlistentry>
122 <term><varname>ssh.listen</varname></term>
123
124 <listitem><para>This credential should be a text file, with each line referencing one additional
125 socket to bind SSH to. The syntax should follow the one of <varname>ListenStream=</varname>, see
126 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
127 for details. This functionality supports all socket families systemd supports, including
128 <constant>AF_INET</constant> and <constant>AF_INET6</constant>.</para>
129
130 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
131 </varlistentry>
132
133 <varlistentry>
134 <term><varname>ssh.ephemeral-authorized_keys-all</varname></term>
135
136 <listitem>
137 <para>Provides additional public keys, given in the customary <filename>authorized_keys</filename>
138 format, for all users, for incoming connections via the generated <constant>AF_VSOCK</constant>
139 and <constant>AF_UNIX</constant> socket units.</para>
140
141 <para>The intended use of this is for a host system (in either VM or container configurations) to
142 generate a keypair and inject the public key into the guest, using the private key to connect to
143 any user account on the guest via ssh, without further authentication.</para>
144
145 <xi:include href="version-info.xml" xpointer="v256"/>
146 </listitem>
147 </varlistentry>
148 </variablelist>
149 </refsect1>
150
151 <refsect1>
152 <title>See Also</title>
153 <para><simplelist type="inline">
154 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
155 <member><citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
156 <member><citerefentry><refentrytitle>systemd.system-credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
157 <member><citerefentry project="man-pages"><refentrytitle>vsock</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
158 <member><citerefentry project="man-pages"><refentrytitle>unix</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
159 <member><citerefentry project="man-pages"><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
160 <member><citerefentry project="man-pages"><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
161 </simplelist></para>
162 </refsect1>
163 </refentry>