1POSTMAP(1)                  General Commands Manual                 POSTMAP(1)
2
3
4

NAME

6       postmap - Postfix lookup table management
7

SYNOPSIS

9       postmap [-bfFhimnNoprsuUvw] [-c config_dir] [-d key] [-q key]
10               [file_type:]file_name ...
11

DESCRIPTION

13       The  postmap(1)  command  creates or queries one or more Postfix lookup
14       tables, or updates an existing one.
15
16       If the result files do not exist they will be  created  with  the  same
17       group and other read permissions as their source file.
18
19       While  the  table  update is in progress, signal delivery is postponed,
20       and an exclusive, advisory, lock is placed  on  the  entire  table,  in
21       order to avoid surprises in spectator processes.
22

INPUT FILE FORMAT

24       The format of a lookup table input file is as follows:
25
26       ·      A table entry has the form
27
28                   key whitespace value
29
30       ·      Empty  lines and whitespace-only lines are ignored, as are lines
31              whose first non-whitespace character is a `#'.
32
33       ·      A logical line starts with  non-whitespace  text.  A  line  that
34              starts with whitespace continues a logical line.
35
36       The  key  and  value are processed as is, except that surrounding white
37       space is stripped off. Whitespace in lookup keys  is  supported  as  of
38       Postfix 3.2.
39
40       When  the  -F option is given, the value must specify one or more file‐
41       names separated by comma and/or whitespace; postmap(1) will concatenate
42       the  file content (with a newline character inserted between files) and
43       will store the base64-encoded result instead of the value.
44
45       When the key specifies email address information, the localpart  should
46       be enclosed with double quotes if required by RFC 5322. For example, an
47       address localpart that contains ";", or a localpart that starts or ends
48       with ".".
49
50       By  default  the  lookup key is mapped to lowercase to make the lookups
51       case insensitive; as of Postfix 2.3 this case folding happens only with
52       tables whose lookup keys are fixed-case strings such as btree:, dbm: or
53       hash:. With earlier versions, the lookup key is folded even with tables
54       where  a lookup field can match both upper and lower case text, such as
55       regexp: and pcre:. This resulted in loss of  information  with  $number
56       substitutions.
57

COMMAND-LINE ARGUMENTS

59       -b     Enable  message  body  query mode. When reading lookup keys from
60              standard input with "-q -", process the input as  if  it  is  an
61              email  message  in  RFC  5322 format.  Each line of body content
62              becomes one lookup key.
63
64              By default, the -b option starts generating lookup keys  at  the
65              first  non-header line, and stops when the end of the message is
66              reached.  To simulate  body_checks(5)  processing,  enable  MIME
67              parsing   with  -m.  With  this,  the  -b  option  generates  no
68              body-style lookup keys  for  attachment  MIME  headers  and  for
69              attached message/* headers.
70
71              NOTE:  with  "smtputf8_enable  = yes", the -b option option dis‐
72              ables UTF-8 syntax checks on  query  keys  and  lookup  results.
73              Specify the -U option to force UTF-8 syntax checks anyway.
74
75              This feature is available in Postfix version 2.6 and later.
76
77       -c config_dir
78              Read  the  main.cf  configuration  file  in  the named directory
79              instead of the default configuration directory.
80
81       -d key Search the specified maps for key and remove one entry per  map.
82              The  exit  status  is  zero  when  the requested information was
83              found.
84
85              If a key value of - is specified, the program reads  key  values
86              from  the standard input stream. The exit status is zero when at
87              least one of the requested keys was found.
88
89       -f     Do not fold the lookup key  to  lower  case  while  creating  or
90              querying a table.
91
92              With  Postfix  version  2.3 and later, this option has no effect
93              for regular expression tables. There, case folding is controlled
94              by appending a flag to a pattern.
95
96       -F     When querying a map, or listing a map, base64-decode each value.
97              When creating a map from source file, process each  value  as  a
98              list  of  filenames, concatenate the content of those files, and
99              store the base64-encoded result instead of the value (see  INPUT
100              FORMAT for details).
101
102       -h     Enable  message header query mode. When reading lookup keys from
103              standard input with "-q -", process the input as  if  it  is  an
104              email  message  in  RFC  5322  format.  Each logical header line
105              becomes one lookup key. A multi-line header becomes  one  lookup
106              key with one or more embedded newline characters.
107
108              By  default, the -h option generates lookup keys until the first
109              non-header line is reached.  To simulate  header_checks(5)  pro‐
110              cessing,  enable  MIME parsing with -m. With this, the -h option
111              also generates header-style  lookup  keys  for  attachment  MIME
112              headers and for attached message/* headers.
113
114              NOTE:  with  "smtputf8_enable  = yes", the -b option option dis‐
115              ables UTF-8 syntax checks on  query  keys  and  lookup  results.
116              Specify the -U option to force UTF-8 syntax checks anyway.
117
118              This feature is available in Postfix version 2.6 and later.
119
120       -i     Incremental  mode.  Read  entries from standard input and do not
121              truncate an existing database. By default, postmap(1) creates  a
122              new database from the entries in file_name.
123
124       -m     Enable MIME parsing with "-b" and "-h".
125
126              This feature is available in Postfix version 2.6 and later.
127
128       -N     Include  the  terminating  null character that terminates lookup
129              keys and values. By default, postmap(1)  does  whatever  is  the
130              default for the host operating system.
131
132       -n     Don't  include  the  terminating  null character that terminates
133              lookup keys and values. By default, postmap(1) does whatever  is
134              the default for the host operating system.
135
136       -o     Do  not release root privileges when processing a non-root input
137              file. By default, postmap(1) drops root privileges and  runs  as
138              the source file owner instead.
139
140       -p     Do  not  inherit the file access permissions from the input file
141              when creating a new file.   Instead,  create  a  new  file  with
142              default access permissions (mode 0644).
143
144       -q key Search  the  specified  maps  for  key and write the first value
145              found to the standard output stream. The  exit  status  is  zero
146              when the requested information was found.
147
148              Note:  this  performs  a single query with the key as specified,
149              and does not make iterative queries with substrings of  the  key
150              as  described  for  access(5),  canonical(5), transport(5), vir‐
151              tual(5) and other Postfix table-driven features.
152
153              If a key value of - is specified, the program reads  key  values
154              from  the standard input stream and writes one line of key value
155              output for each key that was found. The exit status is zero when
156              at least one of the requested keys was found.
157
158       -r     When  updating a table, do not complain about attempts to update
159              existing entries, and make those updates anyway.
160
161       -s     Retrieve all database elements, and write one line of key  value
162              output  for  each  element. The elements are printed in database
163              order, which is not necessarily the same as the  original  input
164              order.
165
166              This  feature is available in Postfix version 2.2 and later, and
167              is not available for all database types.
168
169       -u     Disable UTF-8 support. UTF-8 support is enabled by default  when
170              "smtputf8_enable  =  yes".  It requires that keys and values are
171              valid UTF-8 strings.
172
173       -U     With "smtputf8_enable = yes", force UTF-8 syntax checks with the
174              -b and -h options.
175
176       -v     Enable  verbose  logging  for  debugging  purposes.  Multiple -v
177              options make the software increasingly verbose.
178
179       -w     When updating a table, do not complain about attempts to  update
180              existing entries, and ignore those attempts.
181
182       Arguments:
183
184       file_type
185              The database type. To find out what types are supported, use the
186              "postconf -m" command.
187
188              The postmap(1) command can query any supported file type, but it
189              can create only the following file types:
190
191              btree  The  output  file  is  a  btree file, named file_name.db.
192                     This is available on systems with support  for  db  data‐
193                     bases.
194
195              cdb    The  output  consists  of  one file, named file_name.cdb.
196                     This is available on systems with support for  cdb  data‐
197                     bases.
198
199              dbm    The output consists of two files, named file_name.pag and
200                     file_name.dir.  This is available on systems with support
201                     for dbm databases.
202
203              hash   The  output  file  is  a hashed file, named file_name.db.
204                     This is available on systems with support  for  db  data‐
205                     bases.
206
207              fail   A  table that reliably fails all requests. The lookup ta‐
208                     ble name is used for logging only. This table  exists  to
209                     simplify Postfix error tests.
210
211              sdbm   The output consists of two files, named file_name.pag and
212                     file_name.dir.  This is available on systems with support
213                     for sdbm databases.
214
215              When  no  file_type is specified, the software uses the database
216              type  specified  via  the  default_database_type   configuration
217              parameter.
218
219       file_name
220              The name of the lookup table source file when rebuilding a data‐
221              base.
222

DIAGNOSTICS

224       Problems are logged to the standard error stream and to  syslogd(8)  or
225       postlogd(8).  No output means that no problems were detected. Duplicate
226       entries are skipped and are flagged with a warning.
227
228       postmap(1) terminates with zero exit status in case of success (includ‐
229       ing  successful  "postmap -q" lookup) and terminates with non-zero exit
230       status in case of failure.
231

ENVIRONMENT

233       MAIL_CONFIG
234              Directory with Postfix configuration files.
235
236       MAIL_VERBOSE
237              Enable verbose logging for debugging purposes.
238

CONFIGURATION PARAMETERS

240       The following main.cf parameters are especially relevant to  this  pro‐
241       gram.   The  text  below  provides  only a parameter summary. See post‐
242       conf(5) for more details including examples.
243
244       berkeley_db_create_buffer_size (16777216)
245              The per-table I/O buffer size for programs that create  Berkeley
246              DB hash or btree tables.
247
248       berkeley_db_read_buffer_size (131072)
249              The per-table I/O buffer size for programs that read Berkeley DB
250              hash or btree tables.
251
252       config_directory (see 'postconf -d' output)
253              The default location of the Postfix main.cf and  master.cf  con‐
254              figuration files.
255
256       default_database_type (see 'postconf -d' output)
257              The default database type for use in newaliases(1), postalias(1)
258              and postmap(1) commands.
259
260       import_environment (see 'postconf -d' output)
261              The list of environment parameters  that  a  privileged  Postfix
262              process  will  import  from  a  non-Postfix  parent  process, or
263              name=value environment overrides.
264
265       smtputf8_enable (yes)
266              Enable preliminary SMTPUTF8 support for the protocols  described
267              in RFC 6531..6533.
268
269       syslog_facility (mail)
270              The syslog facility of Postfix logging.
271
272       syslog_name (see 'postconf -d' output)
273              A  prefix  that  is  prepended  to  the  process  name in syslog
274              records, so that, for example, "smtpd" becomes "prefix/smtpd".
275

SEE ALSO

277       postalias(1), create/update/query alias database
278       postconf(1), supported database types
279       postconf(5), configuration parameters
280       postlogd(8), Postfix logging
281       syslogd(8), system logging
282

README FILES

284       Use "postconf readme_directory" or "postconf html_directory" to  locate
285       this information.
286       DATABASE_README, Postfix lookup table overview
287

LICENSE

289       The Secure Mailer license must be distributed with this software.
290

AUTHOR(S)

292       Wietse Venema
293       IBM T.J. Watson Research
294       P.O. Box 704
295       Yorktown Heights, NY 10598, USA
296
297       Wietse Venema
298       Google, Inc.
299       111 8th Avenue
300       New York, NY 10011, USA
301
302
303
304                                                                    POSTMAP(1)
Impressum