1PIPE(8)                     System Manager's Manual                    PIPE(8)
2
3
4

NAME

6       pipe - Postfix delivery to external command
7

SYNOPSIS

9       pipe [generic Postfix daemon options] command_attributes...
10

DESCRIPTION

12       The pipe(8) daemon processes requests from the Postfix queue manager to
13       deliver messages to external commands.  This program expects to be  run
14       from the master(8) process manager.
15
16       Message  attributes such as sender address, recipient address and next-
17       hop host name can be specified as command-line macros that are expanded
18       before the external command is executed.
19
20       The  pipe(8)  daemon  updates  queue files and marks recipients as fin‐
21       ished, or it informs the queue manager that delivery  should  be  tried
22       again  at  a  later  time.  Delivery  status  reports  are  sent to the
23       bounce(8), defer(8) or trace(8) daemon as appropriate.
24

SINGLE-RECIPIENT DELIVERY

26       Some destinations cannot handle more than one  recipient  per  delivery
27       request.  Examples  are  pagers  or  fax machines.  In addition, multi-
28       recipient delivery is undesirable when prepending a Delivered-to: or X-
29       Original-To: message header.
30
31       To  prevent  Postfix  from  sending  multiple  recipients  per delivery
32       request, specify
33
34           transport_destination_recipient_limit = 1
35
36       in the Postfix main.cf file, where transport is the name in  the  first
37       column  of  the  Postfix  master.cf  entry  for the pipe-based delivery
38       transport.
39

COMMAND ATTRIBUTE SYNTAX

