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 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
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 be‐
62 comes 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 at‐
69 tached 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 in‐
79 stead 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 be‐
105 comes one lookup key. A multi-line header becomes one lookup key
106 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 de‐
130 fault 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 de‐
142 fault 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 op‐
177 tions 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 fail A table that reliably fails all requests. The lookup ta‐
204 ble name is used for logging only. This table exists to
205 simplify Postfix error tests.
206
207 hash The output file is a hashed file, named file_name.db.
208 This is available on systems with support for db data‐
209 bases.
210
211 lmdb The output is a btree-based file, named file_name.lmdb.
212 lmdb supports concurrent writes and reads from different
213 processes, unlike other supported file-based tables.
214 This is available on systems with support for lmdb data‐
215 bases.
216
217 sdbm The output consists of two files, named file_name.pag and
218 file_name.dir. This is available on systems with support
219 for sdbm databases.
220
221 When no file_type is specified, the software uses the database
222 type specified via the default_database_type configuration pa‐
223 rameter.
224
225 file_name
226 The name of the lookup table source file when rebuilding a data‐
227 base.
228
230 Problems are logged to the standard error stream and to syslogd(8) or
231 postlogd(8). No output means that no problems were detected. Duplicate
232 entries are skipped and are flagged with a warning.
233
234 postmap(1) terminates with zero exit status in case of success (includ‐
235 ing successful "postmap -q" lookup) and terminates with non-zero exit
236 status in case of failure.
237
239 MAIL_CONFIG
240 Directory with Postfix configuration files.
241
242 MAIL_VERBOSE
243 Enable verbose logging for debugging purposes.
244
246 The following main.cf parameters are especially relevant to this pro‐
247 gram. The text below provides only a parameter summary. See post‐
248 conf(5) for more details including examples.
249
250 berkeley_db_create_buffer_size (16777216)
251 The per-table I/O buffer size for programs that create Berkeley
252 DB hash or btree tables.
253
254 berkeley_db_read_buffer_size (131072)
255 The per-table I/O buffer size for programs that read Berkeley DB
256 hash or btree tables.
257
258 config_directory (see 'postconf -d' output)
259 The default location of the Postfix main.cf and master.cf con‐
260 figuration files.
261
262 default_database_type (see 'postconf -d' output)
263 The default database type for use in newaliases(1), postalias(1)
264 and postmap(1) commands.
265
266 import_environment (see 'postconf -d' output)
267 The list of environment parameters that a privileged Postfix
268 process will import from a non-Postfix parent process, or
269 name=value environment overrides.
270
271 smtputf8_enable (yes)
272 Enable preliminary SMTPUTF8 support for the protocols described
273 in RFC 6531..6533.
274
275 syslog_facility (mail)
276 The syslog facility of Postfix logging.
277
278 syslog_name (see 'postconf -d' output)
279 A prefix that is prepended to the process name in syslog
280 records, so that, for example, "smtpd" becomes "prefix/smtpd".
281
282 Available in Postfix 2.11 and later:
283
284 lmdb_map_size (16777216)
285 The initial OpenLDAP LMDB database size limit in bytes.
286
288 postalias(1), create/update/query alias database
289 postconf(1), supported database types
290 postconf(5), configuration parameters
291 postlogd(8), Postfix logging
292 syslogd(8), system logging
293
295 Use "postconf readme_directory" or "postconf html_directory" to locate
296 this information.
297 DATABASE_README, Postfix lookup table overview
298
300 The Secure Mailer license must be distributed with this software.
301
303 Wietse Venema
304 IBM T.J. Watson Research
305 P.O. Box 704
306 Yorktown Heights, NY 10598, USA
307
308 Wietse Venema
309 Google, Inc.
310 111 8th Avenue
311 New York, NY 10011, USA
312
313
314
315 POSTMAP(1)