systemd/man/systemd-socket-proxyd.html
2015-02-17 11:22:16 +01:00

91 lines
8.4 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
visibility: hidden;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
visibility: visible;
}
</style><a href="index.html">Index </a>·
<a href="systemd.directives.html">Directives </a>·
<a href="../python-systemd/index.html">Python </a>·
<a href="../libudev/index.html">libudev </a>·
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</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>
</p></div></div><div class="refsect1"><a name="idm139894670680512"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p>
<span class="command"><strong>systemd-socket-proxyd</strong></span> is a generic
socket-activated network socket forwarder proxy daemon for IPv4,
IPv6 and UNIX stream sockets. It may be used to bi-directionally
forward traffic from a local listening socket to a local or remote
destination socket.</p><p>One use of this tool is to provide socket activation support
for services that do not natively support socket activation. On
behalf of the service to activate, the proxy inherits the socket
from systemd, accepts each client connection, opens a connection
to a configured server for each client, and then bidirectionally
forwards data between the two.</p><p>This utility's behavior is similar to
<a href="socat.html"><span class="citerefentry"><span class="refentrytitle">socat</span>(1)</span></a>.
The main differences for <span class="command"><strong>systemd-socket-proxyd</strong></span>
are support for socket activation with
"<code class="literal">Accept=false</code>" and an event-driven
design that scales better with the number of
connections.</p></div><div class="refsect1"><a name="idm139894670674912"></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.
</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="idm139894674573952"></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
code otherwise.</p></div><div class="refsect1"><a name="idm139894674572768"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples"></a></h2><div class="refsect2"><a name="idm139894674572096"></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
isolation.</p><div class="example"><a name="idm139894674571040"></a><p class="title"><b>Example 1. proxy-to-nginx.socket</b></p><div class="example-contents"><pre class="programlisting">[Socket]
ListenStream=80
[Install]
WantedBy=sockets.target</pre></div></div><br class="example-break"><div class="example"><a name="idm139894674569472"></a><p class="title"><b>Example 2. proxy-to-nginx.service</b></p><div class="example-contents"><pre class="programlisting">[Unit]
Requires=nginx.service
After=nginx.service
[Service]
ExecStart=/usr/lib/systemd/systemd-socket-proxyd /tmp/nginx.sock
PrivateTmp=yes
PrivateNetwork=yes</pre></div></div><br class="example-break"><div class="example"><a name="idm139894674567872"></a><p class="title"><b>Example 3. nginx.conf</b></p><div class="example-contents"><pre class="programlisting">
[...]
server {
listen unix:/tmp/nginx.sock;
[...]
</pre></div></div><br class="example-break"><div class="example"><a name="idm139894674566128"></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
# systemctl start proxy-to-nginx.socket
$ curl http://localhost:80/</pre></div></div><br class="example-break"></div><div class="refsect2"><a name="idm139894674564480"></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
service in the same private namespace, assuming that
<code class="filename">nginx.service</code> has
<code class="varname">PrivateTmp=</code> and
<code class="varname">PrivateNetwork=</code> set, too.</p><div class="example"><a name="idm139894674561664"></a><p class="title"><b>Example 5. proxy-to-nginx.socket</b></p><div class="example-contents"><pre class="programlisting">[Socket]
ListenStream=80
[Install]
WantedBy=sockets.target</pre></div></div><br class="example-break"><div class="example"><a name="idm139894674560096"></a><p class="title"><b>Example 6. proxy-to-nginx.service</b></p><div class="example-contents"><pre class="programlisting">[Unit]
Requires=nginx.service
After=nginx.service
JoinsNamespaceOf=nginx.service
[Service]
ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080
PrivateTmp=yes
PrivateNetwork=yes</pre></div></div><br class="example-break"><div class="example"><a name="idm139894674558464"></a><p class="title"><b>Example 7. nginx.conf</b></p><div class="example-contents"><pre class="programlisting">[...]
server {
listen 8080;
listen unix:/tmp/nginx.sock;
[...]</pre></div></div><br class="example-break"><div class="example"><a name="idm139894674549984"></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
# systemctl start proxy-to-nginx.socket
$ curl http://localhost:80/</pre></div></div><br class="example-break"></div></div><div class="refsect1"><a name="idm139894674548176"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
<a href="systemd.socket.html"><span class="citerefentry"><span class="refentrytitle">systemd.socket</span>(5)</span></a>,
<a href="systemd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span></a>,
<a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
<a href="socat.html"><span class="citerefentry"><span class="refentrytitle">socat</span>(1)</span></a>,
<a href="nginx.html"><span class="citerefentry"><span class="refentrytitle">nginx</span>(1)</span></a>,
<a href="curl.html"><span class="citerefentry"><span class="refentrytitle">curl</span>(1)</span></a>
</p></div></div></body></html>