41       The external command attributes are given in the master.cf file at  the
42       end of a service definition.  The syntax is as follows:
43
44       chroot=pathname (optional)
45              Change  the  process root directory and working directory to the
46              named directory. This happens before switching to the privileges
47              specified  with  the  user  attribute,  and before executing the
48              optional directory=pathname directive. Delivery is  deferred  in
49              case of failure.
50
51              This feature is available as of Postfix 2.3.
52
53       directory=pathname (optional)
54              Change to the named directory before executing the external com‐
55              mand.  The directory must be accessible for the  user  specified
56              with the user attribute (see below).  The default working direc‐
57              tory is $queue_directory.  Delivery is deferred in case of fail‐
58              ure.
59
60              This feature is available as of Postfix 2.2.
61
62       eol=string (optional, default: \n)
63              The output record delimiter. Typically one would use either \r\n
64              or \n. The usual C-style backslash escape sequences  are  recog‐
65              nized:  \a \b \f \n \r \t \v \ddd (up to three octal digits) and
66              \\.
67
68       flags=BDFORXhqu.> (optional)
69              Optional message processing flags.  By  default,  a  message  is
70              copied unchanged.
71
72              B      Append  a  blank line at the end of each message. This is
73                     required by some mail user agents that recognize "From  "
74                     lines only when preceded by a blank line.
75
76              D      Prepend  a  "Delivered-To: recipient" message header with
77                     the envelope recipient address. Note: for this  to  work,
78                     the  transport_destination_recipient_limit must be 1 (see
79                     SINGLE-RECIPIENT DELIVERY above for details).
80
81                     The D flag also enforces loop detection (Postfix 2.5  and
82                     later):  if  a  message  already contains a Delivered-To:
83                     header with the same recipient address, then the  message
84                     is  returned  as undeliverable. The address comparison is
85                     case insensitive.
86
87                     This feature is available as of Postfix 2.0.
88
89              F      Prepend a "From sender time_stamp" envelope header to the
90                     message  content.  This is expected by, for example, UUCP
91                     software.
92
93              O      Prepend an "X-Original-To: recipient" message header with
94                     the recipient address as given to Postfix. Note: for this
95                     to work, the  transport_destination_recipient_limit  must
96                     be 1 (see SINGLE-RECIPIENT DELIVERY above for details).
97
98                     This feature is available as of Postfix 2.0.
99
100              R      Prepend  a  Return-Path: message header with the envelope
101                     sender address.
102
103              X      Indicate that the external command performs final  deliv‐
104                     ery.   This flag affects the status reported in "success"
105                     DSN (delivery status notification) messages, and  changes
106                     it from "relayed" into "delivered".
107
108                     This feature is available as of Postfix 2.5.
109
110              h      Fold  the command-line $original_recipient and $recipient
111                     address domain part (text to the right of the  right-most
112                     @  character) to lower case; fold the entire command-line
113                     $domain and $nexthop host or domain information to  lower
114                     case.  This is recommended for delivery via UUCP.
115
116              q      Quote  white  space  and  other special characters in the
117                     command-line $sender, $original_recipient and  $recipient
118                     address  localparts (text to the left of the right-most @
119                     character), according to an 8-bit transparent version  of
120                     RFC  822.   This  is recommended for delivery via UUCP or
121                     BSMTP.
122
123                     The result is compatible with the address parsing of com‐
124                     mand-line recipients by the Postfix sendmail(1) mail sub‐
125                     mission command.
126
127                     The q flag affects only entire addresses, not the partial
128                     address  information from the $user, $extension or $mail‐
129                     box command-line macros.
130
131              u      Fold the command-line $original_recipient and  $recipient
132                     address  localpart  (text to the left of the right-most @
133                     character) to lower case.  This is recommended for deliv‐
134                     ery via UUCP.
135
136              .      Prepend  "."  to  lines starting with ".". This is needed
137                     by, for example, BSMTP software.
138
139              >      Prepend ">" to lines  starting  with  "From  ".  This  is
140                     expected by, for example, UUCP software.
141
142       null_sender=replacement (default: MAILER-DAEMON)
143              Replace  the  null  sender  address (typically used for delivery
144              status notifications) with the specified text when expanding the
145              $sender  command-line  macro,  and  when  generating  a From_ or
146              Return-Path: message header.
147
148              If the null sender replacement text is a non-empty  string  then
149              it is affected by the q flag for address quoting in command-line
150              arguments.
151
152              The null sender replacement text may be empty; this form is rec‐
153              ommended  for  content filters that feed mail back into Postfix.
154              The empty sender address is not  affected  by  the  q  flag  for
155              address quoting in command-line arguments.
156
157              Caution:  a  null  sender  address is easily mis-parsed by naive
158              software. For example, when the pipe(8) daemon executes  a  com‐
159              mand such as:
160
161                  Wrong: command -f$sender -- $recipient
162
163              the  command  will mis-parse the -f option value when the sender
164              address is a null string.  For correct parsing, specify  $sender
165              as an argument by itself:
166
167                  Right: command -f $sender -- $recipient
168
169              This feature is available as of Postfix 2.3.
170
171       size=size_limit (optional)
172              Don't  deliver  messages that exceed this size limit (in bytes);
173              return them to the sender instead.
174
175       user=username (required)
176
177       user=username:groupname
178              Execute the external command with the user ID and  group  ID  of
179              the  specified  username.   The software refuses to execute com‐
180              mands with root privileges, or with the privileges of  the  mail
181              system owner. If groupname is specified, the corresponding group
182              ID is used instead of the group ID of username.
183
184       argv=command... (required)
185              The command to be executed. This must be specified as  the  last
186              command attribute.  The command is executed directly, i.e. with‐
187              out interpretation of shell meta characters by a  shell  command
188              interpreter.
189
190              In  the command argument vector, the following macros are recog‐
191              nized and replaced with corresponding information from the Post‐
192              fix queue manager delivery request.
193
194              In addition to the form ${name}, the forms $name and $(name) are
195              also recognized.  Specify $$ where a single $ is wanted.
196
197              ${client_address}
198                     This macro expands to the remote client network address.
199
200                     This feature is available as of Postfix 2.2.
201
202              ${client_helo}
203                     This macro expands to  the  remote  client  HELO  command
204                     parameter.
205
206                     This feature is available as of Postfix 2.2.
207
208              ${client_hostname}
209                     This macro expands to the remote client hostname.
210
211                     This feature is available as of Postfix 2.2.
212
213              ${client_port}
214                     This macro expands to the remote client TCP port number.
215
216                     This feature is available as of Postfix 2.5.
217
218              ${client_protocol}
219                     This macro expands to the remote client protocol.
220
221                     This feature is available as of Postfix 2.2.
222
223              ${domain}
224                     This macro expands to the domain portion of the recipient
225                     address.  For example, with  an  address  user+foo@domain
226                     the domain is domain.
227
228                     This information is modified by the h flag for case fold‐
229                     ing.
230
231                     This feature is available as of Postfix 2.5.
232
233              ${extension}
234                     This macro expands to the extension part of  a  recipient
235                     address.   For  example,  with an address user+foo@domain
236                     the extension is foo.
237
238                     A  command-line  argument  that   contains   ${extension}
239                     expands  into as many command-line arguments as there are
240                     recipients.
241
242                     This information is modified by the u flag for case fold‐
243                     ing.
244
245              ${mailbox}
246                     This macro expands to the complete local part of a recip‐
247                     ient   address.    For   example,   with    an    address
248                     user+foo@domain the mailbox is user+foo.
249
250                     A  command-line argument that contains ${mailbox} expands
251                     to as many command-line arguments as  there  are  recipi‐
252                     ents.
253
254                     This information is modified by the u flag for case fold‐
255                     ing.
256
257              ${nexthop}
258                     This macro expands to the next-hop hostname.
259
260                     This information is modified by the h flag for case fold‐
261                     ing.
262
263              ${original_recipient}
264                     This  macro  expands  to  the  complete recipient address
265                     before any address rewriting or aliasing.
266
267                     A command-line argument that contains  ${original_recipi‐
268                     ent}  expands  to as many command-line arguments as there
269                     are recipients.
270
271                     This information is modified by the hqu flags for quoting
272                     and case folding.
273
274                     This feature is available as of Postfix 2.5.
275
276              ${recipient}
277                     This macro expands to the complete recipient address.
278
279                     A   command-line   argument  that  contains  ${recipient}
280                     expands to as many command-line arguments  as  there  are
281                     recipients.
282
283                     This information is modified by the hqu flags for quoting
284                     and case folding.
285
286              ${sasl_method}
287                     This macro expands to the name of the SASL authentication
288                     mechanism  in  the  AUTH  command  when  the Postfix SMTP
289                     server received the message.
290
291                     This feature is available as of Postfix 2.2.
292
293              ${sasl_sender}
294                     This macro expands to the  SASL  sender  name  (i.e.  the
295                     original submitter as per RFC 4954) in the MAIL FROM com‐
296                     mand when the Postfix SMTP server received the message.
297
298                     This feature is available as of Postfix 2.2.
299
300              ${sasl_username}
301                     This macro expands to the SASL user name in the AUTH com‐
302                     mand when the Postfix SMTP server received the message.
303
304                     This feature is available as of Postfix 2.2.
305
306              ${sender}
307                     This  macro  expands  to  the envelope sender address. By
308                     default, the null sender address expands  to  MAILER-DAE‐
309                     MON;  this can be changed with the null_sender attribute,
310                     as described above.
311
312                     This information is modified by the q flag for quoting.
313
314              ${size}
315                     This macro expands to Postfix's idea of the message size,
316                     which  is  an approximation of the size of the message as
317                     delivered.
318
319              ${user}
320                     This macro expands to the username part  of  a  recipient
321                     address.   For  example,  with an address user+foo@domain
322                     the username part is user.
323
324                     A command-line argument  that  contains  ${user}  expands
325                     into  as many command-line arguments as there are recipi‐
326                     ents.
327
328                     This information is modified by the u flag for case fold‐
329                     ing.
330

