]>
Commit | Line | Data |
---|---|---|
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>· | |
21 | <a href="../libudev/index.html">libudev </a>· | |
f47781d8 MP |
22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 218</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="idm140066803101152"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p> | |
60f067b4 JS |
24 | <span class="command"><strong>systemd-socket-proxyd</strong></span> is a generic |
25 | socket-activated network socket forwarder proxy daemon | |
26 | for IPv4, IPv6 and UNIX stream sockets. It may be used | |
27 | to bi-directionally forward traffic from a local listening socket to a | |
28 | local or remote destination socket.</p><p>One use of this tool is to provide | |
29 | socket activation support for services that do not | |
30 | natively support socket activation. On behalf of the | |
31 | service to activate, the proxy inherits the socket | |
32 | from systemd, accepts each client connection, opens a | |
33 | connection to a configured server for each client, and | |
34 | then bidirectionally forwards data between the | |
35 | two.</p><p>This utility's behavior is similar to | |
36 | <a href="socat.html"><span class="citerefentry"><span class="refentrytitle">socat</span>(1)</span></a>. | |
37 | The main differences for <span class="command"><strong>systemd-socket-proxyd</strong></span> | |
38 | are support for socket activation with | |
39 | "<code class="literal">Accept=false</code>" and an event-driven | |
40 | design that scales better with the number of | |
f47781d8 MP |
41 | connections.</p></div><div class="refsect1"><a name="idm140066803095424"></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. |
42 | </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="idm140066806992272"></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 | |
43 | code otherwise.</p></div><div class="refsect1"><a name="idm140066806991088"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples">¶</a></h2><div class="refsect2"><a name="idm140066806990416"></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 | |
44 | and no namespace isolation.</p><div class="example"><a name="idm140066806989264"></a><p class="title"><b>Example 1. proxy-to-nginx.socket</b></p><div class="example-contents"><pre class="programlisting">[Socket] | |
60f067b4 JS |
45 | ListenStream=80 |
46 | ||
47 | [Install] | |
f47781d8 | 48 | WantedBy=sockets.target</pre></div></div><br class="example-break"><div class="example"><a name="idm140066806987696"></a><p class="title"><b>Example 2. proxy-to-nginx.service</b></p><div class="example-contents"><pre class="programlisting">[Unit] |
60f067b4 JS |
49 | Requires=nginx.service |
50 | After=nginx.service | |
51 | ||
52 | [Service] | |
53 | ExecStart=/usr/lib/systemd/systemd-socket-proxyd /tmp/nginx.sock | |
54 | PrivateTmp=yes | |
f47781d8 | 55 | PrivateNetwork=yes</pre></div></div><br class="example-break"><div class="example"><a name="idm140066806986096"></a><p class="title"><b>Example 3. nginx.conf</b></p><div class="example-contents"><pre class="programlisting"> |
60f067b4 JS |
56 | [...] |
57 | server { | |
58 | listen unix:/tmp/nginx.sock; | |
59 | [...] | |
f47781d8 | 60 | </pre></div></div><br class="example-break"><div class="example"><a name="idm140066806984352"></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 | 61 | # systemctl start proxy-to-nginx.socket |
f47781d8 | 62 | $ curl http://localhost:80/</pre></div></div><br class="example-break"></div><div class="refsect2"><a name="idm140066806982704"></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 |
60f067b4 JS |
63 | proxy and the main service in the same private |
64 | namespace, assuming that | |
65 | <code class="filename">nginx.service</code> has | |
66 | <code class="varname">PrivateTmp=</code> and | |
67 | <code class="varname">PrivateNetwork=</code> set, | |
f47781d8 | 68 | too.</p><div class="example"><a name="idm140066806979792"></a><p class="title"><b>Example 5. proxy-to-nginx.socket</b></p><div class="example-contents"><pre class="programlisting">[Socket] |
60f067b4 JS |
69 | ListenStream=80 |
70 | ||
71 | [Install] | |
f47781d8 | 72 | WantedBy=sockets.target</pre></div></div><br class="example-break"><div class="example"><a name="idm140066806978224"></a><p class="title"><b>Example 6. proxy-to-nginx.service</b></p><div class="example-contents"><pre class="programlisting">[Unit] |
60f067b4 JS |
73 | Requires=nginx.service |
74 | After=nginx.service | |
75 | JoinsNamespaceOf=nginx.service | |
76 | ||
77 | [Service] | |
78 | ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080 | |
79 | PrivateTmp=yes | |
f47781d8 | 80 | PrivateNetwork=yes</pre></div></div><br class="example-break"><div class="example"><a name="idm140066806976592"></a><p class="title"><b>Example 7. nginx.conf</b></p><div class="example-contents"><pre class="programlisting">[...] |
60f067b4 JS |
81 | server { |
82 | listen 8080; | |
83 | listen unix:/tmp/nginx.sock; | |
f47781d8 | 84 | [...]</pre></div></div><br class="example-break"><div class="example"><a name="idm140066806967584"></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 | 85 | # systemctl start proxy-to-nginx.socket |
f47781d8 | 86 | $ curl http://localhost:80/</pre></div></div><br class="example-break"></div></div><div class="refsect1"><a name="idm140066806965776"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> |
60f067b4 JS |
87 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
88 | <a href="systemd.socket.html"><span class="citerefentry"><span class="refentrytitle">systemd.socket</span>(5)</span></a>, | |
89 | <a href="systemd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span></a>, | |
90 | <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>, | |
91 | <a href="socat.html"><span class="citerefentry"><span class="refentrytitle">socat</span>(1)</span></a>, | |
92 | <a href="nginx.html"><span class="citerefentry"><span class="refentrytitle">nginx</span>(1)</span></a>, | |
93 | <a href="curl.html"><span class="citerefentry"><span class="refentrytitle">curl</span>(1)</span></a> | |
94 | </p></div></div></body></html> |