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
17       next-hop host name can be specified as  command-line  macros  that  are
18       expanded 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,
28       multi-recipient delivery is undesirable when prepending a Delivered-to:
29       or X-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              Specify "{" and "}" around command arguments that contain white‐
191              space (Postfix 3.0 and later). Whitespace after "{"  and  before
192              "}" is ignored.
193
194              In  the command argument vector, the following macros are recog‐
195              nized and replaced with corresponding information from the Post‐
196              fix queue manager delivery request.
197
198              In  addition to the form ${name}, the forms $name and the depre‐
199              cated form $(name) are also recognized.  Specify $$ where a sin‐
200              gle $ is wanted.
201
202              ${client_address}
203                     This macro expands to the remote client network address.
204
205                     This feature is available as of Postfix 2.2.
206
207              ${client_helo}
208                     This  macro  expands  to  the  remote client HELO command
209                     parameter.
210
211                     This feature is available as of Postfix 2.2.
212
213              ${client_hostname}
214                     This macro expands to the remote client hostname.
215
216                     This feature is available as of Postfix 2.2.
217
218              ${client_port}
219                     This macro expands to the remote client TCP port number.
220
221                     This feature is available as of Postfix 2.5.
222
223              ${client_protocol}
224                     This macro expands to the remote client protocol.
225
226                     This feature is available as of Postfix 2.2.
227
228              ${domain}
229                     This macro expands to the domain portion of the recipient
230                     address.   For  example,  with an address user+foo@domain
231                     the domain is domain.
232
233                     This information is modified by the h flag for case fold‐
234                     ing.
235
236                     This feature is available as of Postfix 2.5.
237
238              ${extension}
239                     This  macro  expands to the extension part of a recipient
240                     address.  For example, with  an  address  user+foo@domain
241                     the extension is foo.
242
243                     A   command-line   argument  that  contains  ${extension}
244                     expands into as many command-line arguments as there  are
245                     recipients.
246
247                     This information is modified by the u flag for case fold‐
248                     ing.
249
250              ${mailbox}
251                     This macro expands to the complete local part of a recip‐
252                     ient    address.     For   example,   with   an   address
253                     user+foo@domain the mailbox is user+foo.
254
255                     A command-line argument that contains ${mailbox}  expands
256                     to  as  many  command-line arguments as there are recipi‐
257                     ents.
258
259                     This information is modified by the u flag for case fold‐
260                     ing.
261
262              ${nexthop}
263                     This macro expands to the next-hop hostname.
264
265                     This information is modified by the h flag for case fold‐
266                     ing.
267
268              ${original_recipient}
269                     This macro expands  to  the  complete  recipient  address
270                     before any address rewriting or aliasing.
271
272                     A  command-line argument that contains ${original_recipi‐
273                     ent} expands to as many command-line arguments  as  there
274                     are recipients.
275
276                     This information is modified by the hqu flags for quoting
277                     and case folding.
278
279                     This feature is available as of Postfix 2.5.
280
281              ${queue_id}
282                     This macro expands to the queue id.
283
284                     This feature is available as of Postfix 2.11.
285
286              ${recipient}
287                     This macro expands to the complete recipient address.
288
289                     A  command-line  argument  that   contains   ${recipient}
290                     expands  to  as  many command-line arguments as there are
291                     recipients.
292
293                     This information is modified by the hqu flags for quoting
294                     and case folding.
295
296              ${sasl_method}
297                     This macro expands to the name of the SASL authentication
298                     mechanism in the  AUTH  command  when  the  Postfix  SMTP
299                     server received the message.
300
301                     This feature is available as of Postfix 2.2.
302
303              ${sasl_sender}
304                     This  macro  expands  to  the  SASL sender name (i.e. the
305                     original submitter as per RFC 4954) in the MAIL FROM com‐
306                     mand when the Postfix SMTP server received the message.
307
308                     This feature is available as of Postfix 2.2.
309
310              ${sasl_username}
311                     This macro expands to the SASL user name in the AUTH com‐
312                     mand when the Postfix SMTP server received the message.
313
314                     This feature is available as of Postfix 2.2.
315
316              ${sender}
317                     This macro expands to the  envelope  sender  address.  By
318                     default,  the  null sender address expands to MAILER-DAE‐
319                     MON; this can be changed with the null_sender  attribute,
320                     as described above.
321
322                     This information is modified by the q flag for quoting.
323
324              ${size}
325                     This macro expands to Postfix's idea of the message size,
326                     which is an approximation of the size of the  message  as
327                     delivered.
328
329              ${user}
330                     This  macro  expands  to the username part of a recipient
331                     address.  For example, with  an  address  user+foo@domain
332                     the username part is user.
333
334                     A  command-line  argument  that  contains ${user} expands
335                     into as many command-line arguments as there are  recipi‐
336                     ents.
337
338                     This information is modified by the u flag for case fold‐
339                     ing.
340

STANDARDS

342       RFC 3463 (Enhanced status codes)
343

DIAGNOSTICS

