1ACCESS(5)                     File Formats Manual                    ACCESS(5)
2
3
4

NAME

6       access - Postfix SMTP server access table
7

SYNOPSIS

9       postmap /etc/postfix/access
10
11       postmap -q "string" /etc/postfix/access
12
13       postmap -q - /etc/postfix/access <inputfile
14

DESCRIPTION

16       This  document  describes access control on remote SMTP client informa‐
17       tion: host names, network addresses, and envelope sender  or  recipient
18       addresses;   it  is  implemented  by  the  Postfix  SMTP  server.   See
19       header_checks(5) or body_checks(5) for access control on the content of
20       email messages.
21
22       Normally,  the  access(5) table is specified as a text file that serves
23       as input to the postmap(1) command.  The result, an indexed file in dbm
24       or  db  format,  is used for fast searching by the mail system. Execute
25       the command "postmap /etc/postfix/access" to rebuild  an  indexed  file
26       after changing the corresponding text file.
27
28       When  the  table  is provided via other means such as NIS, LDAP or SQL,
29       the same lookups are done as for ordinary indexed files.
30
31       Alternatively, the table can be provided as  a  regular-expression  map
32       where  patterns  are  given  as  regular expressions, or lookups can be
33       directed to TCP-based server. In those cases, the lookups are done in a
34       slightly  different  way  as  described below under "REGULAR EXPRESSION
35       TABLES" or "TCP-BASED TABLES".
36

CASE FOLDING

38       The search string is folded to lowercase before database lookup. As  of
39       Postfix  2.3,  the search string is not case folded with database types
40       such as regexp: or pcre: whose lookup fields can match both  upper  and
41       lower case.
42

TABLE FORMAT