STANDARDS

332       RFC 3463 (Enhanced status codes)
333

DIAGNOSTICS

335       Command  exit  status  codes  are  expected  to  follow the conventions
336       defined in <sysexits.h>.  Exit status 0 means normal successful comple‐
337       tion.
338
339       In the case of a non-zero exit status, a limited amount of command out‐
340       put is reported in an delivery status notification.   When  the  output
341       begins  with  a  4.X.X  or  5.X.X enhanced status code, the status code
342       takes precedence over the non-zero exit status (Postfix version 2.3 and
343       later).
344
345       Problems  and transactions are logged to syslogd(8).  Corrupted message
346       files are marked so that the queue manager can move them to the corrupt
347       queue for further inspection.
348

SECURITY

350       This  program needs a dual personality 1) to access the private Postfix
351       queue and IPC mechanisms, and 2) to execute external  commands  as  the
352       specified user. It is therefore security sensitive.
353

CONFIGURATION PARAMETERS

355       Changes to main.cf are picked up automatically as pipe(8) processes run
356       for only a limited amount of time. Use the command "postfix reload"  to
357       speed up a change.
358
359       The  text  below provides only a parameter summary. See postconf(5) for
360       more details including examples.
361

RESOURCE AND RATE CONTROLS

363       In the text below, transport is the first field in a master.cf entry.
364
365       transport_destination_concurrency_limit   ($default_destination_concur‐
366       rency_limit)
367              Limit the number of parallel deliveries to the same destination,
368              for delivery via the named transport.  The limit is enforced  by
369              the Postfix queue manager.
370
371       transport_destination_recipient_limit     ($default_destination_recipi‐
372       ent_limit)
373              Limit the number of recipients per message delivery, for  deliv‐
374              ery via the named transport.  The limit is enforced by the Post‐
375              fix queue manager.
376
377       transport_time_limit ($command_time_limit)
378              Limit the time for delivery to external  command,  for  delivery
379              via  the  named  transport.   The  limit is enforced by the pipe
380              delivery agent.
381
382              Postfix 2.4 and later support a suffix that specifies  the  time
383              unit:  s (seconds), m (minutes), h (hours), d (days), w (weeks).
384              The default time unit is seconds.
385

