]>
Commit | Line | Data |
---|---|---|
1f812fea | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
1f812fea | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
798d3a52 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
1f812fea LP |
4 | |
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
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 | |
1f812fea LP |
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 | |
5430f7f2 | 18 | Lesser General Public License for more details. |
1f812fea | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
1f812fea LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | --> | |
23 | ||
24 | <refentry id="systemd.socket"> | |
798d3a52 ZJS |
25 | <refentryinfo> |
26 | <title>systemd.socket</title> | |
27 | <productname>systemd</productname> | |
28 | ||
29 | <authorgroup> | |
30 | <author> | |
31 | <contrib>Developer</contrib> | |
32 | <firstname>Lennart</firstname> | |
33 | <surname>Poettering</surname> | |
34 | <email>lennart@poettering.net</email> | |
35 | </author> | |
36 | </authorgroup> | |
37 | </refentryinfo> | |
38 | ||
39 | <refmeta> | |
40 | <refentrytitle>systemd.socket</refentrytitle> | |
41 | <manvolnum>5</manvolnum> | |
42 | </refmeta> | |
43 | ||
44 | <refnamediv> | |
45 | <refname>systemd.socket</refname> | |
46 | <refpurpose>Socket unit configuration</refpurpose> | |
47 | </refnamediv> | |
48 | ||
49 | <refsynopsisdiv> | |
50 | <para><filename><replaceable>socket</replaceable>.socket</filename></para> | |
51 | </refsynopsisdiv> | |
52 | ||
53 | <refsect1> | |
54 | <title>Description</title> | |
55 | ||
56 | <para>A unit configuration file whose name ends in | |
57 | <literal>.socket</literal> encodes information about an IPC or | |
58 | network socket or a file system FIFO controlled and supervised by | |
59 | systemd, for socket-based activation.</para> | |
60 | ||
61 | <para>This man page lists the configuration options specific to | |
62 | this unit type. See | |
63 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
64 | for the common options of all unit configuration files. The common | |
65 | configuration items are configured in the generic [Unit] and | |
66 | [Install] sections. The socket specific configuration options are | |
67 | configured in the [Socket] section.</para> | |
68 | ||
69 | <para>Additional options are listed in | |
70 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
71 | which define the execution environment the | |
72 | <option>ExecStartPre=</option>, <option>ExecStartPost=</option>, | |
73 | <option>ExecStopPre=</option> and <option>ExecStopPost=</option> | |
74 | commands are executed in, and in | |
75 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
76 | which define the way the processes are terminated, and in | |
77 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
78 | which configure resource control settings for the processes of the | |
79 | socket.</para> | |
80 | ||
81 | <para>For each socket file, a matching service file must exist, | |
82 | describing the service to start on incoming traffic on the socket | |
83 | (see | |
84 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
85 | for more information about .service files). The name of the | |
86 | .service unit is by default the same as the name of the .socket | |
87 | unit, but can be altered with the <option>Service=</option> option | |
88 | described below. Depending on the setting of the | |
89 | <option>Accept=</option> option described below, this .service | |
90 | unit must either be named like the .socket unit, but with the | |
91 | suffix replaced, unless overridden with <option>Service=</option>; | |
92 | or it must be a template unit named the same way. Example: a | |
93 | socket file <filename>foo.socket</filename> needs a matching | |
94 | service <filename>foo.service</filename> if | |
95 | <option>Accept=false</option> is set. If | |
96 | <option>Accept=true</option> is set, a service template file | |
97 | <filename>foo@.service</filename> must exist from which services | |
98 | are instantiated for each incoming connection.</para> | |
99 | ||
100 | <para>Unless <varname>DefaultDependencies=</varname> is set to | |
101 | <option>false</option>, socket units will implicitly have | |
102 | dependencies of type <varname>Requires=</varname> and | |
103 | <varname>After=</varname> on <filename>sysinit.target</filename> | |
104 | as well as dependencies of type <varname>Conflicts=</varname> and | |
105 | <varname>Before=</varname> on | |
106 | <filename>shutdown.target</filename>. These ensure that socket | |
107 | units pull in basic system initialization, and are terminated | |
108 | cleanly prior to system shutdown. Only sockets involved with early | |
109 | boot or late system shutdown should disable this option.</para> | |
110 | ||
111 | <para>Socket units will have a <varname>Before=</varname> | |
112 | dependency on the service which they trigger added implicitly. No | |
113 | implicit <varname>WantedBy=</varname> or | |
114 | <varname>RequiredBy=</varname> dependency from the socket to the | |
115 | service is added. This means that the service may be started | |
116 | without the socket, in which case it must be able to open sockets | |
117 | by itself. To prevent this, an explicit | |
118 | <varname>Requires=</varname> dependency may be added.</para> | |
119 | ||
120 | <para>Socket units may be used to implement on-demand starting of | |
121 | services, as well as parallelized starting of services. See the | |
122 | blog stories linked at the end for an introduction.</para> | |
123 | ||
124 | <para>Note that the daemon software configured for socket | |
125 | activation with socket units needs to be able to accept sockets | |
126 | from systemd, either via systemd's native socket passing interface | |
127 | (see | |
128 | <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
129 | for details) or via the traditional | |
130 | <citerefentry><refentrytitle>inetd</refentrytitle><manvolnum>8</manvolnum></citerefentry>-style | |
131 | socket passing (i.e. sockets passed in via standard input and | |
132 | output, using <varname>StandardInput=socket</varname> in the | |
133 | service file).</para> | |
134 | </refsect1> | |
135 | ||
136 | <refsect1> | |
137 | <title>Options</title> | |
138 | ||
139 | <para>Socket files must include a [Socket] section, which carries | |
140 | information about the socket or FIFO it supervises. A number of | |
141 | options that may be used in this section are shared with other | |
142 | unit types. These options are documented in | |
143 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
144 | and | |
145 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
146 | The options specific to the [Socket] section of socket units are | |
147 | the following:</para> | |
148 | ||
149 | <variablelist class='unit-directives'> | |
150 | <varlistentry> | |
151 | <term><varname>ListenStream=</varname></term> | |
152 | <term><varname>ListenDatagram=</varname></term> | |
153 | <term><varname>ListenSequentialPacket=</varname></term> | |
154 | <listitem><para>Specifies an address to listen on for a stream | |
155 | (<constant>SOCK_STREAM</constant>), datagram | |
156 | (<constant>SOCK_DGRAM</constant>), or sequential packet | |
157 | (<constant>SOCK_SEQPACKET</constant>) socket, respectively. | |
158 | The address can be written in various formats:</para> | |
159 | ||
160 | <para>If the address starts with a slash | |
161 | (<literal>/</literal>), it is read as file system socket in | |
162 | the <constant>AF_UNIX</constant> socket family.</para> | |
163 | ||
164 | <para>If the address starts with an at symbol | |
165 | (<literal>@</literal>), it is read as abstract namespace | |
166 | socket in the <constant>AF_UNIX</constant> family. The | |
167 | <literal>@</literal> is replaced with a | |
168 | <constant>NUL</constant> character before binding. For | |
169 | details, see | |
170 | <citerefentry project='man-pages'><refentrytitle>unix</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> | |
171 | ||
172 | <para>If the address string is a single number, it is read as | |
173 | port number to listen on via IPv6. Depending on the value of | |
174 | <varname>BindIPv6Only=</varname> (see below) this might result | |
175 | in the service being available via both IPv6 and IPv4 | |
176 | (default) or just via IPv6. | |
177 | </para> | |
178 | ||
179 | <para>If the address string is a string in the format | |
180 | v.w.x.y:z, it is read as IPv4 specifier for listening on an | |
181 | address v.w.x.y on a port z.</para> | |
182 | ||
183 | <para>If the address string is a string in the format [x]:y, | |
184 | it is read as IPv6 address x on a port y. Note that this might | |
185 | make the service available via IPv4, too, depending on the | |
186 | <varname>BindIPv6Only=</varname> setting (see below). | |
187 | </para> | |
188 | ||
189 | <para>Note that <constant>SOCK_SEQPACKET</constant> (i.e. | |
190 | <varname>ListenSequentialPacket=</varname>) is only available | |
191 | for <constant>AF_UNIX</constant> sockets. | |
192 | <constant>SOCK_STREAM</constant> (i.e. | |
193 | <varname>ListenStream=</varname>) when used for IP sockets | |
194 | refers to TCP sockets, <constant>SOCK_DGRAM</constant> (i.e. | |
195 | <varname>ListenDatagram=</varname>) to UDP.</para> | |
196 | ||
197 | <para>These options may be specified more than once in which | |
198 | case incoming traffic on any of the sockets will trigger | |
199 | service activation, and all listed sockets will be passed to | |
200 | the service, regardless of whether there is incoming traffic | |
201 | on them or not. If the empty string is assigned to any of | |
202 | these options, the list of addresses to listen on is reset, | |
203 | all prior uses of any of these options will have no | |
204 | effect.</para> | |
205 | ||
206 | <para>It is also possible to have more than one socket unit | |
207 | for the same service when using <varname>Service=</varname>, | |
208 | and the service will receive all the sockets configured in all | |
209 | the socket units. Sockets configured in one unit are passed in | |
210 | the order of configuration, but no ordering between socket | |
211 | units is specified.</para> | |
212 | ||
213 | <para>If an IP address is used here, it is often desirable to | |
214 | listen on it before the interface it is configured on is up | |
215 | and running, and even regardless of whether it will be up and | |
216 | running at any point. To deal with this, it is recommended to | |
217 | set the <varname>FreeBind=</varname> option described | |
218 | below.</para></listitem> | |
219 | </varlistentry> | |
220 | ||
221 | <varlistentry> | |
222 | <term><varname>ListenFIFO=</varname></term> | |
223 | <listitem><para>Specifies a file system FIFO to listen on. | |
224 | This expects an absolute file system path as argument. | |
225 | Behavior otherwise is very similar to the | |
226 | <varname>ListenDatagram=</varname> directive | |
227 | above.</para></listitem> | |
228 | </varlistentry> | |
229 | ||
230 | <varlistentry> | |
231 | <term><varname>ListenSpecial=</varname></term> | |
232 | <listitem><para>Specifies a special file in the file system to | |
233 | listen on. This expects an absolute file system path as | |
234 | argument. Behavior otherwise is very similar to the | |
235 | <varname>ListenFIFO=</varname> directive above. Use this to | |
236 | open character device nodes as well as special files in | |
237 | <filename>/proc</filename> and | |
238 | <filename>/sys</filename>.</para></listitem> | |
239 | </varlistentry> | |
240 | ||
241 | <varlistentry> | |
242 | <term><varname>ListenNetlink=</varname></term> | |
243 | <listitem><para>Specifies a Netlink family to create a socket | |
244 | for to listen on. This expects a short string referring to the | |
245 | <constant>AF_NETLINK</constant> family name (such as | |
246 | <varname>audit</varname> or <varname>kobject-uevent</varname>) | |
247 | as argument, optionally suffixed by a whitespace followed by a | |
248 | multicast group integer. Behavior otherwise is very similar to | |
249 | the <varname>ListenDatagram=</varname> directive | |
250 | above.</para></listitem> | |
251 | </varlistentry> | |
252 | ||
253 | <varlistentry> | |
254 | <term><varname>ListenMessageQueue=</varname></term> | |
255 | <listitem><para>Specifies a POSIX message queue name to listen | |
256 | on. This expects a valid message queue name (i.e. beginning | |
257 | with /). Behavior otherwise is very similar to the | |
258 | <varname>ListenFIFO=</varname> directive above. On Linux | |
259 | message queue descriptors are actually file descriptors and | |
260 | can be inherited between processes.</para></listitem> | |
261 | </varlistentry> | |
262 | ||
263 | <varlistentry> | |
264 | <term><varname>BindIPv6Only=</varname></term> | |
265 | <listitem><para>Takes a one of <option>default</option>, | |
266 | <option>both</option> or <option>ipv6-only</option>. Controls | |
267 | the IPV6_V6ONLY socket option (see | |
268 | <citerefentry><refentrytitle>ipv6</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
269 | for details). If <option>both</option>, IPv6 sockets bound | |
270 | will be accessible via both IPv4 and IPv6. If | |
271 | <option>ipv6-only</option>, they will be accessible via IPv6 | |
272 | only. If <option>default</option> (which is the default, | |
273 | surprise!), the system wide default setting is used, as | |
274 | controlled by | |
275 | <filename>/proc/sys/net/ipv6/bindv6only</filename>, which in | |
276 | turn defaults to the equivalent of | |
277 | <option>both</option>.</para> | |
278 | </listitem> | |
279 | </varlistentry> | |
280 | ||
281 | <varlistentry> | |
282 | <term><varname>Backlog=</varname></term> | |
283 | <listitem><para>Takes an unsigned integer argument. Specifies | |
284 | the number of connections to queue that have not been accepted | |
285 | yet. This setting matters only for stream and sequential | |
286 | packet sockets. See | |
287 | <citerefentry><refentrytitle>listen</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
288 | for details. Defaults to SOMAXCONN (128).</para></listitem> | |
289 | </varlistentry> | |
290 | ||
291 | <varlistentry> | |
292 | <term><varname>BindToDevice=</varname></term> | |
293 | <listitem><para>Specifies a network interface name to bind | |
294 | this socket to. If set, traffic will only be accepted from the | |
295 | specified network interfaces. This controls the | |
296 | SO_BINDTODEVICE socket option (see | |
297 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
298 | for details). If this option is used, an automatic dependency | |
299 | from this socket unit on the network interface device unit | |
300 | (<citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
301 | is created.</para></listitem> | |
302 | </varlistentry> | |
303 | ||
304 | <varlistentry> | |
305 | <term><varname>SocketUser=</varname></term> | |
306 | <term><varname>SocketGroup=</varname></term> | |
307 | ||
308 | <listitem><para>Takes a UNIX user/group name. When specified, | |
309 | all AF_UNIX sockets and FIFO nodes in the file system are | |
310 | owned by the specified user and group. If unset (the default), | |
311 | the nodes are owned by the root user/group (if run in system | |
312 | context) or the invoking user/group (if run in user context). | |
313 | If only a user is specified but no group, then the group is | |
314 | derived from the user's default group.</para></listitem> | |
315 | </varlistentry> | |
316 | ||
317 | <varlistentry> | |
318 | <term><varname>SocketMode=</varname></term> | |
319 | <listitem><para>If listening on a file system socket or FIFO, | |
320 | this option specifies the file system access mode used when | |
321 | creating the file node. Takes an access mode in octal | |
322 | notation. Defaults to 0666.</para></listitem> | |
323 | </varlistentry> | |
324 | ||
325 | <varlistentry> | |
326 | <term><varname>DirectoryMode=</varname></term> | |
327 | <listitem><para>If listening on a file system socket or FIFO, | |
328 | the parent directories are automatically created if needed. | |
329 | This option specifies the file system access mode used when | |
330 | creating these directories. Takes an access mode in octal | |
331 | notation. Defaults to 0755.</para></listitem> | |
332 | </varlistentry> | |
333 | ||
334 | <varlistentry> | |
335 | <term><varname>Accept=</varname></term> | |
336 | <listitem><para>Takes a boolean argument. If true, a service | |
337 | instance is spawned for each incoming connection and only the | |
338 | connection socket is passed to it. If false, all listening | |
339 | sockets themselves are passed to the started service unit, and | |
340 | only one service unit is spawned for all connections (also see | |
341 | above). This value is ignored for datagram sockets and FIFOs | |
342 | where a single service unit unconditionally handles all | |
343 | incoming traffic. Defaults to <option>false</option>. For | |
344 | performance reasons, it is recommended to write new daemons | |
345 | only in a way that is suitable for | |
346 | <option>Accept=false</option>. A daemon listening on an | |
347 | <constant>AF_UNIX</constant> socket may, but does not need to, | |
348 | call | |
349 | <citerefentry><refentrytitle>close</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
350 | on the received socket before exiting. However, it must not | |
351 | unlink the socket from a file system. It should not invoke | |
352 | <citerefentry><refentrytitle>shutdown</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
353 | on sockets it got with <varname>Accept=false</varname>, but it | |
354 | may do so for sockets it got with | |
355 | <varname>Accept=true</varname> set. Setting | |
356 | <varname>Accept=true</varname> is mostly useful to allow | |
357 | daemons designed for usage with | |
358 | <citerefentry><refentrytitle>inetd</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
359 | to work unmodified with systemd socket | |
3b1c5241 SL |
360 | activation.</para> |
361 | ||
362 | <para>For IPv4 and IPv6 connections the <varname>REMOTE_ADDR</varname> | |
363 | environment variable will contain the remote IP, and <varname>REMOTE_PORT</varname> | |
364 | will contain the remote port. This is the same as the format used by CGI. | |
365 | For SOCK_RAW the port is the IP protocol.</para></listitem> | |
798d3a52 ZJS |
366 | </varlistentry> |
367 | ||
368 | <varlistentry> | |
369 | <term><varname>MaxConnections=</varname></term> | |
370 | <listitem><para>The maximum number of connections to | |
371 | simultaneously run services instances for, when | |
372 | <option>Accept=true</option> is set. If more concurrent | |
373 | connections are coming in, they will be refused until at least | |
374 | one existing connection is terminated. This setting has no | |
375 | effect on sockets configured with | |
376 | <option>Accept=false</option> or datagram sockets. Defaults to | |
377 | 64.</para></listitem> | |
378 | </varlistentry> | |
379 | ||
380 | <varlistentry> | |
381 | <term><varname>KeepAlive=</varname></term> | |
382 | <listitem><para>Takes a boolean argument. If true, the TCP/IP | |
383 | stack will send a keep alive message after 2h (depending on | |
384 | the configuration of | |
385 | <filename>/proc/sys/net/ipv4/tcp_keepalive_time</filename>) | |
386 | for all TCP streams accepted on this socket. This controls the | |
387 | SO_KEEPALIVE socket option (see | |
388 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
389 | and the <ulink | |
390 | url="http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/">TCP | |
391 | Keepalive HOWTO</ulink> for details.) Defaults to | |
392 | <option>false</option>.</para></listitem> | |
393 | </varlistentry> | |
394 | ||
395 | <varlistentry> | |
396 | <term><varname>KeepAliveTimeSec=</varname></term> | |
397 | <listitem><para>Takes time (in seconds) as argument . The connection needs to remain | |
398 | idle before TCP starts sending keepalive probes. This controls the TCP_KEEPIDLE | |
399 | socket option (see | |
400 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
401 | and the <ulink | |
402 | url="http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/">TCP | |
403 | Keepalive HOWTO</ulink> for details.) | |
404 | Defaults value is 7200 seconds (2 hours).</para></listitem> | |
405 | </varlistentry> | |
406 | ||
407 | <varlistentry> | |
408 | <term><varname>KeepAliveIntervalSec=</varname></term> | |
409 | <listitem><para>Takes time (in seconds) as argument between | |
410 | individual keepalive probes, if the socket option SO_KEEPALIVE | |
411 | has been set on this socket seconds as argument. This controls | |
412 | the TCP_KEEPINTVL socket option (see | |
413 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
414 | and the <ulink | |
415 | url="http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/">TCP | |
416 | Keepalive HOWTO</ulink> for details.) Defaults value is 75 | |
417 | seconds.</para></listitem> | |
418 | </varlistentry> | |
419 | ||
420 | <varlistentry> | |
421 | <term><varname>KeepAliveProbes=</varname></term> | |
422 | <listitem><para>Takes integer as argument. It's the number of | |
423 | unacknowledged probes to send before considering the | |
424 | connection dead and notifying the application layer. This | |
425 | controls the TCP_KEEPCNT socket option (see | |
426 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
427 | and the <ulink | |
428 | url="http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/">TCP | |
429 | Keepalive HOWTO</ulink> for details.) Defaults value is | |
430 | 9.</para></listitem> | |
431 | </varlistentry> | |
432 | ||
433 | <varlistentry> | |
434 | <term><varname>NoDelay=</varname></term> | |
435 | <listitem><para>Takes a boolean argument. TCP Nagle's | |
436 | algorithm works by combining a number of small outgoing | |
437 | messages, and sending them all at once. This controls the | |
438 | TCP_NODELAY socket option (see | |
439 | <citerefentry><refentrytitle>tcp</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
440 | Defaults to <option>false</option>.</para></listitem> | |
441 | </varlistentry> | |
442 | ||
443 | <varlistentry> | |
444 | <term><varname>Priority=</varname></term> | |
445 | <listitem><para>Takes an integer argument controlling the | |
446 | priority for all traffic sent from this socket. This controls | |
447 | the SO_PRIORITY socket option (see | |
448 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
449 | for details.).</para></listitem> | |
450 | </varlistentry> | |
451 | ||
452 | <varlistentry> | |
453 | <term><varname>DeferAcceptSec=</varname></term> | |
454 | ||
455 | <listitem><para>Takes time (in seconds) as argument. If set, | |
456 | the listening process will be awakened only when data arrives | |
457 | on the socket, and not immediately when connection is | |
458 | established. When this option is set, the | |
459 | <constant>TCP_DEFER_ACCEPT</constant> socket option will be | |
460 | used (see | |
461 | <citerefentry><refentrytitle>tcp</refentrytitle><manvolnum>7</manvolnum></citerefentry>), | |
462 | and the kernel will ignore initial ACK packets without any | |
463 | data. The argument specifies the approximate amount of time | |
464 | the kernel should wait for incoming data before falling back | |
465 | to the normal behaviour of honouring empty ACK packets. This | |
466 | option is beneficial for protocols where the client sends the | |
467 | data first (e.g. HTTP, in contrast to SMTP), because the | |
468 | server process will not be woken up unnecessarily before it | |
469 | can take any action. | |
470 | </para> | |
471 | ||
472 | <para>If the client also uses the | |
473 | <constant>TCP_DEFER_ACCEPT</constant> option, the latency of | |
474 | the initial connection may be reduced, because the kernel will | |
475 | send data in the final packet establishing the connection (the | |
476 | third packet in the "three-way handshake").</para> | |
477 | ||
478 | <para>Disabled by default.</para> | |
479 | </listitem> | |
480 | </varlistentry> | |
481 | ||
482 | <varlistentry> | |
483 | <term><varname>ReceiveBuffer=</varname></term> | |
484 | <term><varname>SendBuffer=</varname></term> | |
485 | <listitem><para>Takes an integer argument controlling the | |
486 | receive or send buffer sizes of this socket, respectively. | |
487 | This controls the SO_RCVBUF and SO_SNDBUF socket options (see | |
488 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
489 | for details.). The usual suffixes K, M, G are supported and | |
490 | are understood to the base of 1024.</para></listitem> | |
491 | </varlistentry> | |
492 | ||
493 | <varlistentry> | |
494 | <term><varname>IPTOS=</varname></term> | |
495 | <listitem><para>Takes an integer argument controlling the IP | |
496 | Type-Of-Service field for packets generated from this socket. | |
497 | This controls the IP_TOS socket option (see | |
498 | <citerefentry><refentrytitle>ip</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
499 | for details.). Either a numeric string or one of | |
500 | <option>low-delay</option>, <option>throughput</option>, | |
501 | <option>reliability</option> or <option>low-cost</option> may | |
502 | be specified.</para></listitem> | |
503 | </varlistentry> | |
504 | ||
505 | <varlistentry> | |
506 | <term><varname>IPTTL=</varname></term> | |
507 | <listitem><para>Takes an integer argument controlling the IPv4 | |
508 | Time-To-Live/IPv6 Hop-Count field for packets generated from | |
509 | this socket. This sets the IP_TTL/IPV6_UNICAST_HOPS socket | |
510 | options (see | |
511 | <citerefentry><refentrytitle>ip</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
512 | and | |
513 | <citerefentry><refentrytitle>ipv6</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
514 | for details.)</para></listitem> | |
515 | </varlistentry> | |
516 | ||
517 | <varlistentry> | |
518 | <term><varname>Mark=</varname></term> | |
519 | <listitem><para>Takes an integer value. Controls the firewall | |
520 | mark of packets generated by this socket. This can be used in | |
521 | the firewall logic to filter packets from this socket. This | |
522 | sets the SO_MARK socket option. See | |
523 | <citerefentry><refentrytitle>iptables</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
524 | for details.</para></listitem> | |
525 | </varlistentry> | |
526 | ||
527 | <varlistentry> | |
528 | <term><varname>ReusePort=</varname></term> | |
529 | <listitem><para>Takes a boolean value. If true, allows | |
530 | multiple | |
531 | <citerefentry><refentrytitle>bind</refentrytitle><manvolnum>2</manvolnum></citerefentry>s | |
532 | to this TCP or UDP port. This controls the SO_REUSEPORT socket | |
533 | option. See | |
534 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
535 | for details.</para></listitem> | |
536 | </varlistentry> | |
537 | ||
538 | <varlistentry> | |
539 | <term><varname>SmackLabel=</varname></term> | |
540 | <term><varname>SmackLabelIPIn=</varname></term> | |
541 | <term><varname>SmackLabelIPOut=</varname></term> | |
542 | <listitem><para>Takes a string value. Controls the extended | |
543 | attributes <literal>security.SMACK64</literal>, | |
544 | <literal>security.SMACK64IPIN</literal> and | |
545 | <literal>security.SMACK64IPOUT</literal>, respectively, i.e. | |
546 | the security label of the FIFO, or the security label for the | |
547 | incoming or outgoing connections of the socket, respectively. | |
548 | See <ulink | |
549 | url="https://www.kernel.org/doc/Documentation/security/Smack.txt">Smack.txt</ulink> | |
550 | for details.</para></listitem> | |
551 | </varlistentry> | |
552 | ||
553 | <varlistentry> | |
554 | <term><varname>SELinuxContextFromNet=</varname></term> | |
555 | <listitem><para>Takes a boolean argument. When true, systemd | |
556 | will attempt to figure out the SELinux label used for the | |
557 | instantiated service from the information handed by the peer | |
558 | over the network. Note that only the security level is used | |
559 | from the information provided by the peer. Other parts of the | |
560 | resulting SELinux context originate from either the target | |
561 | binary that is effectively triggered by socket unit or from | |
562 | the value of the <varname>SELinuxContext=</varname> option. | |
563 | This configuration option only affects sockets with | |
564 | <varname>Accept=</varname> mode set to | |
565 | <literal>true</literal>. Also note that this option is useful | |
566 | only when MLS/MCS SELinux policy is deployed. Defaults to | |
567 | <literal>false</literal>. </para></listitem> | |
568 | </varlistentry> | |
569 | ||
570 | <varlistentry> | |
571 | <term><varname>PipeSize=</varname></term> | |
572 | <listitem><para>Takes a size in bytes. Controls the pipe | |
573 | buffer size of FIFOs configured in this socket unit. See | |
574 | <citerefentry><refentrytitle>fcntl</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
575 | for details. The usual suffixes K, M, G are supported and are | |
576 | understood to the base of 1024.</para></listitem> | |
577 | </varlistentry> | |
578 | ||
579 | <varlistentry> | |
580 | <term><varname>MessageQueueMaxMessages=</varname>, | |
581 | <varname>MessageQueueMessageSize=</varname></term> | |
582 | <listitem><para>These two settings take integer values and | |
583 | control the mq_maxmsg field or the mq_msgsize field, | |
584 | respectively, when creating the message queue. Note that | |
585 | either none or both of these variables need to be set. See | |
586 | <citerefentry><refentrytitle>mq_setattr</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
587 | for details.</para></listitem> | |
588 | </varlistentry> | |
589 | ||
590 | <varlistentry> | |
591 | <term><varname>FreeBind=</varname></term> | |
592 | <listitem><para>Takes a boolean value. Controls whether the | |
593 | socket can be bound to non-local IP addresses. This is useful | |
594 | to configure sockets listening on specific IP addresses before | |
595 | those IP addresses are successfully configured on a network | |
596 | interface. This sets the IP_FREEBIND socket option. For | |
597 | robustness reasons it is recommended to use this option | |
598 | whenever you bind a socket to a specific IP address. Defaults | |
599 | to <option>false</option>.</para></listitem> | |
600 | </varlistentry> | |
601 | ||
602 | <varlistentry> | |
603 | <term><varname>Transparent=</varname></term> | |
604 | <listitem><para>Takes a boolean value. Controls the | |
605 | IP_TRANSPARENT socket option. Defaults to | |
606 | <option>false</option>.</para></listitem> | |
607 | </varlistentry> | |
608 | ||
609 | <varlistentry> | |
610 | <term><varname>Broadcast=</varname></term> | |
611 | <listitem><para>Takes a boolean value. This controls the | |
612 | SO_BROADCAST socket option, which allows broadcast datagrams | |
613 | to be sent from this socket. Defaults to | |
614 | <option>false</option>.</para></listitem> | |
615 | </varlistentry> | |
616 | ||
617 | <varlistentry> | |
618 | <term><varname>PassCredentials=</varname></term> | |
619 | <listitem><para>Takes a boolean value. This controls the | |
620 | SO_PASSCRED socket option, which allows | |
621 | <constant>AF_UNIX</constant> sockets to receive the | |
622 | credentials of the sending process in an ancillary message. | |
623 | Defaults to <option>false</option>.</para></listitem> | |
624 | </varlistentry> | |
625 | ||
626 | <varlistentry> | |
627 | <term><varname>PassSecurity=</varname></term> | |
628 | <listitem><para>Takes a boolean value. This controls the | |
629 | SO_PASSSEC socket option, which allows | |
630 | <constant>AF_UNIX</constant> sockets to receive the security | |
631 | context of the sending process in an ancillary message. | |
632 | Defaults to <option>false</option>.</para></listitem> | |
633 | </varlistentry> | |
634 | ||
635 | <varlistentry> | |
636 | <term><varname>TCPCongestion=</varname></term> | |
637 | <listitem><para>Takes a string value. Controls the TCP | |
638 | congestion algorithm used by this socket. Should be one of | |
639 | "westwood", "veno", "cubic", "lp" or any other available | |
640 | algorithm supported by the IP stack. This setting applies only | |
641 | to stream sockets.</para></listitem> | |
642 | </varlistentry> | |
643 | ||
644 | <varlistentry> | |
645 | <term><varname>ExecStartPre=</varname></term> | |
646 | <term><varname>ExecStartPost=</varname></term> | |
647 | <listitem><para>Takes one or more command lines, which are | |
648 | executed before or after the listening sockets/FIFOs are | |
649 | created and bound, respectively. The first token of the | |
650 | command line must be an absolute filename, then followed by | |
651 | arguments for the process. Multiple command lines may be | |
652 | specified following the same scheme as used for | |
653 | <varname>ExecStartPre=</varname> of service unit | |
654 | files.</para></listitem> | |
655 | </varlistentry> | |
656 | ||
657 | <varlistentry> | |
658 | <term><varname>ExecStopPre=</varname></term> | |
659 | <term><varname>ExecStopPost=</varname></term> | |
660 | <listitem><para>Additional commands that are executed before | |
661 | or after the listening sockets/FIFOs are closed and removed, | |
662 | respectively. Multiple command lines may be specified | |
663 | following the same scheme as used for | |
664 | <varname>ExecStartPre=</varname> of service unit | |
665 | files.</para></listitem> | |
666 | </varlistentry> | |
667 | ||
668 | <varlistentry> | |
669 | <term><varname>TimeoutSec=</varname></term> | |
670 | <listitem><para>Configures the time to wait for the commands | |
671 | specified in <varname>ExecStartPre=</varname>, | |
672 | <varname>ExecStartPost=</varname>, | |
673 | <varname>ExecStopPre=</varname> and | |
674 | <varname>ExecStopPost=</varname> to finish. If a command does | |
675 | not exit within the configured time, the socket will be | |
676 | considered failed and be shut down again. All commands still | |
677 | running will be terminated forcibly via | |
678 | <constant>SIGTERM</constant>, and after another delay of this | |
679 | time with <constant>SIGKILL</constant>. (See | |
680 | <option>KillMode=</option> in | |
681 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.) | |
682 | Takes a unit-less value in seconds, or a time span value such | |
683 | as "5min 20s". Pass <literal>0</literal> to disable the | |
684 | timeout logic. Defaults to | |
685 | <varname>DefaultTimeoutStartSec=</varname> from the manager | |
686 | configuration file (see | |
687 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>). | |
688 | </para></listitem> | |
689 | </varlistentry> | |
690 | ||
691 | <varlistentry> | |
692 | <term><varname>Service=</varname></term> | |
693 | <listitem><para>Specifies the service unit name to activate on | |
694 | incoming traffic. This setting is only allowed for sockets | |
695 | with <varname>Accept=no</varname>. It defaults to the service | |
696 | that bears the same name as the socket (with the suffix | |
697 | replaced). In most cases, it should not be necessary to use | |
698 | this option.</para></listitem> | |
699 | </varlistentry> | |
700 | ||
701 | <varlistentry> | |
702 | <term><varname>RemoveOnStop=</varname></term> | |
703 | <listitem><para>Takes a boolean argument. If enabled, any file | |
704 | nodes created by this socket unit are removed when it is | |
705 | stopped. This applies to AF_UNIX sockets in the file system, | |
706 | POSIX message queues, FIFOs, as well as any symlinks to them | |
707 | configured with <varname>Symlinks=</varname>. Normally, it | |
708 | should not be necessary to use this option, and is not | |
709 | recommended as services might continue to run after the socket | |
710 | unit has been terminated and it should still be possible to | |
711 | communicate with them via their file system node. Defaults to | |
712 | off.</para></listitem> | |
713 | </varlistentry> | |
714 | ||
715 | <varlistentry> | |
716 | <term><varname>Symlinks=</varname></term> | |
717 | <listitem><para>Takes a list of file system paths. The | |
718 | specified paths will be created as symlinks to the AF_UNIX | |
719 | socket path or FIFO path of this socket unit. If this setting | |
720 | is used, only one AF_UNIX socket in the file system or one | |
721 | FIFO may be configured for the socket unit. Use this option to | |
722 | manage one or more symlinked alias names for a socket, binding | |
723 | their lifecycle together. Defaults to the empty | |
724 | list.</para></listitem> | |
725 | </varlistentry> | |
726 | ||
727 | </variablelist> | |
728 | ||
729 | <para>Check | |
730 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
731 | and | |
732 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
733 | for more settings.</para> | |
734 | ||
735 | </refsect1> | |
736 | ||
737 | <refsect1> | |
738 | <title>See Also</title> | |
739 | <para> | |
740 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
741 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
742 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
743 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
744 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
745 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
746 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
747 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
748 | </para> | |
749 | ||
750 | <para> | |
751 | For more extensive descriptions see the "systemd for Developers" series: | |
752 | <ulink url="http://0pointer.de/blog/projects/socket-activation.html">Socket Activation</ulink>, | |
753 | <ulink url="http://0pointer.de/blog/projects/socket-activation2.html">Socket Activation, part II</ulink>, | |
754 | <ulink url="http://0pointer.de/blog/projects/inetd.html">Converting inetd Services</ulink>, | |
755 | <ulink url="http://0pointer.de/blog/projects/socket-activated-containers.html">Socket Activated Internet Services and OS Containers</ulink>. | |
756 | </para> | |
757 | </refsect1> | |
1f812fea LP |
758 | |
759 | </refentry> |