SPAWN(8)

πŸ“¦
version 3.11.7 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– SPAWN(8) πŸ’–

okay bestie, gather round, because we're about to talk about the Postfix external command spawner and honestly? it's giving chaos gremlin with a job ✨


✨ NAME ✨

spawn β€” Postfix external command spawner 🫢


🌸 SYNOPSIS 🌸

spawn [generic Postfix daemon options] command_attributes...

πŸ¦‹ DESCRIPTION πŸ¦‹

so the spawn(8) daemon is out here monitoring a TCP or UNIX-domain stream socket, and you set that up in master.cf with a service type of inet or unix. periodt.

and the way that it works is: every single time a connection gets established, this daemon spawns an external command β€” and it hooks up the standard input, output and error file descriptors straight to the remote client. literally just hands the whole convo over. iconic behavior honestly πŸ’…

now, the command process is subject to the time limit specified with the parameter transport_time_limit (default: command_time_limit), where transport equals the service name field in master.cf. and if a process exceeds that time limit?? it receives a SIGKILL signal. πŸ’€ no warning, no negotiation, just gone.

also, the spawn(8) daemon service typically has a process limit > 1 in its master.cf service definition, so that the number of processes can scale with demand. she grows when she needs to. main character energy fr fr 🌈


πŸŽ€ COMMAND ATTRIBUTE SYNTAX πŸŽ€

the external command attributes go in the master.cf file, at the end of a service definition. here's the syntax, bestie, take notes πŸ“

  • user=username (required) β€” yep, mandatory, no skipping.
  • user=username:groupname β€” the external command gets executed with the rights of the specified username. but β€” and this is the important part β€” the software refuses to execute commands with root privileges, or with the privileges of the mail system owner. nope. absolutely not. 🚫 If groupname is specified, the corresponding group ID is used instead of the group ID of username.
  • argv=command... (required) β€” the command to be executed. this one must be specified as the last command attribute, no exceptions. and it's executed directly, i.e. without interpretation of shell meta characters by a shell command interpreter. so no sneaky shell nonsense, okay? πŸ™ˆ

now, if a command argument must contain whitespace, or if a command argument must begin with {, you enclose the argument with { and }. this form will ignore whitespace after the outer { and before the outer }. example time, babes:

argv=/bin/sh -c { shell syntax here }

πŸ”₯ DIAGNOSTICS πŸ”₯

the spawn(8) daemon reports abnormal child exits. problems get logged to syslogd(8) or postlogd(8). so if something goes sideways, it will be documented, and everyone will know 😭


πŸ‘‘ SECURITY πŸ‘‘

okay this is the serious bit so listen up fr fr.

the spawn(8) daemon needs root privilege in order to execute external commands as the specified user. it is therefore security sensitive. like, highkey. treat it with respect. 🫑

however β€” and this is the slay part β€” the spawn(8) daemon does not receive data from or about service clients or external commands, and thus is not vulnerable to data-driven attacks. she's locked in. she doesn't take input from strangers. boundaries, bestie. πŸ’–


πŸ’œ CONFIGURATION PARAMETERS πŸ’œ

changes to main.cf are picked up automatically as spawn(8) processes run for only a limited amount of time. use the command postfix reload to speed up a change. go on, you know you want to ✨

the text below provides only a parameter summary. see postconf(5) for more details including examples.

in the text below, transport is the first field of the entry in the master.cf file. iykyk 🧚

⭐ RESOURCE AND RATE CONTROL ⭐

  • transport_time_limit ($command_time_limit) β€” a transport-specific override for the command_time_limit parameter value, where transport is the master.cf name of the message delivery transport.

🌈 MISCELLANEOUS 🌈

  • config_directory (see postconf -d output) β€” the default location of the Postfix main.cf and master.cf configuration files.
  • daemon_timeout (18000s) β€” how much time a Postfix daemon process may take to handle a request before it is terminated by a built-in watchdog timer. ⏰
  • export_environment (see postconf -d output) β€” the list of environment variables that a Postfix process will export to non-Postfix processes.
  • ipc_timeout (3600s) β€” the time limit for sending or receiving information over an internal communication channel.
  • mail_owner (postfix) β€” the UNIX system account that owns the Postfix queue and most Postfix daemon processes.
  • max_idle (100s) β€” the maximum amount of time that an idle Postfix daemon process waits for an incoming connection before terminating voluntarily.
  • max_use (100) β€” the maximal number of incoming connections that a Postfix daemon process will service before terminating voluntarily.
  • process_id (read-only) β€” the process ID of a Postfix command or daemon process.
  • process_name (read-only) β€” the process name of a Postfix command or daemon process.
  • queue_directory (see postconf -d output) β€” the location of the Postfix top-level queue directory.
  • syslog_facility (mail) β€” the syslog facility of Postfix logging.
  • syslog_name (see postconf -d output) β€” a prefix that is prepended to the process name in syslog records, so that, for example, smtpd becomes prefix/smtpd.

πŸ“ available in Postfix 3.3 and later:

  • service_name (read-only) β€” the master.cf service name of a Postfix daemon process.

🫢 SEE ALSO 🫢


πŸ“œ LICENSE πŸ“œ

The Secure Mailer license must be distributed with this software.


πŸ’– AUTHOR(S) πŸ’–

Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA

Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA


and that's the whole page bestie!! πŸŽ€ this was SPAWN(8) from the System Manager's Manual β€” huge thank you to Wietse Venema for the lore, mwah πŸ’‹ now go forth and spawn responsibly, and remember: no root privileges, no mail system owner privileges, and absolutely no shell meta character interpretation. slay πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from