1 <!doctype html public
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
8 <title>Postfix Address Verification
</title>
10 <meta http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii">
16 <h1><img src=
"postfix-logo.jpg" width=
"203" height=
"98" ALT=
"">Postfix Address Verification Howto
</h1>
22 <p> The sender/recipient address verification feature described in this
23 document is suitable only for low-traffic sites. It performs poorly
24 under high load; excessive sender address verification activity may
25 even cause your site to be blacklisted by some
26 providers. See the
"<a href="#limitations
">Limitations</a>" section
27 below for details.
</p>
29 <h2><a name=
"summary">What Postfix address verification can do for you
</a></h2>
31 <p> Address verification is a feature that allows the Postfix SMTP
32 server to block a sender (MAIL FROM) or recipient (RCPT TO) address
33 until the address has been verified to be deliverable.
</p>
35 <p> The technique has obvious uses to reject junk mail
36 with an unreplyable sender address.
</p>
38 <p> The technique may also be useful to block mail for undeliverable
39 recipients, for example on a mail
<a href=
"postconf.5.html#relayhost">relay host
</a> that does not have a
40 list of all the valid recipient addresses. This prevents undeliverable
41 junk mail from entering the queue, so that Postfix doesn't have to
42 waste resources trying to send MAILER-DAEMON messages back.
</p>
44 <p> This feature is available in Postfix version
2.1 and later.
</p>
46 <p> Topics covered in this document:
</p>
50 <li><a href=
"#how"> How address verification works
</a>
52 <li><a href=
"#limitations">Limitations of address verification
</a>
54 <li><a href=
"#recipient">Recipient address verification
</a>
56 <li><a href=
"#forged_sender">Sender address verification for mail
57 from frequently forged domains
</a>
59 <li><a href=
"#sender_always">Sender address verification for all
62 <li><a href=
"#caching">Address verification database
</a>
64 <li><a href=
"#dirty_secret">Managing the address verification
67 <li><a href=
"#probe_routing">Controlling the routing of address
68 verification probes
</a>
70 <li><a href=
"#forced_examples">Forced probe routing examples
</a>
72 <li><a href=
"#forced_limitations">Limitations of forced probe routing
</a>
76 <h2><a name=
"how">How address verification works
</a></h2>
78 <p> A Postfix MTA verifies a sender or recipient address by probing
80 MTA for that address, without actually delivering mail. The nearest
81 MTA could be the Postfix MTA itself, or it could be a remote MTA
83 interruptus). Probe messages are like normal mail, except that
84 they are never delivered, deferred or bounced; probe messages are
85 always discarded.
</p>
93 <td bgcolor=
"#f0f0ff" align=
"center" valign=
"middle"> Internet
96 <td align=
"center" valign=
"middle"> <tt> -
> </tt> </td>
98 <td bgcolor=
"#f0f0ff" align=
"center" valign=
"middle"> <a
99 href=
"smtpd.8.html">Postfix
<br> SMTP
<br> server
</a> </td>
101 <td colspan=
"2" align=
"center" valign=
"middle"> <tt> <-
>
104 <td bgcolor=
"#f0f0ff" colspan=
"3" align=
"center" valign=
"middle">
105 <a href=
"verify.8.html">Postfix
<br> verify
<br> server
</a>
108 <td colspan=
"2" align=
"center" valign=
"middle"> <tt> <-
>
111 <td bgcolor=
"#f0f0ff" align=
"center" valign=
"middle"> Address
<br>
112 verification
<br> database
</td>
118 <td colspan=
"3"> </td>
120 <td> </td>
122 <td colspan=
"2" align=
"right" valign=
"middle"> <tt> |
</tt><br>
123 probe
<br> messages
<br> <tt> v
</tt> </td>
127 <td colspan=
"2" align=
"left" valign=
"middle"> ^
<br> delivery
<br>
128 status
<br> <tt> |
</tt> </td>
146 <td colspan=
"2" bgcolor=
"#f0f0ff" align=
"center" valign=
"middle">
147 Postfix
<br> queue
</td>
149 <td align=
"center" valign=
"middle"> <tt> -
> </tt> </td>
151 <td colspan=
"2" bgcolor=
"#f0f0ff" align=
"center" valign=
"middle">
152 Postfix
<br> delivery
<br> agents
</td>
164 <p> With Postfix address verification turned on, normal mail will
165 suffer only a short delay of up to
6 seconds while an address is
166 being verified for the first time. Once an address status is known,
167 the status is cached and Postfix replies immediately.
</p>
169 <p> When verification takes too long the Postfix SMTP server defers
170 the sender or recipient address with a
450 reply. Normal mail
171 clients will connect again after some delay. The address verification
172 delay is configurable with the
<a href=
"postconf.5.html">main.cf
</a> <a href=
"postconf.5.html#address_verify_poll_count">address_verify_poll_count
</a>
173 and
<a href=
"postconf.5.html#address_verify_poll_delay">address_verify_poll_delay
</a> parameters. See
<a href=
"postconf.5.html">postconf(
5)
</a> for
176 <h2><a name=
"limitations">Limitations of address verification
</a></h2>
180 <li> <p> When verifying a remote address, Postfix probes the nearest
181 MTA for that address, without actually delivering mail to it. If
182 the nearest MTA accepts the address, then Postfix assumes that the
183 address is deliverable. In reality, mail for a remote address can
184 bounce AFTER the nearest MTA accepts the recipient address.
</p>
186 <li> <p> Some sites may blacklist you when you are probing them
187 too often (a probe is an SMTP session that does not deliver mail),
188 or when you are probing them too often for a non-existent address.
189 This is one reason why you should use sender address verification
190 sparingly, if at all, when your site receives lots of email.
</p>
192 <li> <p> Normally, address verification probe messages follow the
193 same path as regular mail. However, some sites send mail to the
194 Internet via an intermediate
<a href=
"postconf.5.html#relayhost">relayhost
</a>; this breaks address
195 verification. See below, section
<a href=
"#probe_routing">"Controlling
196 the routing of address verification probes"</a>, for how to override
197 mail routing and for possible limitations when you have to do this.
200 <li> <p> Postfix assumes that an address is undeliverable when the
201 nearest MTA for the address rejects the probe, regardless of the
202 reason for rejection (client rejected, HELO rejected, MAIL FROM
203 rejected, etc.). Thus, Postfix rejects mail when the sender's MTA
204 rejects mail from your machine. This is a good thing.
</p>
206 <li> <p> Unfortunately, some major sites such as YAHOO do not reject
207 unknown addresses in reply to the RCPT TO command, but report a
208 delivery failure in response to end of DATA after a message is
209 transferred. Postfix address verification does not work with such
212 <li> <p> By default, Postfix probe messages have
"double-bounce@$<a href="postconf
.5.html#myorigin
">myorigin</a>"
213 as the sender address (with Postfix versions before
2.5, the default
214 is
"postmaster@$<a href="postconf
.5.html#myorigin
">myorigin</a>"). This is SAFE because the Postfix SMTP
215 server does not reject mail for this address.
</p>
217 <p> You can change this into the null address (
"<a href="postconf
.5.html#address_verify_sender
">address_verify_sender</a>
218 ="). This is UNSAFE because address probes will fail with
219 mis-configured sites that reject MAIL FROM:
<>, while
220 probes from
"postmaster@$<a href="postconf
.5.html#myorigin
">myorigin</a>" would succeed.
</p>
224 <h2><a name=
"recipient">Recipient address verification
</a></h2>
226 <p> As mentioned earlier, recipient address verification may be
227 useful to block mail for undeliverable recipients on a mail relay
228 host that does not have a list of all valid recipient addresses.
229 This can help to prevent the mail queue from filling up with
230 MAILER-DAEMON messages.
</p>
232 <p> Recipient address verification is relatively straightforward
233 and there are no surprises. If a recipient probe fails, then Postfix
234 rejects mail for the recipient address. If a recipient probe
235 succeeds, then Postfix accepts mail for the recipient address.
236 However, recipient address verification probes can increase the
237 load on down-stream MTAs when you're being flooded by backscatter
238 bounces, or when some spammer is mounting a dictionary attack.
</p>
240 <p> By default, address verification results are not saved. To avoid
241 probing the same address repeatedly, you can store the result in a
242 <a href=
"#caching">persistent database
</a> as described later.
</p>
246 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
247 <a href=
"postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions
</a> =
248 <a href=
"postconf.5.html#permit_mynetworks">permit_mynetworks
</a>
249 <a href=
"postconf.5.html#reject_unauth_destination">reject_unauth_destination
</a>
251 <a href=
"postconf.5.html#reject_unknown_recipient_domain">reject_unknown_recipient_domain
</a>
252 <a href=
"postconf.5.html#reject_unverified_recipient">reject_unverified_recipient
</a>
254 # Postfix
2.6 and later privacy feature.
255 #
<a href=
"postconf.5.html#unverified_recipient_reject_reason">unverified_recipient_reject_reason
</a> = Address lookup failed
259 <p> The
"<a href="postconf
.5.html#reject_unknown_recipient_domain
">reject_unknown_recipient_domain</a>" restriction blocks mail
260 for non-existent domains. Putting this before
"<a href="postconf
.5.html#reject_unverified_recipient
">reject_unverified_recipient</a>"
261 avoids the overhead of generating unnecessary probe messages.
</p>
263 <p> The
<a href=
"postconf.5.html#unverified_recipient_reject_code">unverified_recipient_reject_code
</a> parameter (default
450)
264 specifies the numerical Postfix SMTP server reply code when a
265 recipient address is known to
266 bounce. Change this setting into
550 when you trust Postfix's
269 <p> The following features are available in Postfix
2.6 and later.
272 <p> The
<a href=
"postconf.5.html#unverified_recipient_defer_code">unverified_recipient_defer_code
</a> parameter (default
450)
273 specifies the numerical Postfix SMTP server reply code when a
274 recipient address probe fails with some temporary error. Some sites
275 insist on changing this into
250. NOTE: This change turns MX servers
276 into backscatter sources when the load is high.
</p>
278 <p> The
<a href=
"postconf.5.html#unverified_recipient_reject_reason">unverified_recipient_reject_reason
</a> parameter (default:
279 empty) specifies fixed text that Postfix will send to remote SMTP
280 clients, instead of sending actual address verification details.
281 Do not specify the SMTP status code or enhanced status code.
</p>
283 <p> The
<a href=
"postconf.5.html#unverified_recipient_tempfail_action">unverified_recipient_tempfail_action
</a> parameter (default:
284 <a href=
"postconf.5.html#defer_if_permit">defer_if_permit
</a>) specifies the Postfix SMTP server action when a
285 recipient address verification probe fails with some temporary
288 <h2><a name=
"forged_sender">Sender address verification for mail from frequently forged domains
</a></h2>
290 <p> Only for very small sites, it is relatively safe to turn on
291 sender address verification for specific domains that often appear
292 in forged email.
</p>
296 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
297 <a href=
"postconf.5.html#smtpd_sender_restrictions">smtpd_sender_restrictions
</a> = hash:/etc/postfix/sender_access
298 <a href=
"postconf.5.html#unverified_sender_reject_code">unverified_sender_reject_code
</a> =
550
299 # Postfix
2.6 and later.
300 #
<a href=
"postconf.5.html#unverified_sender_defer_code">unverified_sender_defer_code
</a> =
250
302 # Note
1: Be sure to read the
"<a href="#caching
">Caching</a>" section below!
303 # Note
2: Avoid hash files here. Use btree instead.
304 <a href=
"postconf.5.html#address_verify_map">address_verify_map
</a> = btree:/var/db/postfix/verify
306 /etc/postfix/sender_access:
307 aol.com
<a href=
"postconf.5.html#reject_unverified_sender">reject_unverified_sender
</a>
308 hotmail.com
<a href=
"postconf.5.html#reject_unverified_sender">reject_unverified_sender
</a>
309 bigfoot.com
<a href=
"postconf.5.html#reject_unverified_sender">reject_unverified_sender
</a>
314 <p> At some point in cyberspace/time, a list of frequently forged
315 MAIL FROM domains could be found at
316 <a href=
"http://www.monkeys.com/anti-spam/filtering/sender-domain-validate.in">http://www.monkeys.com/anti-spam/filtering/sender-domain-validate.in
</a>.
</p>
318 <p> NOTE: One of the first things you might want to do is to turn
319 on sender address verification for all your own domains.
</p>
321 <h2><a name=
"sender_always">Sender address verification for all
324 <p> Unfortunately, sender address verification cannot simply be
325 turned on for all email - you are likely to lose legitimate mail
326 from mis-configured systems. You almost certainly will have to set
327 up white lists for specific addresses, or even for entire domains.
330 <p> To find out how sender address verification would affect your
331 mail, specify
"<a href="postconf
.5.html#warn_if_reject
">warn_if_reject</a> <a href="postconf
.5.html#reject_unverified_sender
">reject_unverified_sender</a>" so that
332 you can see what mail would be blocked:
</p>
336 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
337 <a href=
"postconf.5.html#smtpd_sender_restrictions">smtpd_sender_restrictions
</a> =
338 <a href=
"postconf.5.html#permit_mynetworks">permit_mynetworks
</a>
340 <a href=
"postconf.5.html#check_sender_access">check_sender_access
</a> hash:/etc/postfix/sender_access
341 <a href=
"postconf.5.html#reject_unknown_sender_domain">reject_unknown_sender_domain
</a>
342 <a href=
"postconf.5.html#warn_if_reject">warn_if_reject
</a> <a href=
"postconf.5.html#reject_unverified_sender">reject_unverified_sender
</a>
344 # Postfix
2.6 and later.
345 #
<a href=
"postconf.5.html#unverified_sender_reject_reason">unverified_sender_reject_reason
</a> = Address verification failed
347 # Note
1: Be sure to read the
"<a href="#caching
">Caching</a>" section below!
348 # Note
2: Avoid hash files here. Use btree instead.
349 <a href=
"postconf.5.html#address_verify_map">address_verify_map
</a> = btree:/var/db/postfix/verify
353 <p> This is also a good way to populate your cache with address
354 verification results before you start to actually reject mail.
</p>
356 <p> The sender_access restriction is needed to whitelist domains
357 or addresses that are known to be OK. Although Postfix will not
358 mark a known-to-be-good address as bad after a probe fails, it is
359 better to be safe than sorry.
</p>
361 <p> NOTE: You will have to whitelist sites such as securityfocus.com
362 and other sites that operate mailing lists that use a different
363 sender address for each posting (VERP). Such addresses pollute
364 the address verification cache quickly, and generate unnecessary
365 sender verification probes.
</p>
369 /etc/postfix/sender_access
375 <p> The
"<a href="postconf
.5.html#reject_unknown_sender_domain
">reject_unknown_sender_domain</a>" restriction blocks mail from
376 non-existent domains. Putting this before
"<a href="postconf
.5.html#reject_unverified_sender
">reject_unverified_sender</a>"
377 avoids the overhead of generating unnecessary probe messages.
</p>
379 <p> The
<a href=
"postconf.5.html#unverified_sender_reject_code">unverified_sender_reject_code
</a> parameter (default
450)
380 specifies the numerical Postfix server reply code when a sender
382 bounce. Change this setting into
550 when you trust Postfix's
385 <p> The following features are available in Postfix
2.6 and later.
388 <p> The
<a href=
"postconf.5.html#unverified_sender_defer_code">unverified_sender_defer_code
</a> parameter (default
450) specifies
389 the numerical Postfix SMTP server reply code when a sender address
390 verification probe fails with some temporary error. Specify a valid
391 2xx or
4xx code.
</p>
393 <p> The
<a href=
"postconf.5.html#unverified_sender_reject_reason">unverified_sender_reject_reason
</a> parameter (default:
394 empty) specifies fixed text that Postfix will send to remote SMTP
395 clients, instead of sending actual addres verification details.
396 Do not specify the SMTP status code or enhanced status code.
</p>
398 <p> The
<a href=
"postconf.5.html#unverified_sender_tempfail_action">unverified_sender_tempfail_action
</a> parameter (default:
399 <a href=
"postconf.5.html#defer_if_permit">defer_if_permit
</a>) specifies the Postfix SMTP server action when a
400 sender address verification probe fails with some temporary error.
403 <h2><a name=
"caching">Address verification database
</a></h2>
405 <p> NOTE: By default, address verification information is not stored
406 in a persistent file. You have to specify one in
<a href=
"postconf.5.html">main.cf
</a> (see
407 below). Persistent storage is off by default because it may need
408 more disk space than is available in your file system.
</p>
410 <p> Address verification information is cached by the Postfix verify
411 daemon. Postfix has a bunch of parameters that control the caching
412 of positive and negative results. Refer to the
<a href=
"verify.8.html">verify(
8)
</a> manual
413 page for details.
</p>
415 <p> The
<a href=
"postconf.5.html#address_verify_map">address_verify_map
</a> (NOTE: singular) configuration parameter
416 specifies an optional database for sender or recipient address
417 verification results. If you don't specify a file, all address
418 verification information is lost after
"postfix reload" or
"postfix
421 <p> If your /var file system has sufficient space, try:
</p>
425 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
426 # Note: avoid hash files here. Use btree instead.
427 <a href=
"postconf.5.html#address_verify_map">address_verify_map
</a> = btree:/var/db/postfix/verify
431 <p> NOTE
1: As of version
2.5, Postfix no longer uses root privileges
432 when opening this file. The file should now be stored under the
433 Postfix-owned
<a href=
"postconf.5.html#data_directory">data_directory
</a>. As a migration aid, an attempt to
434 open the file under a non-Postfix directory is redirected to the
435 Postfix-owned
<a href=
"postconf.5.html#data_directory">data_directory
</a>, and a warning is logged. If you wish
436 to continue using a pre-existing database file, move it to the
437 <a href=
"postconf.5.html#data_directory">data_directory
</a>, and change ownership to the account specified with
438 the
<a href=
"postconf.5.html#mail_owner">mail_owner
</a> parameter.
</p>
440 <p> NOTE
2: Do not put this file in a file system that may run out
441 of space. When the address verification table gets corrupted the
442 world comes to an end and YOU will have to MANUALLY fix things as
443 described in the next section. Meanwhile, you will not receive mail
446 <p> NOTE
3: The
<a href=
"verify.8.html">verify(
8)
</a> daemon process will create a new database when
447 none exists, and will open/create the file before it enters the
450 <h2><a name=
"dirty_secret">Managing the address verification
453 <p> The
<a href=
"verify.8.html">verify(
8)
</a> manual page describes parameters that control
454 how long information remains cached before it needs to be refreshed,
455 and how long information can remain
"unrefreshed" before it expires.
456 Postfix uses different controls for positive results (address was
457 accepted) and for negative results (address was rejected).
</p>
459 <p> Right now, no tools are provided to manage the address verification
460 database. If the file gets too big, or if it gets corrupted, you
461 can manually rename or delete the file and run
"postfix reload".
462 The new verify daemon process will then create a new database.
</p>
464 <h2><a name=
"probe_routing">Controlling the routing of address
465 verification probes
</a></h2>
467 <p> By default, Postfix sends address verification probe messages
468 via the same route as regular mail, because that normally produces
469 the most accurate result. It's no good to verify a local address
470 by connecting to your own SMTP port; that just triggers all kinds
471 of mailer loop alarms. The same is true for any destination that
472 your machine is best MX host for: hidden domains, virtual domains,
475 <p> However, some sites have a complex infrastructure where mail
476 is not sent directly to the Internet, but is instead given to an
477 intermediate
<a href=
"postconf.5.html#relayhost">relayhost
</a>. This is a problem for address verification,
478 because remote Internet addresses can be verified only when Postfix
479 can access remote destinations directly.
</p>
481 <p> For this reason, Postfix allows you to override the routing
482 parameters when it delivers an address verification probe message.
485 <p> First, the
<a href=
"postconf.5.html#address_verify_relayhost">address_verify_relayhost
</a> parameter allows you to
486 override the
<a href=
"postconf.5.html#relayhost">relayhost
</a> setting, and the
<a href=
"postconf.5.html#address_verify_transport_maps">address_verify_transport_maps
</a>
487 parameter allows you to override the
<a href=
"postconf.5.html#transport_maps">transport_maps
</a> setting.
488 The
<a href=
"postconf.5.html#address_verify_sender_dependent_relayhost_maps">address_verify_sender_dependent_relayhost_maps
</a> parameter
489 does the same for sender-dependent
<a href=
"postconf.5.html#relayhost">relayhost
</a> selection.
</p>
491 <p> Second, each address class is given its own address verification
492 version of the message delivery transport, as shown in the table
493 below. Address classes are defined in the
<a href=
"ADDRESS_CLASS_README.html">ADDRESS_CLASS_README
</a>
500 <tr> <th> Domain list
</th> <th> Regular transport
</th> <th> Verify
501 transport
</th> </tr>
503 <tr> <td> <a href=
"postconf.5.html#mydestination">mydestination
</a> </td> <td> <a href=
"postconf.5.html#local_transport">local_transport
</a> </td> <td>
504 <a href=
"postconf.5.html#address_verify_local_transport">address_verify_local_transport
</a> </td> </tr>
506 <tr> <td> <a href=
"postconf.5.html#virtual_alias_domains">virtual_alias_domains
</a> </td> <td> (not applicable)
</td>
507 <td> (not applicable)
</td> </tr>
509 <tr> <td> <a href=
"postconf.5.html#virtual_mailbox_domains">virtual_mailbox_domains
</a> </td> <td> <a href=
"postconf.5.html#virtual_transport">virtual_transport
</a>
510 </td> <td> <a href=
"postconf.5.html#address_verify_virtual_transport">address_verify_virtual_transport
</a> </td> </tr>
512 <tr> <td> <a href=
"postconf.5.html#relay_domains">relay_domains
</a> </td> <td> <a href=
"postconf.5.html#relay_transport">relay_transport
</a> </td> <td>
513 <a href=
"postconf.5.html#address_verify_relay_transport">address_verify_relay_transport
</a> </td> </tr>
515 <tr> <td> (not applicable)
</td> <td> <a href=
"postconf.5.html#default_transport">default_transport
</a> </td> <td>
516 <a href=
"postconf.5.html#address_verify_default_transport">address_verify_default_transport
</a> </td> </tr>
522 <p> By default, the parameters that control delivery of address
523 probes have the same value as the parameters that control normal
526 <h2><a name=
"forced_examples">Forced probe routing examples
</a></h2>
528 <p> In a typical scenario one would override the
<a href=
"postconf.5.html#relayhost">relayhost
</a> setting
529 for address verification probes and leave everything else alone:
534 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
535 <a href=
"postconf.5.html#relayhost">relayhost
</a> = $
<a href=
"postconf.5.html#mydomain">mydomain
</a>
536 <a href=
"postconf.5.html#address_verify_relayhost">address_verify_relayhost
</a> =
541 <p> Sites behind a network address translation box might have to
542 use a different SMTP client that sends the correct hostname
547 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
548 <a href=
"postconf.5.html#relayhost">relayhost
</a> = $
<a href=
"postconf.5.html#mydomain">mydomain
</a>
549 <a href=
"postconf.5.html#address_verify_relayhost">address_verify_relayhost
</a> =
550 <a href=
"postconf.5.html#address_verify_default_transport">address_verify_default_transport
</a> = direct_smtp
552 /etc/postfix/
<a href=
"master.5.html">master.cf
</a>:
553 direct_smtp .. .. .. .. .. .. .. .. .. smtp
554 -o
<a href=
"postconf.5.html#smtp_helo_name">smtp_helo_name
</a>=nat.box.tld
558 <h2><a name=
"forced_limitations">Limitations of forced probe routing
</a></h2>
560 <p> Inconsistencies can happen when probe messages don't follow
561 the same path as regular mail. For example, a message can be
562 accepted when it follows the regular route while an otherwise
563 identical probe message is rejected when it follows the forced
564 route. The opposite can happen, too, but is less likely.
</p>