mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-21 14:03:33 +00:00
95 lines
8.8 KiB
HTML
95 lines
8.8 KiB
HTML
<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 214</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="idm214191115840"></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="idm214191110064"></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="idm214195010912"></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="idm214195009728"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples">¶</a></h2><div class="refsect2"><a name="idm214195009056"></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="idm214195008000"></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="idm214195006432"></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="idm214195004832"></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="idm214195003088"></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="idm214195001440"></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="idm214194998528"></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="idm214194996960"></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="idm214194995328"></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="idm214194986256"></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="idm214194984448"></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>
|