345       Command exit status  codes  are  expected  to  follow  the  conventions
346       defined in <sysexits.h>.  Exit status 0 means normal successful comple‐
347       tion.
348
349       In the case of a non-zero exit status, a limited amount of command out‐
350       put  is  logged,  and reported in a delivery status notification.  When
351       the output begins with a 4.X.X or 5.X.X enhanced status code, the  sta‐
352       tus  code  takes precedence over the non-zero exit status (Postfix ver‐
353       sion 2.3 and later).
354
355       After successful delivery (zero exit status) a limited amount  of  com‐
356       mand  output is logged, and reported in "success" delivery status noti‐
357       fications (Postfix 3.0 and later).  This command output is not examined
358       for the presence of an enhanced status code.
359
360       Problems  and transactions are logged to syslogd(8).  Corrupted message
361       files are marked so that the queue manager can move them to the corrupt
362       queue for further inspection.
363

SECURITY

365       This  program needs a dual personality 1) to access the private Postfix
366       queue and IPC mechanisms, and 2) to execute external  commands  as  the
367       specified user. It is therefore security sensitive.
368

CONFIGURATION PARAMETERS

370       Changes to main.cf are picked up automatically as pipe(8) processes run
371       for only a limited amount of time. Use the command "postfix reload"  to
372       speed up a change.
373
374       The  text  below provides only a parameter summary. See postconf(5) for
375       more details including examples.
376

RESOURCE AND RATE CONTROLS

378       In the text below, transport is the first field in a master.cf entry.
379
380       transport_time_limit ($command_time_limit)
381              A transport-specific override for the command_time_limit parame‐
382              ter  value, where transport is the master.cf name of the message
383              delivery transport.
384
385       Implemented in the qmgr(8) daemon:
386
387       transport_destination_concurrency_limit   ($default_destination_concur‐
388       rency_limit)
389              A  transport-specific  override for the default_destination_con‐
390              currency_limit parameter value, where transport is the master.cf
391              name of the message delivery transport.
392
393       transport_destination_recipient_limit     ($default_destination_recipi‐
394       ent_limit)
395              A transport-specific override for the default_destination_recip‐
396              ient_limit  parameter  value,  where  transport is the master.cf
397              name of the message delivery transport.
398

MISCELLANEOUS CONTROLS

400       config_directory (see 'postconf -d' output)
401              The default location of the Postfix main.cf and  master.cf  con‐
402              figuration files.
403
404       daemon_timeout (18000s)
405              How  much  time  a  Postfix  daemon process may take to handle a
406              request before it is terminated by a built-in watchdog timer.
407
408       delay_logging_resolution_limit (2)
409              The maximal number of digits after the decimal point  when  log‐
410              ging sub-second delay values.
411
412       export_environment (see 'postconf -d' output)
413              The  list  of  environment variables that a Postfix process will
414              export to non-Postfix processes.
415
416       ipc_timeout (3600s)
417              The time limit for sending  or  receiving  information  over  an
418              internal communication channel.
419
420       mail_owner (postfix)
421              The  UNIX  system  account  that owns the Postfix queue and most
422              Postfix daemon processes.
423
424       max_idle (100s)
425              The maximum amount of time that an idle Postfix  daemon  process
426              waits for an incoming connection before terminating voluntarily.
427
428       max_use (100)
429              The maximal number of incoming connections that a Postfix daemon
430              process will service before terminating voluntarily.
431
432       process_id (read-only)
433              The process ID of a Postfix command or daemon process.
434
435       process_name (read-only)
436              The process name of a Postfix command or daemon process.
437
438       queue_directory (see 'postconf -d' output)
439              The location of the Postfix top-level queue directory.
440
441       recipient_delimiter (empty)
442              The set of characters that can separate a  user  name  from  its
443              extension  (example: user+foo), or a .forward file name from its
444              extension (example: .forward+foo).
445
446       syslog_facility (mail)
447              The syslog facility of Postfix logging.
448
449       syslog_name (see 'postconf -d' output)
450              A prefix that  is  prepended  to  the  process  name  in  syslog
451              records, so that, for example, "smtpd" becomes "prefix/smtpd".
452
453       Available in Postfix version 3.0 and later:
454
455       pipe_delivery_status_filter ($default_delivery_status_filter)
456              Optional  filter  for  the  pipe(8) delivery agent to change the
457              delivery status code or explanatory text of successful or unsuc‐
458              cessful deliveries.
459
460       Available in Postfix version 3.3 and later:
461
462       enable_original_recipient (yes)
463              Enable  support  for  the  original  recipient  address after an
464              address is rewritten to a different address  (for  example  with
465              aliasing or with canonical mapping).
466
467       service_name (read-only)
468              The master.cf service name of a Postfix daemon process.
469

SEE ALSO

471       qmgr(8), queue manager
472       bounce(8), delivery status reports
473       postconf(5), configuration parameters
474       master(5), generic daemon options
475       master(8), process manager
476       syslogd(8), system logging
477

LICENSE

479       The Secure Mailer license must be distributed with this software.
480

AUTHOR(S)

482       Wietse Venema
483       IBM T.J. Watson Research
484       P.O. Box 704
485       Yorktown Heights, NY 10598, USA
486
487       Wietse Venema
488       Google, Inc.
489       111 8th Avenue
490       New York, NY 10011, USA
491
492
493
494                                                                       PIPE(8)
Impressum