]> git.proxmox.com Git - systemd.git/blame - man/systemd-socket-proxyd.html
Imported Upstream version 221
[systemd.git] / man / systemd-socket-proxyd.html
CommitLineData
60f067b4
JS
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd-socket-proxyd</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
86f210e9
MP
21
22 <span style="float:right">systemd 221</span><hr><div class="refentry"><a name="systemd-socket-proxyd"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd-socket-proxyd — Bidirectionally proxy local sockets to another (possibly remote) socket.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">systemd-socket-proxyd</code> [<em class="replaceable"><code>OPTIONS</code></em>...] <em class="replaceable"><code>HOST</code></em>:<em class="replaceable"><code>PORT</code></em> </p></div><div class="cmdsynopsis"><p><code class="command">systemd-socket-proxyd</code> [<em class="replaceable"><code>OPTIONS</code></em>...] <em class="replaceable"><code>UNIX-DOMAIN-SOCKET-PATH</code></em>
23 </p></div></div><div class="refsect1"><a name="idm47123875326912"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p>
e735f4d4
MP
24 <span class="command"><strong>systemd-socket-proxyd</strong></span> is a generic
25 socket-activated network socket forwarder proxy daemon for IPv4,
26 IPv6 and UNIX stream sockets. It may be used to bi-directionally
27 forward traffic from a local listening socket to a local or remote
28 destination socket.</p><p>One use of this tool is to provide socket activation support
29 for services that do not natively support socket activation. On
30 behalf of the service to activate, the proxy inherits the socket
31 from systemd, accepts each client connection, opens a connection
32 to a configured server for each client, and then bidirectionally
33 forwards data between the two.</p><p>This utility's behavior is similar to
e3bff60a 34 <a href="http://linux.die.net/man/1/socat"><span class="citerefentry"><span class="refentrytitle">socat</span>(1)</span></a>.
e735f4d4
MP
35 The main differences for <span class="command"><strong>systemd-socket-proxyd</strong></span>
36 are support for socket activation with
37 "<code class="literal">Accept=false</code>" and an event-driven
38 design that scales better with the number of
86f210e9
MP
39 connections.</p></div><div class="refsect1"><a name="idm47123875321472"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options">¶</a></h2><p>The following options are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="-h"><span class="term"><code class="option">-h</code>, </span><span class="term"><code class="option">--help</code></span><a class="headerlink" title="Permalink to this term" href="#-h">¶</a></dt><dd><p><a name="help-text"></a>Print a short help text and exit.
40 </p></dd><dt id="--version"><span class="term"><code class="option">--version</code></span><a class="headerlink" title="Permalink to this term" href="#--version">¶</a></dt><dd><p><a name="version-text"></a>Print a short version string and exit.</p></dd></dl></div></div><div class="refsect1"><a name="idm47123875318464"></a><h2 id="Exit status">Exit status<a class="headerlink" title="Permalink to this headline" href="#Exit%20status">¶</a></h2><p>On success, 0 is returned, a non-zero failure
41 code otherwise.</p></div><div class="refsect1"><a name="idm47123875317312"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples">¶</a></h2><div class="refsect2"><a name="idm47123875316672"></a><h3 id="Simple Example">Simple Example<a class="headerlink" title="Permalink to this headline" href="#Simple%20Example">¶</a></h3><p>Use two services with a dependency and no namespace
42 isolation.</p><div class="example"><a name="idm47123875315648"></a><p class="title"><b>Example 1. proxy-to-nginx.socket</b></p><div class="example-contents"><pre class="programlisting">[Socket]
60f067b4
JS
43ListenStream=80
44
45[Install]
86f210e9 46WantedBy=sockets.target</pre></div></div><br class="example-break"><div class="example"><a name="idm47123875314144"></a><p class="title"><b>Example 2. proxy-to-nginx.service</b></p><div class="example-contents"><pre class="programlisting">[Unit]
60f067b4
JS
47Requires=nginx.service
48After=nginx.service
49
50[Service]
51ExecStart=/usr/lib/systemd/systemd-socket-proxyd /tmp/nginx.sock
52PrivateTmp=yes
86f210e9 53PrivateNetwork=yes</pre></div></div><br class="example-break"><div class="example"><a name="idm47123875312608"></a><p class="title"><b>Example 3. nginx.conf</b></p><div class="example-contents"><pre class="programlisting">
60f067b4
JS
54[...]
55server {
56 listen unix:/tmp/nginx.sock;
57 [...]
86f210e9 58</pre></div></div><br class="example-break"><div class="example"><a name="idm47123875310960"></a><p class="title"><b>Example 4. Enabling the proxy</b></p><div class="example-contents"><pre class="programlisting"># systemctl enable proxy-to-nginx.socket
60f067b4 59# systemctl start proxy-to-nginx.socket
86f210e9 60$ curl http://localhost:80/</pre></div></div><br class="example-break"></div><div class="refsect2"><a name="idm47123875309344"></a><h3 id="Namespace Example">Namespace Example<a class="headerlink" title="Permalink to this headline" href="#Namespace%20Example">¶</a></h3><p>Similar as above, but runs the socket proxy and the main
e735f4d4
MP
61 service in the same private namespace, assuming that
62 <code class="filename">nginx.service</code> has
63 <code class="varname">PrivateTmp=</code> and
86f210e9 64 <code class="varname">PrivateNetwork=</code> set, too.</p><div class="example"><a name="idm47123875306784"></a><p class="title"><b>Example 5. proxy-to-nginx.socket</b></p><div class="example-contents"><pre class="programlisting">[Socket]
60f067b4
JS
65ListenStream=80
66
67[Install]
86f210e9 68WantedBy=sockets.target</pre></div></div><br class="example-break"><div class="example"><a name="idm47123875305280"></a><p class="title"><b>Example 6. proxy-to-nginx.service</b></p><div class="example-contents"><pre class="programlisting">[Unit]
60f067b4
JS
69Requires=nginx.service
70After=nginx.service
71JoinsNamespaceOf=nginx.service
72
73[Service]
74ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080
75PrivateTmp=yes
86f210e9 76PrivateNetwork=yes</pre></div></div><br class="example-break"><div class="example"><a name="idm47123875303712"></a><p class="title"><b>Example 7. nginx.conf</b></p><div class="example-contents"><pre class="programlisting">[...]
60f067b4
JS
77server {
78 listen 8080;
86f210e9 79 [...]</pre></div></div><br class="example-break"><div class="example"><a name="idm47123875302208"></a><p class="title"><b>Example 8. Enabling the proxy</b></p><div class="example-contents"><pre class="programlisting"># systemctl enable proxy-to-nginx.socket
60f067b4 80# systemctl start proxy-to-nginx.socket
86f210e9 81$ curl http://localhost:80/</pre></div></div><br class="example-break"></div></div><div class="refsect1"><a name="idm47123875300464"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
e735f4d4
MP
82 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
83 <a href="systemd.socket.html"><span class="citerefentry"><span class="refentrytitle">systemd.socket</span>(5)</span></a>,
84 <a href="systemd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span></a>,
85 <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
e3bff60a
MP
86 <a href="http://linux.die.net/man/1/socat"><span class="citerefentry"><span class="refentrytitle">socat</span>(1)</span></a>,
87 <a href="http://linux.die.net/man/1/nginx"><span class="citerefentry"><span class="refentrytitle">nginx</span>(1)</span></a>,
88 <a href="http://linux.die.net/man/1/curl"><span class="citerefentry"><span class="refentrytitle">curl</span>(1)</span></a>
e735f4d4 89 </p></div></div></body></html>