1SYSTEMD.SOCKET(5)               systemd.socket               SYSTEMD.SOCKET(5)
2
3
4

NAME

6       systemd.socket - Socket unit configuration
7

SYNOPSIS

9       socket.socket
10

DESCRIPTION

12       A unit configuration file whose name ends in ".socket" encodes
13       information about an IPC or network socket or a file system FIFO
14       controlled and supervised by systemd, for socket-based activation.
15
16       This man page lists the configuration options specific to this unit
17       type. See systemd.unit(5) for the common options of all unit
18       configuration files. The common configuration items are configured in
19       the generic [Unit] and [Install] sections. The socket specific
20       configuration options are configured in the [Socket] section.
21
22       Additional options are listed in systemd.exec(5), which define the
23       execution environment the ExecStartPre=, ExecStartPost=, ExecStopPre=
24       and ExecStopPost= commands are executed in, and in systemd.kill(5),
25       which define the way the processes are terminated, and in
26       systemd.resource-control(5), which configure resource control settings
27       for the processes of the socket.
28
29       For each socket unit, a matching service unit must exist, describing
30       the service to start on incoming traffic on the socket (see
31       systemd.service(5) for more information about .service units). The name
32       of the .service unit is by default the same as the name of the .socket
33       unit, but can be altered with the Service= option described below.
34       Depending on the setting of the Accept= option described below, this
35       .service unit must either be named like the .socket unit, but with the
36       suffix replaced, unless overridden with Service=; or it must be a
37       template unit named the same way. Example: a socket file foo.socket
38       needs a matching service foo.service if Accept=no is set. If Accept=yes
39       is set, a service template foo@.service must exist from which services
40       are instantiated for each incoming connection.
41
42       No implicit WantedBy= or RequiredBy= dependency from the socket to the
43       service is added. This means that the service may be started without
44       the socket, in which case it must be able to open sockets by itself. To
45       prevent this, an explicit Requires= dependency may be added.
46
47       Socket units may be used to implement on-demand starting of services,
48       as well as parallelized starting of services. See the blog stories
49       linked at the end for an introduction.
50
51       Note that the daemon software configured for socket activation with
52       socket units needs to be able to accept sockets from systemd, either
53       via systemd's native socket passing interface (see sd_listen_fds(3) for
54       details about the precise protocol used and the order in which the file
55       descriptors are passed) or via traditional inetd(8)-style socket
56       passing (i.e. sockets passed in via standard input and output, using
57       StandardInput=socket in the service file).
58
59       All network sockets allocated through .socket units are allocated in
60       the host's network namespace (see network_namespaces(7)). This does not
61       mean however that the service activated by a configured socket unit has
62       to be part of the host's network namespace as well. It is supported and
63       even good practice to run services in their own network namespace (for
64       example through PrivateNetwork=, see systemd.exec(5)), receiving only
65       the sockets configured through socket-activation from the host's
66       namespace. In such a set-up communication within the host's network
67       namespace is only permitted through the activation sockets passed in
68       while all sockets allocated from the service code itself will be
69       associated with the service's own namespace, and thus possibly subject
70       to a restrictive configuration.
71

AUTOMATIC DEPENDENCIES

73   Implicit Dependencies
74       The following dependencies are implicitly added:
75
76       •   Socket units automatically gain a Before= dependency on the service
77           units they activate.
78
79       •   Socket units referring to file system paths (such as AF_UNIX
80           sockets or FIFOs) implicitly gain Requires= and After= dependencies
81           on all mount units necessary to access those paths.
82
83       •   Socket units using the BindToDevice= setting automatically gain a
84           BindsTo= and After= dependency on the device unit encapsulating the
85           specified network interface.
86
87       Additional implicit dependencies may be added as result of execution
88       and resource control parameters as documented in systemd.exec(5) and
89       systemd.resource-control(5).
90
91   Default Dependencies
92       The following dependencies are added unless DefaultDependencies=no is
93       set:
94
95       •   Socket units automatically gain a Before= dependency on
96           sockets.target.
97
98       •   Socket units automatically gain a pair of After= and Requires=
99           dependency on sysinit.target, and a pair of Before= and Conflicts=
100           dependencies on shutdown.target. These dependencies ensure that the
101           socket unit is started before normal services at boot, and is
102           stopped on shutdown. Only sockets involved with early boot or late
103           system shutdown should disable DefaultDependencies= option.
104