MISCELLANEOUS CONTROLS

387       config_directory (see 'postconf -d' output)
388              The default location of the Postfix main.cf and  master.cf  con‐
389              figuration files.
390
391       daemon_timeout (18000s)
392              How  much  time  a  Postfix  daemon process may take to handle a
393              request before it is terminated by a built-in watchdog timer.
394
395       delay_logging_resolution_limit (2)
396              The maximal number of digits after the decimal point  when  log‐
397              ging sub-second delay values.
398
399       export_environment (see 'postconf -d' output)
400              The  list  of  environment variables that a Postfix process will
401              export to non-Postfix processes.
402
403       ipc_timeout (3600s)
404              The time limit for sending  or  receiving  information  over  an
405              internal communication channel.
406
407       mail_owner (postfix)
408              The  UNIX  system  account  that owns the Postfix queue and most
409              Postfix daemon processes.
410
411       max_idle (100s)
412              The maximum amount of time that an idle Postfix  daemon  process
413              waits for an incoming connection before terminating voluntarily.
414
415       max_use (100)
416              The maximal number of incoming connections that a Postfix daemon
417              process will service before terminating voluntarily.
418
419       process_id (read-only)
420              The process ID of a Postfix command or daemon process.
421
422       process_name (read-only)
423              The process name of a Postfix command or daemon process.
424
425       queue_directory (see 'postconf -d' output)
426              The location of the Postfix top-level queue directory.
427
428       recipient_delimiter (empty)
429              The  separator  between  user  names  and   address   extensions
430              (user+foo).
431
432       syslog_facility (mail)
433              The syslog facility of Postfix logging.
434
435       syslog_name (see 'postconf -d' output)
436              The  mail  system  name that is prepended to the process name in
437              syslog records, so that "smtpd"  becomes,  for  example,  "post‐
438              fix/smtpd".
439

SEE ALSO

441       qmgr(8), queue manager
442       bounce(8), delivery status reports
443       postconf(5), configuration parameters
444       master(5), generic daemon options
445       master(8), process manager
446       syslogd(8), system logging
447

LICENSE

449       The Secure Mailer license must be distributed with this software.
450

AUTHOR(S)

452       Wietse Venema
453       IBM T.J. Watson Research
454       P.O. Box 704
455       Yorktown Heights, NY 10598, USA
456
457
458
459                                                                       PIPE(8)
Impressum