1POSTMAP(1) General Commands Manual POSTMAP(1)
2
3
4
6 postmap - Postfix lookup table management
7
9 postmap [-NbfhimnoprsuUvw] [-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. The input and output file formats
15 are expected to be compatible with:
16
17 makemap file_type file_name < file_name
18
19 If the result files do not exist they will be created with the same
20 group and other read permissions as their source file.
21
22 While the table update is in progress, signal delivery is postponed,
23 and an exclusive, advisory, lock is placed on the entire table, in
24 order to avoid surprises in spectator processes.
25
27 The format of a lookup table input file is as follows:
28
29 · A table entry has the form
30
31 key whitespace value
32
33 · Empty lines and whitespace-only lines are ignored, as are lines
34 whose first non-whitespace character is a `#'.
35
36 · A logical line starts with non-whitespace text. A line that
37 starts with whitespace continues a logical line.
38
39 The key and value are processed as is, except that surrounding white
40 space is stripped off. Whitespace in lookup keys is supported as of
41 Postfix 3.2.
42
43 When the key specifies email address information, the localpart should
44 be enclosed with double quotes if required by RFC 5322. For example, an
45 address localpart that contains ";", or a localpart that starts or ends
46 with ".".
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 btree:, dbm: or
51 hash:. 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 regexp: and pcre:. This resulted in loss of information with $number
54 substitutions.
55
57 -b Enable message body query mode. When reading lookup keys from
58 standard input with "-q -", process the input as if it is an
59 email message in RFC 5322 format. Each line of body content
60 becomes one lookup key.
61
62 By default, the -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 body_checks(5) processing, enable MIME
65 parsing with -m. With this, the -b option generates no
66 body-style lookup keys for attachment MIME headers and for
67 attached message/* headers.
68
69 NOTE: with "smtputf8_enable = yes", the -b option option dis‐
70 ables UTF-8 syntax checks on query keys and lookup results.
71 Specify the -U option to force UTF-8 syntax checks anyway.
72
73 This feature is available in Postfix version 2.6 and later.
74
75 -c config_dir
76 Read the main.cf configuration file in the named directory
77 instead of the default configuration directory.
78
79 -d key Search the specified maps for key and remove one entry per map.
80 The exit status is zero when the requested information was
81 found.
82
83 If a key value of - is specified, the program reads key values
84 from the standard input stream. The exit status is zero when at
85 least one of the requested keys was found.
86
87 -f Do not fold the lookup key to lower case while creating or
88 querying a table.
89
90 With Postfix version 2.3 and later, this option has no effect
91 for regular expression tables. There, case folding is controlled
92 by appending a flag to a pattern.
93
94 -h Enable message header query mode. When reading lookup keys from
95 standard input with "-q -", process the input as if it is an
96 email message in RFC 5322 format. Each logical header line
97 becomes one lookup key. A multi-line header becomes one lookup
98 key with one or more embedded newline characters.
99
100 By default, the -h option generates lookup keys until the first
101 non-header line is reached. To simulate header_checks(5) pro‐
102 cessing, enable MIME parsing with -m. With this, the -h option
103 also generates header-style lookup keys for attachment MIME
104 headers and for attached message/* headers.
105
106 NOTE: with "smtputf8_enable = yes", the -b option option dis‐
107 ables UTF-8 syntax checks on query keys and lookup results.
108 Specify the -U option to force UTF-8 syntax checks anyway.
109
110 This feature is available in Postfix version 2.6 and later.
111
112 -i Incremental mode. Read entries from standard input and do not
113 truncate an existing database. By default, postmap(1) creates a
114 new database from the entries in file_name.
115
116 -m Enable MIME parsing with "-b" and "-h".
117
118 This feature is available in Postfix version 2.6 and later.
119
120 -N Include the terminating null character that terminates lookup
121 keys and values. By default, postmap(1) does whatever is the
122 default for the host operating system.
123
124 -n Don't include the terminating null character that terminates
125 lookup keys and values. By default, postmap(1) does whatever is
126 the default for the host operating system.
127
128 -o Do not release root privileges when processing a non-root input
129 file. By default, postmap(1) drops root privileges and runs as
130 the source file owner instead.
131
132 -p Do not inherit the file access permissions from the input file
133 when creating a new file. Instead, create a new file with
134 default access permissions (mode 0644).
135
136 -q key Search the specified maps for key and write the first value
137 found to the standard output stream. The exit status is zero
138 when the requested information was found.
139
140 If a key value of - is specified, the program reads key values
141 from the standard input stream and writes one line of key value
142 output for each key that was found. The exit status is zero when
143 at least one of the requested keys was found.
144
145 -r When updating a table, do not complain about attempts to update
146 existing entries, and make those updates anyway.
147
148 -s Retrieve all database elements, and write one line of key value
149 output for each element. The elements are printed in database
150 order, which is not necessarily the same as the original input
151 order.
152
153 This feature is available in Postfix version 2.2 and later, and
154 is not available for all database types.
155
156 -u Disable UTF-8 support. UTF-8 support is enabled by default when
157 "smtputf8_enable = yes". It requires that keys and values are
158 valid UTF-8 strings.
159
160 -U With "smtputf8_enable = yes", force UTF-8 syntax checks with the
161 -b and -h options.
162
163 -v Enable verbose logging for debugging purposes. Multiple -v
164 options make the software increasingly verbose.
165
166 -w When updating a table, do not complain about attempts to update
167 existing entries, and ignore those attempts.
168
169 Arguments:
170
171 file_type
172 The database type. To find out what types are supported, use the
173 "postconf -m" command.
174
175 The postmap(1) command can query any supported file type, but it
176 can create only the following file types:
177
178 btree The output file is a btree file, named file_name.db.
179 This is available on systems with support for db data‐
180 bases.
181
182 cdb The output consists of one file, named file_name.cdb.
183 This is available on systems with support for cdb data‐
184 bases.
185
186 dbm The output consists of two files, named file_name.pag and
187 file_name.dir. This is available on systems with support
188 for dbm databases.
189
190 hash The output file is a hashed file, named file_name.db.
191 This is available on systems with support for db data‐
192 bases.
193
194 fail A table that reliably fails all requests. The lookup ta‐
195 ble name is used for logging only. This table exists to
196 simplify Postfix error tests.
197
198 sdbm The output consists of two files, named file_name.pag and
199 file_name.dir. This is available on systems with support
200 for sdbm databases.
201
202 When no file_type is specified, the software uses the database
203 type specified via the default_database_type configuration
204 parameter.
205
206 file_name
207 The name of the lookup table source file when rebuilding a data‐
208 base.
209
211 Problems are logged to the standard error stream and to syslogd(8). No
212 output means that no problems were detected. Duplicate entries are
213 skipped and are flagged with a warning.
214
215 postmap(1) terminates with zero exit status in case of success (includ‐
216 ing successful "postmap -q" lookup) and terminates with non-zero exit
217 status in case of failure.
218
220 MAIL_CONFIG
221 Directory with Postfix configuration files.
222
223 MAIL_VERBOSE
224 Enable verbose logging for debugging purposes.
225
227 The following main.cf parameters are especially relevant to this pro‐
228 gram. The text below provides only a parameter summary. See post‐
229 conf(5) for more details including examples.
230
231 berkeley_db_create_buffer_size (16777216)
232 The per-table I/O buffer size for programs that create Berkeley
233 DB hash or btree tables.
234
235 berkeley_db_read_buffer_size (131072)
236 The per-table I/O buffer size for programs that read Berkeley DB
237 hash or btree tables.
238
239 config_directory (see 'postconf -d' output)
240 The default location of the Postfix main.cf and master.cf con‐
241 figuration files.
242
243 default_database_type (see 'postconf -d' output)
244 The default database type for use in newaliases(1), postalias(1)
245 and postmap(1) commands.
246
247 import_environment (see 'postconf -d' output)
248 The list of environment parameters that a privileged Postfix
249 process will import from a non-Postfix parent process, or
250 name=value environment overrides.
251
252 smtputf8_enable (yes)
253 Enable preliminary SMTPUTF8 support for the protocols described
254 in RFC 6531..6533.
255
256 syslog_facility (mail)
257 The syslog facility of Postfix logging.
258
259 syslog_name (see 'postconf -d' output)
260 A prefix that is prepended to the process name in syslog
261 records, so that, for example, "smtpd" becomes "prefix/smtpd".
262
264 postalias(1), create/update/query alias database
265 postconf(1), supported database types
266 postconf(5), configuration parameters
267 syslogd(8), system logging
268
270 Use "postconf readme_directory" or "postconf html_directory" to locate
271 this information.
272 DATABASE_README, Postfix lookup table overview
273
275 The Secure Mailer license must be distributed with this software.
276
278 Wietse Venema
279 IBM T.J. Watson Research
280 P.O. Box 704
281 Yorktown Heights, NY 10598, USA
282
283 Wietse Venema
284 Google, Inc.
285 111 8th Avenue
286 New York, NY 10011, USA
287
288
289
290 POSTMAP(1)