OPTIONS

106       Socket unit files may include [Unit] and [Install] sections, which are
107       described in systemd.unit(5).
108
109       Socket unit files must include a [Socket] section, which carries
110       information about the socket or FIFO it supervises. A number of options
111       that may be used in this section are shared with other unit types.
112       These options are documented in systemd.exec(5) and systemd.kill(5).
113       The options specific to the [Socket] section of socket units are the
114       following:
115
116       ListenStream=, ListenDatagram=, ListenSequentialPacket=
117           Specifies an address to listen on for a stream (SOCK_STREAM),
118           datagram (SOCK_DGRAM), or sequential packet (SOCK_SEQPACKET)
119           socket, respectively. The address can be written in various
120           formats:
121
122           If the address starts with a slash ("/"), it is read as file system
123           socket in the AF_UNIX socket family.
124
125           If the address starts with an at symbol ("@"), it is read as
126           abstract namespace socket in the AF_UNIX family. The "@" is
127           replaced with a NUL character before binding. For details, see
128           unix(7).
129
130           If the address string is a single number, it is read as port number
131           to listen on via IPv6. Depending on the value of BindIPv6Only= (see
132           below) this might result in the service being available via both
133           IPv6 and IPv4 (default) or just via IPv6.
134
135           If the address string is a string in the format "v.w.x.y:z", it is
136           interpreted as IPv4 address v.w.x.y and port z.
137
138           If the address string is a string in the format "[x]:y", it is
139           interpreted as IPv6 address x and port y. An optional interface
140           scope (interface name or number) may be specified after a "%"
141           symbol: "[x]:y%dev". Interface scopes are only useful with
142           link-local addresses, because the kernel ignores them in other
143           cases. Note that if an address is specified as IPv6, it might still
144           make the service available via IPv4 too, depending on the
145           BindIPv6Only= setting (see below).
146
147           If the address string is a string in the format "vsock:x:y", it is
148           read as CID x on a port y address in the AF_VSOCK family. The CID
149           is a unique 32-bit integer identifier in AF_VSOCK analogous to an
150           IP address. Specifying the CID is optional, and may be set to the
151           empty string.
152
153           Note that SOCK_SEQPACKET (i.e.  ListenSequentialPacket=) is only
154           available for AF_UNIX sockets.  SOCK_STREAM (i.e.  ListenStream=)
155           when used for IP sockets refers to TCP sockets, SOCK_DGRAM (i.e.
156           ListenDatagram=) to UDP.
157
158           These options may be specified more than once, in which case
159           incoming traffic on any of the sockets will trigger service
160           activation, and all listed sockets will be passed to the service,
161           regardless of whether there is incoming traffic on them or not. If
162           the empty string is assigned to any of these options, the list of
163           addresses to listen on is reset, all prior uses of any of these
164           options will have no effect.
165
166           It is also possible to have more than one socket unit for the same
167           service when using Service=, and the service will receive all the
168           sockets configured in all the socket units. Sockets configured in
169           one unit are passed in the order of configuration, but no ordering
170           between socket units is specified.
171
172           If an IP address is used here, it is often desirable to listen on
173           it before the interface it is configured on is up and running, and
174           even regardless of whether it will be up and running at any point.
175           To deal with this, it is recommended to set the FreeBind= option
176           described below.
177
178       ListenFIFO=
179           Specifies a file system FIFO (see fifo(7) for details) to listen
180           on. This expects an absolute file system path as argument. Behavior
181           otherwise is very similar to the ListenDatagram= directive above.
182
183       ListenSpecial=
184           Specifies a special file in the file system to listen on. This
185           expects an absolute file system path as argument. Behavior
186           otherwise is very similar to the ListenFIFO= directive above. Use
187           this to open character device nodes as well as special files in
188           /proc/ and /sys/.
189
190       ListenNetlink=
191           Specifies a Netlink family to create a socket for to listen on.
192           This expects a short string referring to the AF_NETLINK family name
193           (such as audit or kobject-uevent) as argument, optionally suffixed
194           by a whitespace followed by a multicast group integer. Behavior
195           otherwise is very similar to the ListenDatagram= directive above.
196
197       ListenMessageQueue=
198           Specifies a POSIX message queue name to listen on (see
199           mq_overview(7) for details). This expects a valid message queue
200           name (i.e. beginning with "/"). Behavior otherwise is very similar
201           to the ListenFIFO= directive above. On Linux message queue
202           descriptors are actually file descriptors and can be inherited
203           between processes.
204
205       ListenUSBFunction=
206           Specifies a USB FunctionFS[1] endpoints location to listen on, for
207           implementation of USB gadget functions. This expects an absolute
208           file system path of a FunctionFS mount point as the argument.
209           Behavior otherwise is very similar to the ListenFIFO= directive
210           above. Use this to open the FunctionFS endpoint ep0. When using
211           this option, the activated service has to have the
212           USBFunctionDescriptors= and USBFunctionStrings= options set.
213
214       SocketProtocol=
215           Takes one of udplite or sctp. The socket will use the UDP-Lite
216           (IPPROTO_UDPLITE) or SCTP (IPPROTO_SCTP) protocol, respectively.
217
218       BindIPv6Only=
219           Takes one of default, both or ipv6-only. Controls the IPV6_V6ONLY
220           socket option (see ipv6(7) for details). If both, IPv6 sockets
221           bound will be accessible via both IPv4 and IPv6. If ipv6-only, they
222           will be accessible via IPv6 only. If default (which is the default,
223           surprise!), the system wide default setting is used, as controlled
224           by /proc/sys/net/ipv6/bindv6only, which in turn defaults to the
225           equivalent of both.
226
227       Backlog=
228           Takes an unsigned 32-bit integer argument. Specifies the number of
229           connections to queue that have not been accepted yet. This setting
230           matters only for stream and sequential packet sockets. See
231           listen(2) for details. Note that this value is silently capped by
232           the "net.core.somaxconn" sysctl, which typically defaults to 4096.
233           By default this is set to 4294967295, so that the sysctl takes full
234           effect.
235
236       BindToDevice=
237           Specifies a network interface name to bind this socket to. If set,
238           traffic will only be accepted from the specified network
239           interfaces. This controls the SO_BINDTODEVICE socket option (see
240           socket(7) for details). If this option is used, an implicit
241           dependency from this socket unit on the network interface device
242           unit is created (see systemd.device(5)). Note that setting this
243           parameter might result in additional dependencies to be added to
244           the unit (see above).
245
246       SocketUser=, SocketGroup=
247           Takes a UNIX user/group name. When specified, all AF_UNIX sockets
248           and FIFO nodes in the file system are owned by the specified user
249           and group. If unset (the default), the nodes are owned by the root
250           user/group (if run in system context) or the invoking user/group
251           (if run in user context). If only a user is specified but no group,
252           then the group is derived from the user's default group.
253
254       SocketMode=
255           If listening on a file system socket or FIFO, this option specifies
256           the file system access mode used when creating the file node. Takes
257           an access mode in octal notation. Defaults to 0666.
258
259       DirectoryMode=
260           If listening on a file system socket or FIFO, the parent
261           directories are automatically created if needed. This option
262           specifies the file system access mode used when creating these
263           directories. Takes an access mode in octal notation. Defaults to
264           0755.
265
266       Accept=
267           Takes a boolean argument. If yes, a service instance is spawned for
268           each incoming connection and only the connection socket is passed
269           to it. If no, all listening sockets themselves are passed to the
270           started service unit, and only one service unit is spawned for all
271           connections (also see above). This value is ignored for datagram
272           sockets and FIFOs where a single service unit unconditionally
273           handles all incoming traffic. Defaults to no. For performance
274           reasons, it is recommended to write new daemons only in a way that
275           is suitable for Accept=no. A daemon listening on an AF_UNIX socket
276           may, but does not need to, call close(2) on the received socket
277           before exiting. However, it must not unlink the socket from a file
278           system. It should not invoke shutdown(2) on sockets it got with
279           Accept=no, but it may do so for sockets it got with Accept=yes set.
280           Setting Accept=yes is mostly useful to allow daemons designed for
281           usage with inetd(8) to work unmodified with systemd socket
282           activation.
283
284           Note that depending on this setting the services activated by units
285           of this type are either regular services (in case of Accept=no) or
286           instances of templated services (in case of Accept=yes). See the
287           Description section above for a more detailed discussion of the
288           naming rules of triggered services.
289
290           For IPv4 and IPv6 connections, the REMOTE_ADDR environment variable
291           will contain the remote IP address, and REMOTE_PORT will contain
292           the remote port. This is the same as the format used by CGI. For
293           SOCK_RAW, the port is the IP protocol.
294
295           It is recommended to set CollectMode=inactive-or-failed for service
296           instances activated via Accept=yes, to ensure that failed
297           connection services are cleaned up and released from memory, and do
298           not accumulate.
299
300       Writable=
301           Takes a boolean argument. May only be used in conjunction with
302           ListenSpecial=. If true, the specified special file is opened in
303           read-write mode, if false, in read-only mode. Defaults to false.
304
305       FlushPending=
306           Takes a boolean argument. May only be used when Accept=no. If yes,
307           the socket's buffers are cleared after the triggered service
308           exited. This causes any pending data to be flushed and any pending
309           incoming connections to be rejected. If no, the socket's buffers
310           won't be cleared, permitting the service to handle any pending
311           connections after restart, which is the usually expected behaviour.
312           Defaults to no.
313
314       MaxConnections=
315           The maximum number of connections to simultaneously run services
316           instances for, when Accept=yes is set. If more concurrent
317           connections are coming in, they will be refused until at least one
318           existing connection is terminated. This setting has no effect on
319           sockets configured with Accept=no or datagram sockets. Defaults to
320           64.
321
322       MaxConnectionsPerSource=
323           The maximum number of connections for a service per source IP
324           address. This is very similar to the MaxConnections= directive
325           above. Disabled by default.
326
327       KeepAlive=
328           Takes a boolean argument. If true, the TCP/IP stack will send a
329           keep alive message after 2h (depending on the configuration of
330           /proc/sys/net/ipv4/tcp_keepalive_time) for all TCP streams accepted
331           on this socket. This controls the SO_KEEPALIVE socket option (see
332           socket(7) and the TCP Keepalive HOWTO[2] for details.) Defaults to
333           false.
334
335       KeepAliveTimeSec=
336           Takes time (in seconds) as argument. The connection needs to remain
337           idle before TCP starts sending keepalive probes. This controls the
338           TCP_KEEPIDLE socket option (see socket(7) and the TCP Keepalive
339           HOWTO[2] for details.) Default value is 7200 seconds (2 hours).
340
341       KeepAliveIntervalSec=
342           Takes time (in seconds) as argument between individual keepalive
343           probes, if the socket option SO_KEEPALIVE has been set on this
344           socket. This controls the TCP_KEEPINTVL socket option (see
345           socket(7) and the TCP Keepalive HOWTO[2] for details.) Default
346           value is 75 seconds.
347
348       KeepAliveProbes=
349           Takes an integer as argument. It is the number of unacknowledged
350           probes to send before considering the connection dead and notifying
351           the application layer. This controls the TCP_KEEPCNT socket option
352           (see socket(7) and the TCP Keepalive HOWTO[2] for details.) Default
353           value is 9.
354
355       NoDelay=
356           Takes a boolean argument. TCP Nagle's algorithm works by combining
357           a number of small outgoing messages, and sending them all at once.
358           This controls the TCP_NODELAY socket option (see tcp(7)). Defaults
359           to false.
360
361       Priority=
362           Takes an integer argument controlling the priority for all traffic
363           sent from this socket. This controls the SO_PRIORITY socket option
364           (see socket(7) for details.).
365
366       DeferAcceptSec=
367           Takes time (in seconds) as argument. If set, the listening process
368           will be awakened only when data arrives on the socket, and not
369           immediately when connection is established. When this option is
370           set, the TCP_DEFER_ACCEPT socket option will be used (see tcp(7)),
371           and the kernel will ignore initial ACK packets without any data.
372           The argument specifies the approximate amount of time the kernel
373           should wait for incoming data before falling back to the normal
374           behavior of honoring empty ACK packets. This option is beneficial
375           for protocols where the client sends the data first (e.g. HTTP, in
376           contrast to SMTP), because the server process will not be woken up
377           unnecessarily before it can take any action.
378
379           If the client also uses the TCP_DEFER_ACCEPT option, the latency of
380           the initial connection may be reduced, because the kernel will send
381           data in the final packet establishing the connection (the third
382           packet in the "three-way handshake").
383
384           Disabled by default.
385
386       ReceiveBuffer=, SendBuffer=
387           Takes an integer argument controlling the receive or send buffer
388           sizes of this socket, respectively. This controls the SO_RCVBUF and
389           SO_SNDBUF socket options (see socket(7) for details.). The usual
390           suffixes K, M, G are supported and are understood to the base of
391           1024.
392
393       IPTOS=
394           Takes an integer argument controlling the IP Type-Of-Service field
395           for packets generated from this socket. This controls the IP_TOS
396           socket option (see ip(7) for details.). Either a numeric string or
397           one of low-delay, throughput, reliability or low-cost may be
398           specified.
399
400       IPTTL=
401           Takes an integer argument controlling the IPv4 Time-To-Live/IPv6
402           Hop-Count field for packets generated from this socket. This sets
403           the IP_TTL/IPV6_UNICAST_HOPS socket options (see ip(7) and ipv6(7)
404           for details.)
405
406       Mark=
407           Takes an integer value. Controls the firewall mark of packets
408           generated by this socket. This can be used in the firewall logic to
409           filter packets from this socket. This sets the SO_MARK socket
410           option. See iptables(8) for details.
411
412       ReusePort=
413           Takes a boolean value. If true, allows multiple bind(2)s to this
414           TCP or UDP port. This controls the SO_REUSEPORT socket option. See
415           socket(7) for details.
416
417       SmackLabel=, SmackLabelIPIn=, SmackLabelIPOut=
418           Takes a string value. Controls the extended attributes
419           "security.SMACK64", "security.SMACK64IPIN" and
420           "security.SMACK64IPOUT", respectively, i.e. the security label of
421           the FIFO, or the security label for the incoming or outgoing
422           connections of the socket, respectively. See Smack[3] for details.
423
424       SELinuxContextFromNet=
425           Takes a boolean argument. When true, systemd will attempt to figure
426           out the SELinux label used for the instantiated service from the
427           information handed by the peer over the network. Note that only the
428           security level is used from the information provided by the peer.
429           Other parts of the resulting SELinux context originate from either
430           the target binary that is effectively triggered by socket unit or
431           from the value of the SELinuxContext= option. This configuration
432           option applies only when activated service is passed in single
433           socket file descriptor, i.e. service instances that have standard
434           input connected to a socket or services triggered by exactly one
435           socket unit. Also note that this option is useful only when MLS/MCS
436           SELinux policy is deployed. Defaults to "false".
437
438       PipeSize=
439           Takes a size in bytes. Controls the pipe buffer size of FIFOs
440           configured in this socket unit. See fcntl(2) for details. The usual
441           suffixes K, M, G are supported and are understood to the base of
442           1024.
443
444       MessageQueueMaxMessages=, MessageQueueMessageSize=
445           These two settings take integer values and control the mq_maxmsg
446           field or the mq_msgsize field, respectively, when creating the
447           message queue. Note that either none or both of these variables
448           need to be set. See mq_setattr(3) for details.
449
450       FreeBind=
451           Takes a boolean value. Controls whether the socket can be bound to
452           non-local IP addresses. This is useful to configure sockets
453           listening on specific IP addresses before those IP addresses are
454           successfully configured on a network interface. This sets the
455           IP_FREEBIND/IPV6_FREEBIND socket option. For robustness reasons it
456           is recommended to use this option whenever you bind a socket to a
457           specific IP address. Defaults to false.
458
459       Transparent=
460           Takes a boolean value. Controls the IP_TRANSPARENT/IPV6_TRANSPARENT
461           socket option. Defaults to false.
462
463       Broadcast=
464           Takes a boolean value. This controls the SO_BROADCAST socket
465           option, which allows broadcast datagrams to be sent from this
466           socket. Defaults to false.
467
468       PassCredentials=
469           Takes a boolean value. This controls the SO_PASSCRED socket option,
470           which allows AF_UNIX sockets to receive the credentials of the
471           sending process in an ancillary message. Defaults to false.
472
473       PassSecurity=
474           Takes a boolean value. This controls the SO_PASSSEC socket option,
475           which allows AF_UNIX sockets to receive the security context of the
476           sending process in an ancillary message. Defaults to false.
477
478       PassPacketInfo=
479           Takes a boolean value. This controls the IP_PKTINFO,
480           IPV6_RECVPKTINFO, NETLINK_PKTINFO or PACKET_AUXDATA socket options,
481           which enable reception of additional per-packet metadata as
482           ancillary message, on AF_INET, AF_INET6, AF_UNIX and AF_PACKET
483           sockets. Defaults to false.
484
485       Timestamping=
486           Takes one of "off", "us" (alias: "usec", "μs") or "ns" (alias:
487           "nsec"). This controls the SO_TIMESTAMP or SO_TIMESTAMPNS socket
488           options, and enables whether ingress network traffic shall carry
489           timestamping metadata. Defaults to off.
490
491       TCPCongestion=
492           Takes a string value. Controls the TCP congestion algorithm used by
493           this socket. Should be one of "westwood", "veno", "cubic", "lp" or
494           any other available algorithm supported by the IP stack. This
495           setting applies only to stream sockets.
496
497       ExecStartPre=, ExecStartPost=
498           Takes one or more command lines, which are executed before or after
499           the listening sockets/FIFOs are created and bound, respectively.
500           The first token of the command line must be an absolute filename,
501           then followed by arguments for the process. Multiple command lines
502           may be specified following the same scheme as used for
503           ExecStartPre= of service unit files.
504
505       ExecStopPre=, ExecStopPost=
506           Additional commands that are executed before or after the listening
507           sockets/FIFOs are closed and removed, respectively. Multiple
508           command lines may be specified following the same scheme as used
509           for ExecStartPre= of service unit files.
510
511       TimeoutSec=
512           Configures the time to wait for the commands specified in
513           ExecStartPre=, ExecStartPost=, ExecStopPre= and ExecStopPost= to
514           finish. If a command does not exit within the configured time, the
515           socket will be considered failed and be shut down again. All
516           commands still running will be terminated forcibly via SIGTERM, and
517           after another delay of this time with SIGKILL. (See KillMode= in
518           systemd.kill(5).) Takes a unit-less value in seconds, or a time
519           span value such as "5min 20s". Pass "0" to disable the timeout
520           logic. Defaults to DefaultTimeoutStartSec= from the manager
521           configuration file (see systemd-system.conf(5)).
522
523       Service=
524           Specifies the service unit name to activate on incoming traffic.
525           This setting is only allowed for sockets with Accept=no. It
526           defaults to the service that bears the same name as the socket
527           (with the suffix replaced). In most cases, it should not be
528           necessary to use this option. Note that setting this parameter
529           might result in additional dependencies to be added to the unit
530           (see above).
531
532       RemoveOnStop=
533           Takes a boolean argument. If enabled, any file nodes created by
534           this socket unit are removed when it is stopped. This applies to
535           AF_UNIX sockets in the file system, POSIX message queues, FIFOs, as
536           well as any symlinks to them configured with Symlinks=. Normally,
537           it should not be necessary to use this option, and is not
538           recommended as services might continue to run after the socket unit
539           has been terminated and it should still be possible to communicate
540           with them via their file system node. Defaults to off.
541
542       Symlinks=
543           Takes a list of file system paths. The specified paths will be
544           created as symlinks to the AF_UNIX socket path or FIFO path of this
545           socket unit. If this setting is used, only one AF_UNIX socket in
546           the file system or one FIFO may be configured for the socket unit.
547           Use this option to manage one or more symlinked alias names for a
548           socket, binding their lifecycle together. Note that if creation of
549           a symlink fails this is not considered fatal for the socket unit,
550           and the socket unit may still start. If an empty string is
551           assigned, the list of paths is reset. Defaults to an empty list.
552
553       FileDescriptorName=
554           Assigns a name to all file descriptors this socket unit
555           encapsulates. This is useful to help activated services identify
556           specific file descriptors, if multiple fds are passed. Services may
557           use the sd_listen_fds_with_names(3) call to acquire the names
558           configured for the received file descriptors. Names may contain any
559           ASCII character, but must exclude control characters and ":", and
560           must be at most 255 characters in length. If this setting is not
561           used, the file descriptor name defaults to the name of the socket
562           unit, including its .socket suffix.
563
564       TriggerLimitIntervalSec=, TriggerLimitBurst=
565           Configures a limit on how often this socket unit may be activated
566           within a specific time interval. The TriggerLimitIntervalSec=
567           setting may be used to configure the length of the time interval in
568           the usual time units "us", "ms", "s", "min", "h", ... and defaults
569           to 2s (See systemd.time(7) for details on the various time units
570           understood). The TriggerLimitBurst= setting takes a positive
571           integer value and specifies the number of permitted activations per
572           time interval, and defaults to 200 for Accept=yes sockets (thus by
573           default permitting 200 activations per 2s), and 20 otherwise (20
574           activations per 2s). Set either to 0 to disable any form of trigger
575           rate limiting.
576
577           If the limit is hit, the socket unit is placed into a failure mode,
578           and will not be connectible anymore until restarted. Note that this
579           limit is enforced before the service activation is enqueued.
580
581           Compare with PollLimitIntervalSec=/PollLimitBurst= described below,
582           which implements a temporary slowdown if a socket unit is flooded
583           with incoming traffic, as opposed to the permanent failure state
584           TriggerLimitIntervalSec=/TriggerLimitBurst= results in.
585
586       PollLimitIntervalSec=, PollLimitBurst=
587           Configures a limit on how often polling events on the file
588           descriptors backing this socket unit will be considered. This pair
589           of settings is similar to
590           TriggerLimitIntervalSec=/TriggerLimitBurst= but instead of putting
591           a (fatal) limit on the activation frequency puts a (transient)
592           limit on the polling frequency. The expected parameter syntax and
593           range are identical to that of the aforementioned options, and can
594           be disabled the same way.
595
596           If the polling limit is hit polling is temporarily disabled on it
597           until the specified time window passes. The polling limit hence
598           slows down connection attempts if hit, but unlike the trigger limit
599           won't cause permanent failures. It's the recommended mechanism to
600           deal with DoS attempts through packet flooding.
601
602           The polling limit is enforced per file descriptor to listen on, as
603           opposed to the trigger limit which is enforced for the entire
604           socket unit. This distinction matters for socket units that listen
605           on multiple file descriptors (i.e. have multiple ListenXYZ=
606           stanzas).
607
608           These setting defaults to 150 (in case of Accept=yes) and 15
609           (otherwise) polling events per 2s. This is considerably lower than
610           the default values for the trigger limit (see above) and means that
611           the polling limit should typically ensure the trigger limit is
612           never hit, unless one of them is reconfigured or disabled.
613
614       Check systemd.unit(5), systemd.exec(5), and systemd.kill(5) for more
615       settings.
616

