xref: /netbsd-src/external/ibm-public/postfix/dist/html/postmap.1.html (revision fdd524d4ccd2bb0c6f67401e938dabf773eb0372)
1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3<html> <head>
4<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
5<title> Postfix manual - postmap(1) </title>
6</head> <body> <pre>
7POSTMAP(1)                                                          POSTMAP(1)
8
9<b>NAME</b>
10       postmap - Postfix lookup table management
11
12<b>SYNOPSIS</b>
13       <b>postmap</b> [<b>-Nbfhimnoprsvw</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-d</b> <i>key</i>] [<b>-q</b> <i>key</i>]
14               [<i>file</i><b>_</b><i>type</i>:]<i>file</i><b>_</b><i>name</i> ...
15
16<b>DESCRIPTION</b>
17       The  <a href="postmap.1.html"><b>postmap</b>(1)</a>  command  creates or queries one or more Postfix lookup
18       tables, or updates an existing one. The input and output  file  formats
19       are expected to be compatible with:
20
21           <b>makemap</b> <i>file</i><b>_</b><i>type file</i><b>_</b><i>name</i> &lt; <i>file</i><b>_</b><i>name</i>
22
23       If  the  result  files  do not exist they will be created with the same
24       group and other read permissions as their source file.
25
26       While the table update is in progress, signal  delivery  is  postponed,
27       and  an  exclusive,  advisory,  lock  is placed on the entire table, in
28       order to avoid surprises in spectator processes.
29
30<b>INPUT FILE FORMAT</b>
31       The format of a lookup table input file is as follows:
32
33       <b>o</b>      A table entry has the form
34
35                   <i>key</i> whitespace <i>value</i>
36
37       <b>o</b>      Empty lines and whitespace-only lines are ignored, as are  lines
38              whose first non-whitespace character is a `#'.
39
40       <b>o</b>      A  logical  line  starts  with  non-whitespace text. A line that
41              starts with whitespace continues a logical line.
42
43       The <i>key</i> and <i>value</i> are processed as is, except  that  surrounding  white
44       space is stripped off. Unlike with Postfix alias databases, quotes can-
45       not be used to protect lookup keys that contain special characters such
46       as `#' or whitespace.
47
48       By  default  the  lookup key is mapped to lowercase to make the lookups
49       case insensitive; as of Postfix 2.3 this case folding happens only with
50       tables whose lookup keys are fixed-case strings such as <a href="DATABASE_README.html#types">btree</a>:, <a href="DATABASE_README.html#types">dbm</a>: or
51       <a href="DATABASE_README.html#types">hash</a>:. With earlier versions, the lookup key is folded even with tables
52       where  a lookup field can match both upper and lower case text, such as
53       <a href="regexp_table.5.html">regexp</a>: and <a href="pcre_table.5.html">pcre</a>:. This resulted in loss of  information  with  $<i>number</i>
54       substitutions.
55
56<b>COMMAND-LINE ARGUMENTS</b>
57       <b>-b</b>     Enable  message  body  query mode. When reading lookup keys from
58              standard input with "<b>-q -</b>", process the input as  if  it  is  an
59              email  message  in  <a href="http://tools.ietf.org/html/rfc2822">RFC  2822</a> format.  Each line of body content
60              becomes one lookup key.
61
62              By default, the <b>-b</b> option starts generating lookup keys  at  the
63              first  non-header line, and stops when the end of the message is
64              reached.  To simulate  <a href="header_checks.5.html"><b>body_checks</b>(5)</a>  processing,  enable  MIME
65              parsing  with  <b>-m</b>.  With  this, the <b>-b</b> option generates no body-
66              style lookup keys for attachment MIME headers and  for  attached
67              message/* headers.
68
69              This feature is available in Postfix version 2.6 and later.
70
71       <b>-c</b> <i>config</i><b>_</b><i>dir</i>
72              Read  the  <a href="postconf.5.html"><b>main.cf</b></a>  configuration  file  in  the named directory
73              instead of the default configuration directory.
74
75       <b>-d</b> <i>key</i> Search the specified maps for <i>key</i> and remove one entry per  map.
76              The  exit  status  is  zero  when  the requested information was
77              found.
78
79              If a key value of <b>-</b> is specified, the program reads  key  values
80              from  the standard input stream. The exit status is zero when at
81              least one of the requested keys was found.
82
83       <b>-f</b>     Do not fold the lookup key  to  lower  case  while  creating  or
84              querying a table.
85
86              With  Postfix  version  2.3 and later, this option has no effect
87              for regular expression tables. There, case folding is controlled
88              by appending a flag to a pattern.
89
90       <b>-h</b>     Enable  message header query mode. When reading lookup keys from
91              standard input with "<b>-q -</b>", process the input as  if  it  is  an
92              email  message  in  <a href="http://tools.ietf.org/html/rfc2822">RFC  2822</a>  format.  Each logical header line
93              becomes one lookup key. A multi-line header becomes  one  lookup
94              key with one or more embedded newline characters.
95
96              By  default, the <b>-h</b> option generates lookup keys until the first
97              non-header line is reached.  To simulate  <a href="header_checks.5.html"><b>header_checks</b>(5)</a>  pro-
98              cessing,  enable  MIME parsing with <b>-m</b>. With this, the <b>-h</b> option
99              also generates header-style  lookup  keys  for  attachment  MIME
100              headers and for attached message/* headers.
101
102              This feature is available in Postfix version 2.6 and later.
103
104       <b>-i</b>     Incremental  mode.  Read  entries from standard input and do not
105              truncate an existing database. By default, <a href="postmap.1.html"><b>postmap</b>(1)</a> creates  a
106              new database from the entries in <b>file_name</b>.
107
108       <b>-m</b>     Enable MIME parsing with "<b>-b</b>" and "<b>-h</b>".
109
110              This feature is available in Postfix version 2.6 and later.
111
112       <b>-N</b>     Include  the  terminating  null character that terminates lookup
113              keys and values. By default, <a href="postmap.1.html"><b>postmap</b>(1)</a>  does  whatever  is  the
114              default for the host operating system.
115
116       <b>-n</b>     Don't  include  the  terminating  null character that terminates
117              lookup keys and values. By default, <a href="postmap.1.html"><b>postmap</b>(1)</a> does whatever  is
118              the default for the host operating system.
119
120       <b>-o</b>     Do  not release root privileges when processing a non-root input
121              file. By default, <a href="postmap.1.html"><b>postmap</b>(1)</a> drops root privileges and  runs  as
122              the source file owner instead.
123
124       <b>-p</b>     Do  not  inherit the file access permissions from the input file
125              when creating a new file.   Instead,  create  a  new  file  with
126              default access permissions (mode 0644).
127
128       <b>-q</b> <i>key</i> Search  the  specified  maps  for  <i>key</i> and write the first value
129              found to the standard output stream. The  exit  status  is  zero
130              when the requested information was found.
131
132              If  a  key value of <b>-</b> is specified, the program reads key values
133              from the standard input stream and writes one line of <i>key  value</i>
134              output for each key that was found. The exit status is zero when
135              at least one of the requested keys was found.
136
137       <b>-r</b>     When updating a table, do not complain about attempts to  update
138              existing entries, and make those updates anyway.
139
140       <b>-s</b>     Retrieve  all database elements, and write one line of <i>key value</i>
141              output for each element. The elements are  printed  in  database
142              order,  which  is not necessarily the same as the original input
143              order.
144
145              This feature is available in Postfix version 2.2 and later,  and
146              is not available for all database types.
147
148       <b>-v</b>     Enable  verbose  logging  for  debugging  purposes.  Multiple <b>-v</b>
149              options make the software increasingly verbose.
150
151       <b>-w</b>     When updating a table, do not complain about attempts to  update
152              existing entries, and ignore those attempts.
153
154       Arguments:
155
156       <i>file</i><b>_</b><i>type</i>
157              The database type. To find out what types are supported, use the
158              "<b>postconf -m</b>" command.
159
160              The <a href="postmap.1.html"><b>postmap</b>(1)</a> command can query any supported file type, but it
161              can create only the following file types:
162
163              <b>btree</b>  The  output  file  is  a  btree file, named <i>file</i><b>_</b><i>name</i><b>.db</b>.
164                     This is available on systems with support  for  <b>db</b>  data-
165                     bases.
166
167              <b>cdb</b>    The  output  consists  of  one file, named <i>file</i><b>_</b><i>name</i><b>.cdb</b>.
168                     This is available on systems with support for  <b>cdb</b>  data-
169                     bases.
170
171              <b>dbm</b>    The output consists of two files, named <i>file</i><b>_</b><i>name</i><b>.pag</b> and
172                     <i>file</i><b>_</b><i>name</i><b>.dir</b>.  This is available on systems with support
173                     for <b>dbm</b> databases.
174
175              <b>hash</b>   The  output  file  is  a hashed file, named <i>file</i><b>_</b><i>name</i><b>.db</b>.
176                     This is available on systems with support  for  <b>db</b>  data-
177                     bases.
178
179              <b>fail</b>   A  table that reliably fails all requests. The lookup ta-
180                     ble name is used for logging only. This table  exists  to
181                     simplify Postfix error tests.
182
183              <b>sdbm</b>   The output consists of two files, named <i>file</i><b>_</b><i>name</i><b>.pag</b> and
184                     <i>file</i><b>_</b><i>name</i><b>.dir</b>.  This is available on systems with support
185                     for <b>sdbm</b> databases.
186
187              When  no  <i>file</i><b>_</b><i>type</i> is specified, the software uses the database
188              type  specified  via  the  <b><a href="postconf.5.html#default_database_type">default_database_type</a></b>   configuration
189              parameter.
190
191       <i>file</i><b>_</b><i>name</i>
192              The name of the lookup table source file when rebuilding a data-
193              base.
194
195<b>DIAGNOSTICS</b>
196       Problems are logged to the standard error stream and to <b>syslogd</b>(8).  No
197       output  means  that  no  problems  were detected. Duplicate entries are
198       skipped and are flagged with a warning.
199
200       <a href="postmap.1.html"><b>postmap</b>(1)</a> terminates with zero exit status in case of success (includ-
201       ing  successful  "<b>postmap -q</b>" lookup) and terminates with non-zero exit
202       status in case of failure.
203
204<b>ENVIRONMENT</b>
205       <b>MAIL_CONFIG</b>
206              Directory with Postfix configuration files.
207
208       <b>MAIL_VERBOSE</b>
209              Enable verbose logging for debugging purposes.
210
211<b>CONFIGURATION PARAMETERS</b>
212       The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant to  this  pro-
213       gram.   The  text  below  provides  only a parameter summary. See <a href="postconf.5.html"><b>post-</b></a>
214       <a href="postconf.5.html"><b>conf</b>(5)</a> for more details including examples.
215
216       <b><a href="postconf.5.html#berkeley_db_create_buffer_size">berkeley_db_create_buffer_size</a> (16777216)</b>
217              The per-table I/O buffer size for programs that create  Berkeley
218              DB hash or btree tables.
219
220       <b><a href="postconf.5.html#berkeley_db_read_buffer_size">berkeley_db_read_buffer_size</a> (131072)</b>
221              The per-table I/O buffer size for programs that read Berkeley DB
222              hash or btree tables.
223
224       <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
225              The default location of the Postfix <a href="postconf.5.html">main.cf</a> and  <a href="master.5.html">master.cf</a>  con-
226              figuration files.
227
228       <b><a href="postconf.5.html#default_database_type">default_database_type</a> (see 'postconf -d' output)</b>
229              The default database type for use in <a href="newaliases.1.html"><b>newaliases</b>(1)</a>, <a href="postalias.1.html"><b>postalias</b>(1)</a>
230              and <a href="postmap.1.html"><b>postmap</b>(1)</a> commands.
231
232       <b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
233              The syslog facility of Postfix logging.
234
235       <b><a href="postconf.5.html#syslog_name">syslog_name</a> (see 'postconf -d' output)</b>
236              The mail system name that is prepended to the  process  name  in
237              syslog  records,  so  that  "smtpd" becomes, for example, "post-
238              fix/smtpd".
239
240<b>SEE ALSO</b>
241       <a href="postalias.1.html">postalias(1)</a>, create/update/query alias database
242       <a href="postconf.1.html">postconf(1)</a>, supported database types
243       <a href="postconf.5.html">postconf(5)</a>, configuration parameters
244       syslogd(8), system logging
245
246<b>README FILES</b>
247       <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
248
249<b>LICENSE</b>
250       The Secure Mailer license must be distributed with this software.
251
252<b>AUTHOR(S)</b>
253       Wietse Venema
254       IBM T.J. Watson Research
255       P.O. Box 704
256       Yorktown Heights, NY 10598, USA
257
258                                                                    POSTMAP(1)
259</pre> </body> </html>
260