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