1POSTMAP(1) General Commands Manual POSTMAP(1)
2
3
4
6 postmap - Postfix lookup table management
7
9 postmap [-bfFhimnNoprsuUvw] [-c config_dir] [-d key] [-q key]
10 [file_type:]file_name ...
11
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 or‐
21 der to avoid surprises in spectator processes.
22
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 in Post‐
38 fix 3.2 and later, by surrounding the key with double quote characters
39 `"'. Within the double quotes, double quote `"' and backslash `\' char‐
40 acters can be included by quoting them with a preceding backslash.
41
42 When the -F option is given, the value must specify one or more file‐
43 names separated by comma and/or whitespace; postmap(1) will concatenate
44 the file content (with a newline character inserted between files) and
45 will store the base64-encoded result instead of the value.
46
47 When the key specifies email address information, the localpart should
48 be enclosed with double quotes if required by RFC 5322. For example, an
49 address localpart that contains ";", or a localpart that starts or ends
50 with ".".
51
52 By default the lookup key is mapped to lowercase to make the lookups
53 case insensitive; as of Postfix 2.3 this case folding happens only with
54 tables whose lookup keys are fixed-case strings such as btree:, dbm: or
55 hash:. With earlier versions, the lookup key is folded even with tables
56 where a lookup field can match both upper and lower case text, such as
57 regexp: and pcre:. This resulted in loss of information with $number
58 substitutions.
59
61 -b Enable message body query mode. When reading lookup keys from
62 standard input with "-q -", process the input as if it is an
63 email message in RFC 5322 format. Each line of body content be‐
64 comes one lookup key.
65
66 By default, the -b option starts generating lookup keys at the
67 first non-header line, and stops when the end of the message is
68 reached. To simulate body_checks(5) processing, enable MIME
69 parsing with -m. With this, the -b option generates no
70 body-style lookup keys for attachment MIME headers and for at‐
71 tached message/* headers.
72
73 NOTE: with "smtputf8_enable = yes", the -b option disables UTF-8
74 syntax checks on query keys and lookup results. Specify the -U
75 option to force UTF-8 syntax checks anyway.
76
77 This feature is available in Postfix version 2.6 and later.
78
79 -c config_dir
80 Read the main.cf configuration file in the named directory in‐
81 stead of the default configuration directory.
82
83 -d key Search the specified maps for key and remove one entry per map.
84 The exit status is zero when the requested information was
85 found.
86
87 If a key value of - is specified, the program reads key values
88 from the standard input stream. The exit status is zero when at
89 least one of the requested keys was found.
90
91 -f Do not fold the lookup key to lower case while creating or
92 querying a table.
93
94 With Postfix version 2.3 and later, this option has no effect
95 for regular expression tables. There, case folding is controlled
96 by appending a flag to a pattern.
97
98 -F When querying a map, or listing a map, base64-decode each value.
99 When creating a map from source file, process each value as a
100 list of filenames, concatenate the content of those files, and
101 store the base64-encoded result instead of the value (see INPUT
102 FILE FORMAT for details).
103
104 This feature is available in Postfix version 3.4 and later.
105
106 -h Enable message header query mode. When reading lookup keys from
107 standard input with "-q -", process the input as if it is an
108 email message in RFC 5322 format. Each logical header line be‐
109 comes one lookup key. A multi-line header becomes one lookup key
110 with one or more embedded newline characters.
111
112 By default, the -h option generates lookup keys until the first
113 non-header line is reached. To simulate header_checks(5) pro‐
114 cessing, enable MIME parsing with -m. With this, the -h option
115 also generates header-style lookup keys for attachment MIME
116 headers and for attached message/* headers.
117
118 NOTE: with "smtputf8_enable = yes", the -b option option dis‐
119 ables UTF-8 syntax checks on query keys and lookup results.
120 Specify the -U option to force UTF-8 syntax checks anyway.
121
122 This feature is available in Postfix version 2.6 and later.
123
124 -i Incremental mode. Read entries from standard input and do not
125 truncate an existing database. By default, postmap(1) creates a
126 new database from the entries in file_name.
127
128 -m Enable MIME parsing with "-b" and "-h".
129
130 This feature is available in Postfix version 2.6 and later.
131
132 -N Include the terminating null character that terminates lookup
133 keys and values. By default, postmap(1) does whatever is the de‐
134 fault for the host operating system.
135
136 -n Don't include the terminating null character that terminates
137 lookup keys and values. By default, postmap(1) does whatever is
138 the default for the host operating system.
139
140 -o Do not release root privileges when processing a non-root input
141 file. By default, postmap(1) drops root privileges and runs as
142 the source file owner instead.
143
144 -p Do not inherit the file access permissions from the input file
145 when creating a new file. Instead, create a new file with de‐
146 fault access permissions (mode 0644).
147
148 -q key Search the specified maps for key and write the first value
149 found to the standard output stream. The exit status is zero
150 when the requested information was found.
151
152 Note: this performs a single query with the key as specified,
153 and does not make iterative queries with substrings of the key
154 as described for access(5), canonical(5), transport(5), vir‐
155 tual(5) and other Postfix table-driven features.
156
157 If a key value of - is specified, the program reads key values
158 from the standard input stream and writes one line of key value
159 output for each key that was found. The exit status is zero when
160 at least one of the requested keys was found.
161
162 -r When updating a table, do not complain about attempts to update
163 existing entries, and make those updates anyway.
164
165 -s Retrieve all database elements, and write one line of key value
166 output for each element. The elements are printed in database
167 order, which is not necessarily the same as the original input
168 order.
169
170 This feature is available in Postfix version 2.2 and later, and
171 is not available for all database types.
172
173 -u Disable UTF-8 support. UTF-8 support is enabled by default when
174 "smtputf8_enable = yes". It requires that keys and values are
175 valid UTF-8 strings.
176
177 -U With "smtputf8_enable = yes", force UTF-8 syntax checks with the
178 -b and -h options.
179
180 -v Enable verbose logging for debugging purposes. Multiple -v op‐
181 tions make the software increasingly verbose.
182
183 -w When updating a table, do not complain about attempts to update
184 existing entries, and ignore those attempts.
185
186 Arguments:
187
188 file_type
189 The database type. To find out what types are supported, use the
190 "postconf -m" command.
191
192 The postmap(1) command can query any supported file type, but it
193 can create only the following file types:
194
195 btree The output file is a btree file, named file_name.db.
196 This is available on systems with support for db data‐
197 bases.
198
199 cdb The output consists of one file, named file_name.cdb.
200 This is available on systems with support for cdb data‐
201 bases.
202
203 dbm The output consists of two files, named file_name.pag and
204 file_name.dir. This is available on systems with support
205 for dbm databases.
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 hash The output file is a hashed file, named file_name.db.
212 This is available on systems with support for db data‐
213 bases.
214
215 lmdb The output is a btree-based file, named file_name.lmdb.
216 lmdb supports concurrent writes and reads from different
217 processes, unlike other supported file-based tables.
218 This is available on systems with support for lmdb data‐
219 bases.
220
221 sdbm The output consists of two files, named file_name.pag and
222 file_name.dir. This is available on systems with support
223 for sdbm databases.
224
225 When no file_type is specified, the software uses the database
226 type specified via the default_database_type configuration pa‐
227 rameter.
228
229 file_name
230 The name of the lookup table source file when rebuilding a data‐
231 base.
232
234 Problems are logged to the standard error stream and to syslogd(8) or
235 postlogd(8). No output means that no problems were detected. Duplicate
236 entries are skipped and are flagged with a warning.
237
238 postmap(1) terminates with zero exit status in case of success (includ‐
239 ing successful "postmap -q" lookup) and terminates with non-zero exit
240 status in case of failure.
241
243 MAIL_CONFIG
244 Directory with Postfix configuration files.
245
246 MAIL_VERBOSE
247 Enable verbose logging for debugging purposes.
248
250 The following main.cf parameters are especially relevant to this pro‐
251 gram. The text below provides only a parameter summary. See post‐
252 conf(5) for more details including examples.
253
254 berkeley_db_create_buffer_size (16777216)
255 The per-table I/O buffer size for programs that create Berkeley
256 DB hash or btree tables.
257
258 berkeley_db_read_buffer_size (131072)
259 The per-table I/O buffer size for programs that read Berkeley DB
260 hash or btree tables.
261
262 config_directory (see 'postconf -d' output)
263 The default location of the Postfix main.cf and master.cf con‐
264 figuration files.
265
266 default_database_type (see 'postconf -d' output)
267 The default database type for use in newaliases(1), postalias(1)
268 and postmap(1) commands.
269
270 import_environment (see 'postconf -d' output)
271 The list of environment variables that a privileged Postfix
272 process will import from a non-Postfix parent process, or
273 name=value environment overrides.
274
275 smtputf8_enable (yes)
276 Enable preliminary SMTPUTF8 support for the protocols described
277 in RFC 6531, RFC 6532, and RFC 6533.
278
279 syslog_facility (mail)
280 The syslog facility of Postfix logging.
281
282 syslog_name (see 'postconf -d' output)
283 A prefix that is prepended to the process name in syslog
284 records, so that, for example, "smtpd" becomes "prefix/smtpd".
285
286 Available in Postfix 2.11 and later:
287
288 lmdb_map_size (16777216)
289 The initial OpenLDAP LMDB database size limit in bytes.
290
292 postalias(1), create/update/query alias database
293 postconf(1), supported database types
294 postconf(5), configuration parameters
295 postlogd(8), Postfix logging
296 syslogd(8), system logging
297
299 Use "postconf readme_directory" or "postconf html_directory" to locate
300 this information.
301 DATABASE_README, Postfix lookup table overview
302
304 The Secure Mailer license must be distributed with this software.
305
307 Wietse Venema
308 IBM T.J. Watson Research
309 P.O. Box 704
310 Yorktown Heights, NY 10598, USA
311
312 Wietse Venema
313 Google, Inc.
314 111 8th Avenue
315 New York, NY 10011, USA
316
317
318
319 POSTMAP(1)