chiark / gitweb /
man: fix grammatical errors and other formatting issues
[elogind.git] / man / systemd-socket-proxyd.xml
1 <?xml version="1.0"?>
2 <!--*-nxml-*-->
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4      "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 <!--
6   This file is part of systemd.
7
8   Copyright 2013 David Strauss
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23 <refentry id="systemd-socket-proxyd">
24         <refentryinfo>
25                 <title>systemd-socket-proxyd</title>
26                 <productname>systemd</productname>
27                 <authorgroup>
28                         <author>
29                                 <contrib>Developer</contrib>
30                                 <firstname>David</firstname>
31                                 <surname>Strauss</surname>
32                                 <email>david@davidstrauss.net</email>
33                         </author>
34                 </authorgroup>
35         </refentryinfo>
36         <refmeta>
37                 <refentrytitle>systemd-socket-proxyd</refentrytitle>
38                 <manvolnum>8</manvolnum>
39         </refmeta>
40         <refnamediv>
41                 <refname>systemd-socket-proxyd</refname>
42                 <refpurpose>Bidirectionally proxy local sockets to another (possibly remote) socket.</refpurpose>
43         </refnamediv>
44         <refsynopsisdiv>
45                 <cmdsynopsis>
46                         <command>systemd-socket-proxyd</command>
47                         <arg choice="opt" rep="repeat"><replaceable>OPTIONS</replaceable></arg>
48                         <arg choice="plain"><replaceable>HOST</replaceable>:<replaceable>PORT</replaceable></arg>
49                 </cmdsynopsis>
50                 <cmdsynopsis>
51                         <command>systemd-socket-proxyd</command>
52                         <arg choice="opt" rep="repeat"><replaceable>OPTIONS</replaceable></arg>
53                         <arg choice="plain"><replaceable>UNIX-DOMAIN-SOCKET-PATH</replaceable>
54                         </arg>
55                 </cmdsynopsis>
56         </refsynopsisdiv>
57         <refsect1>
58                 <title>Description</title>
59                 <para>
60                 <command>systemd-socket-proxyd</command> is a generic
61                 socket-activated network socket forwarder proxy daemon
62                 for IPv4, IPv6 and UNIX stream sockets. It may be used
63                 to bi-directionally forward traffic from a local listening socket to a
64                 local or remote destination socket.</para>
65
66                 <para>One use of this tool is to provide
67                 socket activation support for services that do not
68                 natively support socket activation. On behalf of the
69                 service to activate, the proxy inherits the socket
70                 from systemd, accepts each client connection, opens a
71                 connection to a configured server for each client, and
72                 then bidirectionally forwards data between the
73                 two.</para>
74                 <para>This utility's behavior is similar to
75                 <citerefentry><refentrytitle>socat</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
76                 The main differences for <command>systemd-socket-proxyd</command>
77                 are support for socket activation with
78                 <literal>Accept=false</literal> and an event-driven
79                 design that scales better with the number of
80                 connections.</para>
81         </refsect1>
82         <refsect1>
83                 <title>Options</title>
84                 <para>The following options are understood:</para>
85                 <variablelist>
86                         <varlistentry>
87                                 <term><option>-h</option></term>
88                                 <term><option>--help</option></term>
89                                 <listitem>
90                                         <para>Prints a short help
91                                         text and exits.</para>
92                                 </listitem>
93                         </varlistentry>
94                         <varlistentry>
95                                 <term><option>--version</option></term>
96                                 <listitem>
97                                         <para>Prints a version
98                                         string and exits.</para>
99                                 </listitem>
100                         </varlistentry>
101                 </variablelist>
102         </refsect1>
103         <refsect1>
104                 <title>Exit status</title>
105                 <para>On success, 0 is returned, a non-zero failure
106                 code otherwise.</para>
107         </refsect1>
108         <refsect1>
109                 <title>Examples</title>
110                 <refsect2>
111                         <title>Simple Example</title>
112                         <para>Use two services with a dependency
113                         and no namespace isolation.</para>
114                         <example>
115                                 <title>proxy-to-nginx.socket</title>
116                                 <programlisting><![CDATA[[Socket]
117 ListenStream=80
118
119 [Install]
120 WantedBy=sockets.target]]></programlisting>
121                         </example>
122                         <example>
123                                 <title>proxy-to-nginx.service</title>
124                                 <programlisting><![CDATA[[Unit]
125 Requires=nginx.service
126 After=nginx.service
127
128 [Service]
129 ExecStart=/usr/lib/systemd/systemd-socket-proxyd /tmp/nginx.sock
130 PrivateTmp=yes
131 PrivateNetwork=yes]]></programlisting>
132                         </example>
133                         <example>
134                                 <title>nginx.conf</title>
135                                 <programlisting>
136 <![CDATA[[...]
137 server {
138     listen       unix:/tmp/nginx.sock;
139     [...]]]>
140 </programlisting>
141                         </example>
142                         <example>
143                                 <title>Enabling the proxy</title>
144                                 <programlisting><![CDATA[# systemctl enable proxy-to-nginx.socket
145 # systemctl start proxy-to-nginx.socket
146 $ curl http://localhost:80/]]></programlisting>
147                         </example>
148                 </refsect2>
149                 <refsect2>
150                         <title>Namespace Example</title>
151                         <para>Similar as above, but runs the socket
152                         proxy and the main service in the same private
153                         namespace, assuming that
154                         <filename>nginx.service</filename> has
155                         <varname>PrivateTmp=</varname> and
156                         <varname>PrivateNetwork=</varname> set,
157                         too.</para>
158                         <example>
159                                 <title>proxy-to-nginx.socket</title>
160                                 <programlisting><![CDATA[[Socket]
161 ListenStream=80
162
163 [Install]
164 WantedBy=sockets.target]]></programlisting>
165                         </example>
166                         <example>
167                                 <title>proxy-to-nginx.service</title>
168                                 <programlisting><![CDATA[[Unit]
169 Requires=nginx.service
170 After=nginx.service
171 JoinsNamespaceOf=nginx.service
172
173 [Service]
174 ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080
175 PrivateTmp=yes
176 PrivateNetwork=yes]]></programlisting>
177                         </example>
178                         <example>
179                                 <title>nginx.conf</title>
180                                 <programlisting><![CDATA[[...]
181 server {
182     listen       8080;
183     listen       unix:/tmp/nginx.sock;
184     [...]]]></programlisting>
185                         </example>
186                         <example>
187                                 <title>Enabling the proxy</title>
188                                 <programlisting><![CDATA[# systemctl enable proxy-to-nginx.socket
189 # systemctl start proxy-to-nginx.socket
190 $ curl http://localhost:80/]]></programlisting>
191                         </example>
192                 </refsect2>
193         </refsect1>
194         <refsect1>
195                 <title>See Also</title>
196                 <para>
197                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
198                         <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
199                         <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
200                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
201                         <citerefentry><refentrytitle>socat</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
202                         <citerefentry><refentrytitle>nginx</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
203                         <citerefentry><refentrytitle>curl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
204                 </para>
205         </refsect1>
206 </refentry>