1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 4<html> 5 6<head> 7 8<title>Rejecting Unknown Local Recipients with Postfix</title> 9 10<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> 11 12</head> 13 14<body> 15 16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Rejecting Unknown Local Recipients with Postfix</h1> 17 18<hr> 19 20<h2>Introduction</h2> 21 22<p> As of Postfix version 2.0, the Postfix SMTP server rejects mail 23for unknown recipients in <a href="ADDRESS_CLASS_README.html#local_domain_class">local domains</a> (domains that match 24$<a href="postconf.5.html#mydestination">mydestination</a> or the IP addresses in $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> or 25$<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>) with "User unknown in local recipient table". 26This feature was optional with earlier Postfix versions. </p> 27 28<p> The good news is that this keeps undeliverable mail out of your 29queue, so that your mail queue is not clogged up with undeliverable 30MAILER-DAEMON messages. </p> 31 32<p> The bad news is that it may cause mail to be rejected when you 33upgrade from a Postfix system that was not configured to reject 34mail for unknown local recipients. </p> 35 36<p> This document describes what steps are needed in order to reject 37unknown local recipients correctly. </p> 38 39<ul> 40 41<li><a href="#main_config">Configuring local_recipient_maps 42in main.cf</a> 43 44<li><a href="#change">When you need to change the local_recipient_maps 45setting in main.cf</a> 46 47<li><a href="#format">Local recipient table format </a> 48 49</ul> 50 51<h2><a name="main_config">Configuring local_recipient_maps 52in main.cf</a></h2> 53 54<p> The <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> parameter specifies lookup tables with 55all names or addresses of local recipients. A recipient address is 56local when its domain matches $<a href="postconf.5.html#mydestination">mydestination</a>, $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> or 57$<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>. If a local username or address is not listed in 58$<a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a>, then the Postfix SMTP server will reject 59the address with "User unknown in local recipient table". </p> 60 61<p> The default setting, shown below, assumes that you use the 62default Postfix <a href="local.8.html">local(8)</a> delivery agent for local delivery, where 63recipients are either UNIX accounts or local aliases: </p> 64 65<blockquote> 66<pre> 67/etc/postfix/<a href="postconf.5.html">main.cf</a>: 68 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> = <a href="proxymap.8.html">proxy</a>:unix:passwd.byname $<a href="postconf.5.html#alias_maps">alias_maps</a> 69</pre> 70</blockquote> 71 72<p> To turn off unknown local recipient rejects by the SMTP server, 73specify: </p> 74 75<blockquote> 76<pre> 77/etc/postfix/<a href="postconf.5.html">main.cf</a>: 78 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> = 79</pre> 80</blockquote> 81 82<p> That is, an empty value. With this setting, the Postfix SMTP 83server will not reject mail with "User unknown in local recipient 84table". <b> Don't do this on systems that receive mail directly 85from the Internet. With today's worms and viruses, Postfix will 86become a backscatter source: it accepts mail for non-existent 87recipients and then tries to return that mail as "undeliverable" 88to the often forged sender address</b>. </p> 89 90<h2><a name="change">When you need to change the local_recipient_maps 91setting in main.cf</a></h2> 92 93<ul> 94 95 <li> <p> Problem: you don't use the default Postfix <a href="local.8.html">local(8)</a> 96 delivery agent for domains matching $<a href="postconf.5.html#mydestination">mydestination</a>, $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a>, 97 or $<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>. For example, you redefined the 98 "<a href="postconf.5.html#local_transport">local_transport</a>" setting in <a href="postconf.5.html">main.cf</a>. </p> 99 100 <p> Solution: your <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> setting needs to specify 101 a database that lists all the known user names or addresses 102 for that delivery agent. For example, if you deliver users in 103 $<a href="postconf.5.html#mydestination">mydestination</a> etc. domains via the <a href="virtual.8.html">virtual(8)</a> delivery agent, 104 specify: </p> 105 106<pre> 107/etc/postfix/<a href="postconf.5.html">main.cf</a> 108 <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost.$<a href="postconf.5.html#mydomain">mydomain</a> localhost ... 109 <a href="postconf.5.html#local_transport">local_transport</a> = virtual 110 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> = $<a href="postconf.5.html#virtual_mailbox_maps">virtual_mailbox_maps</a> 111</pre> 112 113 <p> If you use a different delivery agent for $<a href="postconf.5.html#mydestination">mydestination</a> 114 etc. domains, see the section "<a href="#format">Local recipient 115 table format</a>" below for a description of how the table 116 should be populated. </p> 117 118 <li> <p> Problem: you use the <a href="postconf.5.html#mailbox_transport">mailbox_transport</a> or <a href="postconf.5.html#fallback_transport">fallback_transport</a> 119 feature of the Postfix <a href="local.8.html">local(8)</a> delivery agent in order to 120 deliver mail to non-UNIX accounts. </p> 121 122 <p> Solution: you need to add the database that lists the 123 non-UNIX users: </p> 124 125<pre> 126/etc/postfix/<a href="postconf.5.html">main.cf</a> 127 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> = <a href="proxymap.8.html">proxy</a>:unix:passwd.byname, $<a href="postconf.5.html#alias_maps">alias_maps</a>, 128 <the database with non-UNIX accounts> 129</pre> 130 131 <p> See the section "<a href="#format">Local recipient table 132 format</a>" below for a description of how the table should be 133 populated. </p> 134 135 <li> <p> Problem: you use the <a href="postconf.5.html#luser_relay">luser_relay</a> feature of the Postfix 136 local delivery agent. </p> 137 138 <p> Solution: you must disable the <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> feature 139 completely, so that Postfix accepts mail for all local addresses: 140 </p> 141 142<pre> 143/etc/postfix/<a href="postconf.5.html">main.cf</a> 144 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> = 145</pre> 146 147</ul> 148 149<h2><a name="format">Local recipient table format</a> </h2> 150 151<p> If you use local files in <a href="postmap.1.html">postmap(1)</a> format, then 152<a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> expects the following table format: </p> 153 154<ul> 155 156<li> <p> In the left-hand side, specify a bare username, an 157"@domain.tld" wild-card, or specify a complete "user@domain.tld" 158address. </p> 159 160<li> <p> You have to specify something on the right-hand side of 161the table, but the value is ignored by <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a>. 162 163</ul> 164 165<p> If you use lookup tables based on NIS, LDAP, MYSQL, or PGSQL, 166then <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> does the same queries as for local files 167in <a href="postmap.1.html">postmap(1)</a> format, and expects the same results. </p> 168 169<p> With regular expression tables, Postfix only queries with the 170full recipient address, and not with the bare username or the 171"@domain.tld" wild-card. </p> 172 173<p> NOTE: a lookup table should always return a result when the address 174exists, and should always return "not found" when the address does 175not exist. In particular, a zero-length result does not count as 176a "not found" result. </p> 177 178</body> 179 180</html> 181