chiark / gitweb /
bus: fix typo in systemd-bus-proxyd
[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>
117 <![CDATA[[Socket]
118 ListenStream=80
119
120 [Install]
121 WantedBy=sockets.target]]>
122 </programlisting>
123                         </example>
124                         <example>
125                                 <title>proxy-to-nginx.service</title>
126                                 <programlisting>
127 <![CDATA[[Unit]
128 Requires=nginx.service
129 After=nginx.service
130
131 [Service]
132 ExecStart=/usr/lib/systemd/systemd-socket-proxyd /tmp/nginx.sock
133 PrivateTmp=yes
134 PrivateNetwork=yes]]>
135 </programlisting>
136                         </example>
137                         <example>
138                                 <title>nginx.conf</title>
139                                 <programlisting>
140 <![CDATA[[...]
141 server {
142     listen       unix:/tmp/nginx.sock;
143     [...]]]>
144 </programlisting>
145                         </example>
146                         <example>
147                                 <title>Enabling the proxy</title>
148                                 <programlisting>
149 <![CDATA[# systemctl enable proxy-to-nginx.socket
150 # systemctl start proxy-to-nginx.socket
151 $ curl http://localhost:80/]]>
152 </programlisting>
153                         </example>
154                 </refsect2>
155                 <refsect2>
156                         <title>Namespace Example</title>
157                         <para>Similar as above, but runs the socket
158                         proxy and the main service in the same private
159                         namespace, assuming that
160                         <filename>nginx.service</filename> has
161                         <varname>PrivateTmp=</varname> and
162                         <varname>PrivateNetwork=</varname> set,
163                         too.</para>
164                         <example>
165                                 <title>proxy-to-nginx.socket</title>
166                                 <programlisting>
167 <![CDATA[[Socket]
168 ListenStream=80
169
170 [Install]
171 WantedBy=sockets.target]]>
172 </programlisting>
173                         </example>
174                         <example>
175                                 <title>proxy-to-nginx.service</title>
176                                 <programlisting>
177 <![CDATA[[Unit]
178 Requires=nginx.service
179 After=nginx.service
180 JoinsNamespaceOf=nginx.service
181
182 [Service]
183 ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080
184 PrivateTmp=yes
185 PrivateNetwork=yes]]>
186 </programlisting>
187                         </example>
188                         <example>
189                                 <title>nginx.conf</title>
190                                 <programlisting>
191 <![CDATA[[...]
192 server {
193     listen       8080;
194     listen       unix:/tmp/nginx.sock;
195     [...]]]>
196 </programlisting>
197                         </example>
198                         <example>
199                                 <title>Enabling the proxy</title>
200                                 <programlisting>
201 <![CDATA[# systemctl enable proxy-to-nginx.socket
202 # systemctl start proxy-to-nginx.socket
203 $ curl http://localhost:80/]]>
204 </programlisting>
205                         </example>
206                 </refsect2>
207         </refsect1>
208         <refsect1>
209                 <title>See Also</title>
210                 <para>
211                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
212                         <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
213                         <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
214                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
215                         <citerefentry><refentrytitle>socat</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
216                         <citerefentry><refentrytitle>nginx</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
217                         <citerefentry><refentrytitle>curl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
218                 </para>
219         </refsect1>
220 </refentry>