1POSTMAP(1) General Commands Manual POSTMAP(1)
2
3
4
6 postmap - Postfix lookup table management
7
9 postmap [-Nbfhimnoprsvw] [-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. Unlike with Postfix alias databases, quotes can‐
41 not be used to protect lookup keys that contain special characters such
42 as `#' or whitespace.
43
44 By default the lookup key is mapped to lowercase to make the lookups
45 case insensitive; as of Postfix 2.3 this case folding happens only with
46 tables whose lookup keys are fixed-case strings such as btree:, dbm: or
47 hash:. With earlier versions, the lookup key is folded even with tables
48 where a lookup field can match both upper and lower case text, such as
49 regexp: and pcre:. This resulted in loss of information with $number
50 substitutions.
51
53 -b Enable message body query mode. When reading lookup keys from
54 standard input with "-q -", process the input as if it is an
55 email message in RFC 2822 format. Each line of body content
56 becomes one lookup key.
57
58 By default, the -b option starts generating lookup keys at the
59 first non-header line, and stops when the end of the message is
60 reached. To simulate body_checks(5) processing, enable MIME
61 parsing with -m. With this, the -b option generates no body-
62 style lookup keys for attachment MIME headers and for attached
63 message/* headers.
64
65 This feature is available in Postfix version 2.6 and later.
66
67 -c config_dir
68 Read the main.cf configuration file in the named directory
69 instead of the default configuration directory.
70
71 -d key Search the specified maps for key and remove one entry per map.
72 The exit status is zero when the requested information was
73 found.
74
75 If a key value of - is specified, the program reads key values
76 from the standard input stream. The exit status is zero when at
77 least one of the requested keys was found.
78
79 -f Do not fold the lookup key to lower case while creating or
80 querying a table.
81
82 With Postfix version 2.3 and later, this option has no effect
83 for regular expression tables. There, case folding is controlled
84 by appending a flag to a pattern.
85
86 -h Enable message header query mode. When reading lookup keys from
87 standard input with "-q -", process the input as if it is an
88 email message in RFC 2822 format. Each logical header line
89 becomes one lookup key. A multi-line header becomes one lookup
90 key with one or more embedded newline characters.
91
92 By default, the -h option generates lookup keys until the first
93 non-header line is reached. To simulate header_checks(5) pro‐
94 cessing, enable MIME parsing with -m. With this, the -h option
95 also generates header-style lookup keys for attachment MIME
96 headers and for attached message/* headers.
97
98 This feature is available in Postfix version 2.6 and later.
99
100 -i Incremental mode. Read entries from standard input and do not
101 truncate an existing database. By default, postmap(1) creates a
102 new database from the entries in file_name.
103
104 -m Enable MIME parsing with "-b" and "-h".
105
106 This feature is available in Postfix version 2.6 and later.
107
108 -N Include the terminating null character that terminates lookup
109 keys and values. By default, postmap(1) does whatever is the
110 default for the host operating system.
111
112 -n Don't include the terminating null character that terminates
113 lookup keys and values. By default, postmap(1) does whatever is
114 the default for the host operating system.
115
116 -o Do not release root privileges when processing a non-root input
117 file. By default, postmap(1) drops root privileges and runs as
118 the source file owner instead.
119
120 -p Do not inherit the file access permissions from the input file
121 when creating a new file. Instead, create a new file with
122 default access permissions (mode 0644).
123
124 -q key Search the specified maps for key and write the first value
125 found to the standard output stream. The exit status is zero
126 when the requested information was found.
127
128 If a key value of - is specified, the program reads key values
129 from the standard input stream and writes one line of key value
130 output for each key that was found. The exit status is zero when
131 at least one of the requested keys was found.
132
133 -r When updating a table, do not complain about attempts to update
134 existing entries, and make those updates anyway.
135
136 -s Retrieve all database elements, and write one line of key value
137 output for each element. The elements are printed in database
138 order, which is not necessarily the same as the original input
139 order.
140
141 This feature is available in Postfix version 2.2 and later, and
142 is not available for all database types.
143
144 -v Enable verbose logging for debugging purposes. Multiple -v
145 options make the software increasingly verbose.
146
147 -w When updating a table, do not complain about attempts to update
148 existing entries, and ignore those attempts.
149
150 Arguments:
151
152 file_type
153 The database type. To find out what types are supported, use the
154 "postconf -m" command.
155
156 The postmap(1) command can query any supported file type, but it
157 can create only the following file types:
158
159 btree The output file is a btree file, named file_name.db.
160 This is available on systems with support for db data‐
161 bases.
162
163 cdb The output consists of one file, named file_name.cdb.
164 This is available on systems with support for cdb data‐
165 bases.
166
167 dbm The output consists of two files, named file_name.pag and
168 file_name.dir. This is available on systems with support
169 for dbm databases.
170
171 hash The output file is a hashed file, named file_name.db.
172 This is available on systems with support for db data‐
173 bases.
174
175 fail A table that reliably fails all requests. The lookup ta‐
176 ble name is used for logging only. This table exists to
177 simplify Postfix error tests.
178
179 sdbm The output consists of two files, named file_name.pag and
180 file_name.dir. This is available on systems with support
181 for sdbm databases.
182
183 When no file_type is specified, the software uses the database
184 type specified via the default_database_type configuration
185 parameter.
186
187 file_name
188 The name of the lookup table source file when rebuilding a data‐
189 base.
190
192 Problems are logged to the standard error stream and to syslogd(8). No
193 output means that no problems were detected. Duplicate entries are
194 skipped and are flagged with a warning.
195
196 postmap(1) terminates with zero exit status in case of success (includ‐
197 ing successful "postmap -q" lookup) and terminates with non-zero exit
198 status in case of failure.
199
201 MAIL_CONFIG
202 Directory with Postfix configuration files.
203
204 MAIL_VERBOSE
205 Enable verbose logging for debugging purposes.
206
208 The following main.cf parameters are especially relevant to this pro‐
209 gram. The text below provides only a parameter summary. See post‐
210 conf(5) for more details including examples.
211
212 berkeley_db_create_buffer_size (16777216)
213 The per-table I/O buffer size for programs that create Berkeley
214 DB hash or btree tables.
215
216 berkeley_db_read_buffer_size (131072)
217 The per-table I/O buffer size for programs that read Berkeley DB
218 hash or btree tables.
219
220 config_directory (see 'postconf -d' output)
221 The default location of the Postfix main.cf and master.cf con‐
222 figuration files.
223
224 default_database_type (see 'postconf -d' output)
225 The default database type for use in newaliases(1), postalias(1)
226 and postmap(1) commands.
227
228 syslog_facility (mail)
229 The syslog facility of Postfix logging.
230
231 syslog_name (see 'postconf -d' output)
232 The mail system name that is prepended to the process name in
233 syslog records, so that "smtpd" becomes, for example, "post‐
234 fix/smtpd".
235
237 postalias(1), create/update/query alias database
238 postconf(1), supported database types
239 postconf(5), configuration parameters
240 syslogd(8), system logging
241
243 Use "postconf readme_directory" or "postconf html_directory" to locate
244 this information.
245 DATABASE_README, Postfix lookup table overview
246
248 The Secure Mailer license must be distributed with this software.
249
251 Wietse Venema
252 IBM T.J. Watson Research
253 P.O. Box 704
254 Yorktown Heights, NY 10598, USA
255
256
257
258 POSTMAP(1)