SEE ALSO

618       systemd(1), systemctl(1), systemd-system.conf(5), systemd.unit(5),
619       systemd.exec(5), systemd.kill(5), systemd.resource-control(5),
620       systemd.service(5), systemd.directives(7), sd_listen_fds(3),
621       sd_listen_fds_with_names(3)
622
623       For more extensive descriptions see the "systemd for Developers"
624       series: Socket Activation[4], Socket Activation, part II[5], Converting
625       inetd Services[6], Socket Activated Internet Services and OS
626       Containers[7].
627

NOTES

629        1. USB FunctionFS
630           https://docs.kernel.org/usb/functionfs.html
631
632        2. TCP Keepalive HOWTO
633           http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
634
635        3. Smack
636           https://docs.kernel.org/admin-guide/LSM/Smack.html
637
638        4. Socket Activation
639           https://0pointer.de/blog/projects/socket-activation.html
640
641        5. Socket Activation, part II
642           https://0pointer.de/blog/projects/socket-activation2.html
643
644        6. Converting inetd Services
645           https://0pointer.de/blog/projects/inetd.html
646
647        7. Socket Activated Internet Services and OS Containers
648           https://0pointer.de/blog/projects/socket-activated-containers.html
649
650
651
652systemd 254                                                  SYSTEMD.SOCKET(5)
Impressum