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