| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-ssh-proxy" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-ssh-proxy</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-ssh-proxy</refentrytitle> |
| 16 |
<manvolnum>1</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-ssh-proxy</refname> |
| 21 |
<refpurpose>SSH client plugin for connecting to <constant>AF_VSOCK</constant> and |
| 22 |
<constant>AF_UNIX</constant> sockets</refpurpose> |
| 23 |
</refnamediv> |
| 24 |
|
| 25 |
<refsynopsisdiv> |
| 26 |
<programlisting> |
| 27 |
Host unix/* unix%* vsock/* vsock%* vsock-mux/* vsock-mux%* |
| 28 |
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p |
| 29 |
ProxyUseFdpass yes |
| 30 |
</programlisting> |
| 31 |
<cmdsynopsis> |
| 32 |
<command>/usr/lib/systemd/systemd-ssh-proxy</command> <arg>ADDRESS</arg> <arg>PORT</arg> |
| 33 |
</cmdsynopsis> |
| 34 |
</refsynopsisdiv> |
| 35 |
|
| 36 |
|
| 37 |
<refsect1> |
| 38 |
<title>Description</title> |
| 39 |
|
| 40 |
<para><command>systemd-ssh-proxy</command> is a small "proxy" plugin for the <citerefentry |
| 41 |
project="man-pages"><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 42 |
tool that allows connecting to <constant>AF_UNIX</constant> and <constant>AF_VSOCK</constant> sockets. It |
| 43 |
implements the interface defined by <filename>ssh</filename>'s <varname>ProxyCommand</varname> |
| 44 |
configuration option. It's supposed to be used with an <citerefentry |
| 45 |
project="man-pages"><refentrytitle>ssh_config</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 46 |
configuration fragment like the following:</para> |
| 47 |
|
| 48 |
<programlisting> |
| 49 |
Host unix/* unix%* vsock/* vsock%* vsock-mux/* vsock-mux%* |
| 50 |
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p |
| 51 |
ProxyUseFdpass yes |
| 52 |
CheckHostIP no |
| 53 |
|
| 54 |
Host .host |
| 55 |
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy unix/run/ssh-unix-local/socket %p |
| 56 |
ProxyUseFdpass yes |
| 57 |
CheckHostIP no |
| 58 |
</programlisting> |
| 59 |
|
| 60 |
<para>A configuration fragment along these lines is by default installed into |
| 61 |
<filename>/etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf</filename>.</para> |
| 62 |
|
| 63 |
<para>With this in place, SSH connections to host string <literal>unix/</literal> followed by an absolute |
| 64 |
<constant>AF_UNIX</constant> file system path to a socket will be directed to the specified socket, which |
| 65 |
must be of type <constant>SOCK_STREAM</constant>. Similar, SSH connections to <literal>vsock/</literal> |
| 66 |
followed by an <constant>AF_VSOCK</constant> CID will result in an SSH connection made to that |
| 67 |
CID. <literal>vsock-mux/</literal> followed by an absolute <constant>AF_UNIX</constant> file system |
| 68 |
path to a socket is similar but for cloud-hypervisor/firecracker which do not allow |
| 69 |
direct <constant>AF_VSOCK</constant> communication between the host and guests, and provide their own |
| 70 |
multiplexer over <constant>AF_UNIX</constant> sockets. See |
| 71 |
<ulink url="https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/vsock.md">cloud-hypervisor VSOCK support</ulink> |
| 72 |
and <ulink url="https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md">Using the Firecracker Virtio-vsock Device</ulink>. |
| 73 |
Note that <literal>%</literal> can be used as a separator instead of <literal>/</literal> to be |
| 74 |
compatible with tools like <literal>scp</literal> and <literal>rsync</literal>.</para> |
| 75 |
|
| 76 |
<para>Moreover, connecting to <literal>.host</literal> will connect to the local host via SSH, without |
| 77 |
involving networking.</para> |
| 78 |
|
| 79 |
<para>This tool is supposed to be used together with |
| 80 |
<citerefentry><refentrytitle>systemd-ssh-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 81 |
which when run inside a VM or container will bind SSH to suitable |
| 82 |
addresses. <command>systemd-ssh-generator</command> is supposed to run in the container or VM guest, and |
| 83 |
<command>systemd-ssh-proxy</command> is run on the host, in order to connect to the container or VM |
| 84 |
guest.</para> |
| 85 |
</refsect1> |
| 86 |
|
| 87 |
<refsect1> |
| 88 |
<title>Exit status</title> |
| 89 |
|
| 90 |
<para>On success, 0 is returned, a non-zero failure code |
| 91 |
otherwise.</para> |
| 92 |
</refsect1> |
| 93 |
|
| 94 |
<refsect1> |
| 95 |
<title>Examples</title> |
| 96 |
|
| 97 |
<example> |
| 98 |
<title>Talk to a local VM with CID 4711</title> |
| 99 |
|
| 100 |
<programlisting>ssh vsock/4711</programlisting> |
| 101 |
</example> |
| 102 |
|
| 103 |
<example> |
| 104 |
<title>Talk to a VM guest hosted with cloud-hypervisor/firecracker</title> |
| 105 |
|
| 106 |
<programlisting>ssh vsock-mux/run/vm-1234.sock</programlisting> |
| 107 |
</example> |
| 108 |
|
| 109 |
<example> |
| 110 |
<title>Talk to the local host via ssh</title> |
| 111 |
|
| 112 |
<programlisting>ssh .host</programlisting> |
| 113 |
|
| 114 |
<para>or equivalent:</para> |
| 115 |
|
| 116 |
<programlisting>ssh unix/run/ssh-unix-local/socket</programlisting> |
| 117 |
</example> |
| 118 |
|
| 119 |
<example> |
| 120 |
<title>Copy local 'foo' file to a local VM with CID 1348</title> |
| 121 |
|
| 122 |
<programlisting>scp foo vsock%1348:</programlisting> |
| 123 |
</example> |
| 124 |
</refsect1> |
| 125 |
|
| 126 |
<refsect1> |
| 127 |
<title>See Also</title> |
| 128 |
<para><simplelist type="inline"> |
| 129 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 130 |
<member><citerefentry><refentrytitle>systemd-ssh-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 131 |
<member><citerefentry project="man-pages"><refentrytitle>vsock</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 132 |
<member><citerefentry project="man-pages"><refentrytitle>unix</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 133 |
<member><citerefentry project="man-pages"><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 134 |
<member><citerefentry project="man-pages"><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 135 |
</simplelist></para> |
| 136 |
</refsect1> |
| 137 |
</refentry> |