44       The input format for the postmap(1) command is as follows:
45
46       pattern action
47              When  pattern  matches  a  mail address, domain or host address,
48              perform the corresponding action.
49
50       blank lines and comments
51              Empty lines and whitespace-only lines are ignored, as are  lines
52              whose first non-whitespace character is a `#'.
53
54       multi-line text
55              A  logical  line  starts  with  non-whitespace text. A line that
56              starts with whitespace continues a logical line.
57

EMAIL ADDRESS PATTERNS

59       With lookups from indexed files such as DB or DBM,  or  from  networked
60       tables  such  as  NIS,  LDAP or SQL, patterns are tried in the order as
61       listed below:
62
63       user@domain
64              Matches the specified mail address.
65
66       domain.tld
67              Matches domain.tld as the domain part of an email address.
68
69              The pattern domain.tld also matches subdomains,  but  only  when
70              the  string  smtpd_access_maps  is  listed  in  the Postfix par‐
71              ent_domain_matches_subdomains configuration setting  (note  that
72              this  is  the default for some versions of Postfix).  Otherwise,
73              specify .domain.tld (note the initial dot)  in  order  to  match
74              subdomains.
75
76       user@  Matches all mail addresses with the specified user part.
77
78       Note: lookup of the null sender address is not possible with some types
79       of lookup table. By default, Postfix uses <> as the lookup key for such
80       addresses. The value is specified with the smtpd_null_access_lookup_key
81       parameter in the Postfix main.cf file.
82

EMAIL ADDRESS EXTENSION

84       When a mail address localpart contains the optional recipient delimiter
85       (e.g.,  user+foo@domain),  the  lookup  order becomes: user+foo@domain,
86       user@domain, domain, user+foo@, and user@.
87

HOST NAME/ADDRESS PATTERNS

89       With lookups from indexed files such as DB or DBM,  or  from  networked
90       tables  such  as  NIS,  LDAP  or SQL, the following lookup patterns are
91       examined in the order as listed:
92
93       domain.tld
94              Matches domain.tld.
95
96              The pattern domain.tld also matches subdomains,  but  only  when
97              the  string  smtpd_access_maps  is  listed  in  the Postfix par‐
98              ent_domain_matches_subdomains configuration setting.  Otherwise,
99              specify  .domain.tld  (note  the  initial dot) in order to match
100              subdomains.
101
102       net.work.addr.ess
103
104       net.work.addr
105
106       net.work
107
108       net    Matches the specified IPv4 host address or subnetwork.  An  IPv4
109              host  address  is a sequence of four decimal octets separated by
110              ".".
111
112              Subnetworks  are  matched  by  repeatedly  truncating  the  last
113              ".octet"  from the remote IPv4 host address string until a match
114              is found in the access table, or until further truncation is not
115              possible.
116
117              NOTE  1: The access map lookup key must be in canonical form: do
118              not specify unnecessary null characters, and do not enclose net‐
119              work address information with "[]" characters.
120
121              NOTE  2:  use the cidr lookup table type to specify network/net‐
122              mask patterns. See cidr_table(5) for details.
123
124       net:work:addr:ess
125
126       net:work:addr
127
128       net:work
129
130       net    Matches the specified IPv6 host address or subnetwork.  An  IPv6
131              host  address  is a sequence of three to eight hexadecimal octet
132              pairs separated by ":".
133
134              Subnetworks  are  matched  by  repeatedly  truncating  the  last
135              ":octetpair"  from  the  remote IPv6 host address string until a
136              match is found in the access table, or until further  truncation
137              is not possible.
138
139              NOTE  1:  the truncation and comparison are done with the string
140              representation of the IPv6 host address. Thus, not all  the  ":"
141              subnetworks will be tried.
142
143              NOTE  2: The access map lookup key must be in canonical form: do
144              not specify unnecessary null characters, and do not enclose net‐
145              work address information with "[]" characters.
146
147              NOTE  3:  use the cidr lookup table type to specify network/net‐
148              mask patterns. See cidr_table(5) for details.
149
150              IPv6 support is available in Postfix 2.2 and later.
151

ACCEPT ACTIONS

153       OK     Accept the address etc. that matches the pattern.
154
155       all-numerical
156              An all-numerical result is treated as OK. This format is  gener‐
157              ated  by  address-based relay authorization schemes such as pop-
158              before-smtp.
159

REJECT ACTIONS

161       Postfix version 2.3 and later support enhanced status codes as  defined
162       in  RFC  3463.   When no code is specified at the beginning of the text
163       below, Postfix inserts a default enhanced status code of "5.7.1" in the
164       case  of  reject actions, and "4.7.1" in the case of defer actions. See
165       "ENHANCED STATUS CODES" below.
166
167       4NN text
168
169       5NN text
170              Reject the address etc. that matches the  pattern,  and  respond
171              with  the  numerical  three-digit  code and text. 4NN means "try
172              again later", while 5NN means "do not try again".
173
174              The reply code "421" causes Postfix  to  disconnect  immediately
175              (Postfix version 2.3 and later).
176
177       REJECT optional text...
178              Reject  the  address  etc.  that matches the pattern. Reply with
179              $reject_code optional text... when the optional text  is  speci‐
180              fied, otherwise reply with a generic error response message.
181
182       DEFER_IF_REJECT optional text...
183              Defer  the  request  if some later restriction would result in a
184              REJECT action. Reply with "450 4.7.1  optional text... when  the
185              optional text is specified, otherwise reply with a generic error
186              response message.
187
188              This feature is available in Postfix 2.1 and later.
189
190       DEFER_IF_PERMIT optional text...
191              Defer the request if some later restriction would result in a an
192              explicit  or  implicit  PERMIT  action.   Reply  with "450 4.7.1
193              optional text... when the optional text is specified,  otherwise
194              reply with a generic error response message.
195
196              This feature is available in Postfix 2.1 and later.
197

OTHER ACTIONS

199       restriction...
200              Apply    the   named   UCE   restriction(s)   (permit,   reject,
201              reject_unauth_destination, and so on).
202
203       DISCARD optional text...
204              Claim successful delivery and silently discard the message.  Log
205              the optional text if specified, otherwise log a generic message.
206
207              Note:  this  action currently affects all recipients of the mes‐
208              sage.  To discard only  one  recipient  without  discarding  the
209              entire message, use the transport(5) table to direct mail to the
210              discard(8) service.
211
212              This feature is available in Postfix 2.0 and later.
213
214       DUNNO  Pretend that the lookup key was not found. This prevents Postfix
215              from  trying  substrings  of the lookup key (such as a subdomain
216              name, or a network address subnetwork).
217
218              This feature is available in Postfix 2.0 and later.
219
220       FILTER transport:destination
221              After the message is queued, send the entire message through the
222              specified  external  content  filter.  The transport:destination
223              syntax is described  in  the  transport(5)  manual  page.   More
224              information  about  external  content  filters is in the Postfix
225              FILTER_README file.
226
227              Note: this action overrides the content_filter setting, and cur‐
228              rently affects all recipients of the message.
229
230              This feature is available in Postfix 2.0 and later.
231
232       HOLD optional text...
233              Place  the  message  on  the hold queue, where it will sit until
234              someone either deletes it or releases it for delivery.  Log  the
235              optional text if specified, otherwise log a generic message.
236
237              Mail  that is placed on hold can be examined with the postcat(1)
238              command, and can be destroyed or released with the  postsuper(1)
239              command.
240
241              Note:  use  "postsuper -r" to release mail that was kept on hold
242              for  a  significant  fraction  of   $maximal_queue_lifetime   or
243              $bounce_queue_lifetime,  or  longer. Use "postsuper -H" only for
244              mail that will not expire within a few delivery attempts.
245
246              Note: this action currently affects all recipients of  the  mes‐
247              sage.
248
249              This feature is available in Postfix 2.0 and later.
250
251       PREPEND headername: headervalue
252              Prepend  the specified message header to the message.  When more
253              than one PREPEND action executes,  the  first  prepended  header
254              appears before the second etc. prepended header.
255
256              Note:  this  action  must  execute before the message content is
257              received;   it   cannot    execute    in    the    context    of
258              smtpd_end_of_data_restrictions.
259
260              This feature is available in Postfix 2.1 and later.
261
262       REDIRECT user@domain
263              After  the  message is queued, send the message to the specified
264              address instead of the intended recipient(s).
265
266              Note: this action overrides the  FILTER  action,  and  currently
267              affects all recipients of the message.
268
269              This feature is available in Postfix 2.1 and later.
270
271       WARN optional text...
272              Log  a  warning  with  the  optional  text, together with client
273              information and if available, with helo, sender,  recipient  and
274              protocol information.
275
276              This feature is available in Postfix 2.1 and later.
277

ENHANCED STATUS CODES

279       Postfix  version 2.3 and later support enhanced status codes as defined
280       in RFC 3463.  When an enhanced status code is specified  in  an  access
281       table, it is subject to modification. The following transformations are
282       needed when the same access table is used for client, helo, sender,  or
283       recipient  access restrictions; they happen regardless of whether Post‐
284       fix replies to a MAIL FROM, RCPT TO or other SMTP command.
285
286       ·      When a sender address matches a REJECT action, the Postfix  SMTP
287              server will transform a recipient DSN status (e.g., 4.1.1-4.1.6)
288              into the corresponding sender DSN status, and vice versa.
289
290       ·      When non-address information matches a REJECT  action  (such  as
291              the  HELO  command argument or the client hostname/address), the
292              Postfix SMTP server will transform a  sender  or  recipient  DSN
293              status into a generic non-address DSN status (e.g., 4.0.0).
294

REGULAR EXPRESSION TABLES

296       This  section  describes how the table lookups change when the table is
297       given in the form of regular expressions. For a description of  regular
298       expression lookup table syntax, see regexp_table(5) or pcre_table(5).
299
300       Each  pattern  is  a  regular  expression that is applied to the entire
301       string being looked up. Depending on the application, that string is an
302       entire  client hostname, an entire client IP address, or an entire mail
303       address. Thus, no parent domain  or  parent  network  search  is  done,
304       user@domain  mail  addresses  are  not  broken  up into their user@ and
305       domain constituent parts, nor is user+foo broken up into user and foo.
306
307       Patterns are applied in the order as specified in the  table,  until  a
308       pattern is found that matches the search string.
309
310       Actions  are the same as with indexed file lookups, with the additional
311       feature that parenthesized substrings from the pattern can be  interpo‐
312       lated as $1, $2 and so on.
313

TCP-BASED TABLES

315       This  section  describes  how the table lookups change when lookups are
316       directed  to  a  TCP-based  server.  For  a  description  of  the   TCP
317       client/server  lookup  protocol, see tcp_table(5).  This feature is not
318       available up to and including Postfix version 2.4.
319
320       Each lookup operation uses the entire query string once.  Depending  on
321       the  application,  that  string is an entire client hostname, an entire
322       client IP address, or an entire mail address.  Thus, no  parent  domain
323       or  parent  network  search is done, user@domain mail addresses are not
324       broken up into  their  user@  and  domain  constituent  parts,  nor  is
325       user+foo broken up into user and foo.
326
327       Actions are the same as with indexed file lookups.
328

EXAMPLE

330       The  following example uses an indexed file, so that the order of table
331       entries does not matter. The example permits access by  the  client  at
332       address 1.2.3.4 but rejects all other clients in 1.2.3.0/24. Instead of
333       hash lookup tables, some systems use dbm.  Use  the  command  "postconf
334       -m" to find out what lookup tables Postfix supports on your system.
335
336       /etc/postfix/main.cf:
337           smtpd_client_restrictions =
338               check_client_access hash:/etc/postfix/access
339
340       /etc/postfix/access:
341           1.2.3   REJECT
342           1.2.3.4 OK
343
344       Execute  the  command  "postmap  /etc/postfix/access" after editing the
345       file.
346

BUGS

348       The table format does not understand quoting conventions.
349

SEE ALSO

351       postmap(1), Postfix lookup table manager
352       smtpd(8), SMTP server
353       postconf(5), configuration parameters
354       transport(5), transport:nexthop syntax
355

README FILES

357       Use "postconf readme_directory" or "postconf html_directory" to  locate
358       this information.
359       SMTPD_ACCESS_README, built-in SMTP server access control
360       DATABASE_README, Postfix lookup table overview
361

LICENSE

363       The Secure Mailer license must be distributed with this software.
364

AUTHOR(S)

366       Wietse Venema
367       IBM T.J. Watson Research
368       P.O. Box 704
369       Yorktown Heights, NY 10598, USA
370
371
372
373                                                                     ACCESS(5)
Impressum