autoupdate
[postfix-master.git] / postfix-master / faq.html
blob2a8da866803747e7245a0888e6eaebbd59ab6fe8
1 <html>
3 <!--Warning, preformatted content! -->
5 <head>
7 <title>Postfix Frequently Asked Questions</title>
9 <META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW">
10 </head>
12 <body background="obsolete.gif">
14 <h1><a href="big-picture.html"><img src="small-picture.gif" width="115" height="45"></a> Postfix Frequently Asked Questions</h1>
16 <hr>
18 <p> <strong> Note: this web page is no longer maintained. It exists
19 only to avoid breaking links in web pages that describe earlier
20 versions of the Postfix mail system. </strong> </p>
22 <a href="docs.html">Up one level</a> | Postfix FAQ
24 <h2>Table of contents</h2>
26 <p>
28 <ul>
30 <li><a href="#warnings">Postfix warnings and error messages</a>
32 <li><a href="#poppers">POP or IMAP problems</a>
34 <li><a href="#systems">Problems with specific Operating Systems</a>
36 <li><a href="#example_config">Example configurations</a>
38 <li><a href="#sendmail_incompatibility">Sendmail incompatibility</a>
40 <li><a href="#moby">Running hundreds of Postfix processes</a>
42 <li><a href="#performance">Postfix performance</a>
44 <li><a href="#receiving">Receiving mail via the network</a>
46 <li><a href="#relaying">Mail relaying</a>
48 <li><a href="#remote_delivery">Remote delivery</a>
50 <li><a href="#local_delivery">Local (non-virtual) delivery</a>
52 <li><a href="#mailing_lists">Mailing lists</a>
54 <li><a href="#virtual_domains">Virtual domains</a>
56 <li><a href="#address_rewriting">Address rewriting</a>
58 <li><a href="#content_filtering">Content filtering</a>
60 <li><a href="#other_transports">Other transports: UUCP, FAX, etc.</a>
62 <li><a href="#queue_maint">Postfix queue maintenance</a>
64 <li><a href="#compiling_installing">Compiling and installing Postfix</a>
66 </ul>
68 <p>
70 <a name="warnings"><h3>Postfix warnings and error messages</h3>
72 <ul>
74 <li><a href="#bogus">Postfix rejects mail with "User unknown in local recipient table"</a>
76 <li><a href="#bogus_valias">Postfix rejects mail with "User unknown in virtual alias table"</a>
78 <li><a href="#bogus_vmbox">Postfix rejects mail with "User unknown in virtual mailbox table"</a>
80 <li><a href="#unknown_virtual_loop">Mail for unknown users in
81 virtual domains fails with "mail loops back to myself"</a>
83 <li><a href="#virtual_relay">Postfix refuses mail for virtual
84 domains with "relay access denied"</a>
86 <li><a href="#nopass">What does "warning: cannot access UNIX password database" mean?</a>
88 <li><a href="#loop">What does "Error: too many hops" mean?</a>
90 <li><a href="#noalias">What does "fatal: open database /etc/aliases.db" mean?</a>
92 <li><a href="#noservice">What does "fatal: unknown service: smtp/tcp" mean?</a>
94 <li><a href="#biff">What does "biff_notify: Connection refused" mean?</a>
96 <li><a href="#nisdom">What does "NIS domain name not set - NIS lookups disabled" mean?</a>
98 <li><a href="#dns-again">Mail stays queued with: Host not found, try again</a>
100 <li><a href="#timeouts">Mail fails consistently with timeout or lost connection</a>
102 <li><a href="#nosuid">sendmail has set-uid root file permissions, or is run from a set-uid root process</a>
104 <li><a href="#whoami">sendmail: unable to find out your login name</a>
106 <li><a href="#paranoid">warning: xxx.xxx.xxx.xxx: address not listed
107 for hostname yyy.yyy.yyy</a>
109 <li><a href="#broken_transport">Mail delivery fails with: "unknown
110 mail transport error"</a>
112 <li><a href="#msql_limit">Too many connections</a>
114 <li><a href="#reiser_bugs">write queue file: No such file or directory</a>
116 <li><a href="#reiser_bugs">write queue file: Unknown error 4294967289</a>
118 </ul>
122 <a name="example_config"><h3>Example configurations</h3>
124 <ul>
126 <li><a href="#stand_alone">Stand-alone machine</a>
128 <li><a href="#workstation_server">Workstations and servers</a>
130 <li><a href="#null_client">Null clients</a>
132 <li><a href="#intranet">Running Postfix inside an intranet</a>
134 <li><a href="#firewall">Running Postfix on a firewall</a>
136 <li><a href="#dialup">Running Postfix on a dialup machine</a>
138 </ul>
142 <a name="sendmail_incompatibility"><h3>Sendmail incompatibility</h3>
144 <ul>
146 <li><a href="#verbose">Postfix breaks "sendmail -v"</a>
148 <li><a href="#delayed">Postfix sends no "delayed mail" notices</a>
150 <li><a href="#root">Root's mail is delivered to nobody</a>
152 <li><a href="#duplicate">Postfix sends duplicate mail</a>
154 <li><a href="#metoo">Postfix sends mail to every member of a
155 distribution list</a>
157 <li><a href="#delivered">Getting rid of the ugly Delivered-To: header</a>
159 <li><a href="#majordomo-approve">Postfix breaks the majordomo "approve" command</a>
161 <li><a href="#skip_greeting">Postfix does not try all the MX addresses</a>
163 <li><a href="#worm">Postfix accepts MAIL FROM and RCPT TO "| command"</a>
165 </ul>
167 <a name="moby"><h3>Running hundreds of Postfix processes</h3>
169 <ul>
171 <li><a href="#moby-freebsd">Running hundreds of Postfix processes on FreeBSD</a>
173 <li><a href="#moby-linux">Running hundreds of Postfix processes on Linux</a>
175 <li><a href="#moby-sun">Running hundreds of Postfix processes on Solaris</a>
177 <li><a href="#moby-postfix">Running thousands of Postfix delivery agents</a>
179 </ul>
182 <a name="performance"><h3>Postfix performance</h3>
184 <ul>
186 <li><a href="#incoming">Mail stays queued in the incoming queue</a>
188 <li><a href="#delay">Postfix responds slowly to incoming SMTP connections</a>
190 </ul>
192 <a name="receiving"><h3>Receiving mail via the network</h3>
194 <ul>
196 <li><a href="#delay">Postfix responds slowly to incoming SMTP connections</a>
198 <li><a href="#numerical_log">Postfix logs SMTP clients as IP
199 addresses</a>
201 <li><a href="#paranoid">warning: xxx.xxx.xxx.xxx: address not listed
202 for hostname yyy.yyy.yyy</a>
204 </ul>
206 <a name="relaying"><h3>Mail relaying</h3>
208 <ul>
210 <li><a href="#mobile">Relaying mail for mobile users</a>
212 <li><a href="#virtual_relay">Postfix refuses mail for virtual
213 domains with "relay access denied"</a>
215 <li><a href="#relay_restrict">Restricting what users can send mail to off-site destinations</a>
217 <li><a href="#backup">Configuring Postfix as MX host for a remote site</a>
219 </ul>
221 <a name="remote_delivery"><h3>Remote delivery</h3>
223 <ul>
225 <li><a href="#dns-again">Mail stays queued with: Host not found, try again</a>
227 <li><a href="#timeouts">Mail fails consistently with timeout or lost connection</a>
229 <li><a href="#skip_greeting">Postfix does not try all the MX addresses</a>
231 <li><a href="#noservice">What does "fatal: unknown service: smtp/tcp" mean?</a>
233 <li><a href="#broken_transport">Mail delivery fails with: "unknown
234 mail transport error"</a>
236 </ul>
238 <a name="local_delivery"><h3>Local (non-virtual) delivery</h3>
240 <ul>
242 <li><a href="#root">Root's mail is delivered to nobody</a>
244 <li><a href="#biff">What does "biff_notify: Connection refused" mean?</a>
246 <li><a href="#nisdom">What does "NIS domain name not set - NIS lookups disabled" mean?</a>
248 <li><a href="#bogus">Postfix rejects mail with "User unknown in local recipient table"</a>
250 <li><a href="#some_local">Delivering some users locally while
251 sending mail as user@domain</a>
253 <li><a href="#maildir">Support for maildir-style mailboxes</a>
255 <li><a href="#procmail">Using Procmail for system-wide local delivery</a>
257 <li><a href="#delivered">Getting rid of the ugly Delivered-To: header</a>
259 <li><a href="#duplicate">Postfix sends duplicate mail</a>
261 <li><a href="#metoo">Postfix sends mail to every member of a
262 distribution list</a>
264 <li><a href="#owner-foo">Postfix ignores the owner-list alias</a>
266 <li><a href="#noalias">What does "fatal: open database /etc/aliases.db" mean?</a>
268 <li><a href="#broken_transport">Mail delivery fails with: "unknown
269 mail transport error"</a>
271 </ul>
273 <a name="mailing_lists"><h3>Mailing lists</h3>
275 <ul>
277 <li><a href="#majordomo-approve">Postfix breaks the majordomo "approve" command</a>
279 <li><a href="#internal-list">Protecting internal email distribution lists</a>
281 <li><a href="#duplicate">Postfix sends duplicate mail</a>
283 <li><a href="#metoo">Postfix sends mail to every member of a
284 distribution list</a>
286 <li><a href="#owner-foo">Postfix ignores the owner-list alias</a>
288 <li><a href="#virtual_command">Commands, mailing lists, and /file/name destinations don't work in Postfix virtual maps</a>
290 </ul>
292 <a name="virtual_domains"><h3>Virtual domains</h3>
294 <ul>
296 <li><a href="#bogus_valias">Postfix rejects mail with "User unknown in virtual alias table"</a>
298 <li><a href="#bogus_vmbox">Postfix rejects mail with "User unknown in virtual mailbox table"</a>
300 <li><a href="#unknown_virtual_accept">Postfix does not refuse mail for
301 unknown users in virtual domains</a>
303 <li><a href="#unknown_virtual_loop">Mail for unknown users in
304 virtual domains fails with "mail loops back to myself"</a>
306 <li><a href="#virtual_relay">Postfix refuses mail for virtual
307 domains with "relay access denied"</a>
309 <li><a href="#virtual_command">Commands, mailing lists, and /file/name destinations don't work in Postfix virtual maps</a>
311 <li><a href="#domain_mailbox">Receiving a virtual domain in a
312 mailbox</a>
314 </ul>
316 <a name="address_rewriting"><h3>Address rewriting</h3>
318 <ul>
320 <li><a href="#masquerade">Address masquerading with exceptions</a>
322 </ul>
324 <a name="content_filtering"><h3>Content filtering</h3>
326 <ul>
328 <li><a href="#loop">What does "Error: too many hops" mean?</a>
330 </ul>
332 <a name="other_transports"><h3>Other transports: UUCP, FAX, etc.</h3>
334 <ul>
336 <li><a href="#uucp-tcp">Using UUCP over TCP</a>
338 <li><a href="#internet-uucp">Setting up an Internet to UUCP gateway</a>
340 <li><a href="#uucp-only">Using UUCP as the default transport</a>
342 <li><a href="#fax">Sending mail to a FAX machine</a>
344 </ul>
346 <a name="queue_maint"><h3>Postfix queue maintenance</h3></a>
348 <ul>
350 <li><a href="#deleting">Deleting a message from the Postfix queue</a>
352 <li><a href="#copying">Moving or restoring the Postfix queue</a>
354 </ul>
356 <a name="compiling_installing"><h3>Compiling and installing Postfix</h3>
358 <ul>
360 <li><a href="#bind">Undefined symbols: ___dn_expand, ___res_init etc.</a>
362 <li><a href="#dbm_dirfno">Undefined symbols: dbm_pagfno, dbm_dirfno etc.</a>
364 <li><a href="#db">Using third-party DB libraries</a>
366 <li><a href="#sgistruct">IRIX problems translating IP address to string</a>
368 </ul>
372 <a name="systems"><h3>Problems with specific Operating Systems</h3>
376 <ul>
378 <li><a href="#compaq">Problems with Compaq</a>
380 <li><a href="#irix">Problems with IRIX</a>
382 </ul>
384 <a name="compaq"><h3>Problems with Compaq</h3>
386 <ul>
388 <li><a href="#compaq-chmod">Compaq mail blackhole problem</a>
390 </ul>
392 <a name="irix"><h3>Problems with IRIX</h3>
394 <ul>
396 <li><a href="#sgistruct">IRIX problems translating IP address to string</a>
398 </ul>
400 <hr>
402 <a name="poppers"><h3>POP or IMAP problems</h3>
404 Postfix is a mail delivery system. Postfix does not implement
405 services such as POP or IMAP to read mail. Several POP/IMAP
406 implementations exist that can cooperate with software such as
407 Postfix.
411 Examples of software that is used successfully with Postfix:
415 <ul>
417 <li><a href="http://asg.web.cmu.edu/cyrus/">Cyrus IMAP</a> implements
418 IMAP, POP3, and KPOP, later versions also support TLS. This software
419 implements its own private mail database system. Not for beginners.
423 <li><a href="http://www.inter7.com/courierimap/">Courier-Imap</a>
424 provides POP3 and IMAP, and supports access over SSL.
425 This software supports the maildir-style mailbox format only
426 (one message per file, same format as qmail).
430 <li><a href="http://www.eudora.com/qpopper/">Qpopper</a> supports
431 POP3, TLS (SSL), and uses the traditional UNIX-style mailbox format
432 (multiple messages per file, each message starts with "From sender date...").
434 </ul>
438 <hr>
440 <a name="stand_alone"><h3>Stand-alone machine</h3>
442 Out of the box, Postfix should work without change on a stand-alone
443 machine that has direct Internet access. At least, that is how
444 Postfix installs when you download the Postfix source code. If you
445 are on a firewalled intranet, or if your machine is dial-up connected
446 only a small part of the time, see the respective sections.
448 <hr>
450 <a name="workstation_server"><h3>Workstations and servers</h3>
452 This section describes a workstation-server environment. All systems
453 send mail as user@domain. All systems receive mail for user@hostname.
454 The server receives mail for user@domain, too.
458 Postfix has sane defaults for all parameters, so the text below
459 shows only the overrides. In particular, Postfix will relay mail
460 only from clients in its own subnetworks. The master.cf file
461 (somewhat like inetd.conf) needs tweaking only if you have a very
462 slow or a very fast network and/or machine.
466 Workstation:
467 <pre>
468 /etc/postfix/main.cf:
469 myorigin = $mydomain
470 </pre>
474 Server:
475 <pre>
476 /etc/postfix/main.cf:
477 myorigin = $mydomain
478 mydestination = $myhostname, localhost.$mydomain, $mydomain
479 </pre>
483 In an environment like this. either the mail spool directory is
484 shared via NFS, users access their mailboxes via POP, or each user
485 receives her mail on her own workstation. In the latter case, each
486 user has an alias on the server that forwards mail to the respective
487 workstation:
491 Server:
492 <pre>
493 /etc/aliases:
494 joe: joe@joes.workstation
495 jane: jane@janes.workstation
496 </pre>
500 On some systems the alias database is not in <b>/etc/aliases</b>.
501 To find out the location for your system, execute the command
502 <b>postconf alias_maps</b>.
504 <hr>
506 <a name="null_client"><h3>Null clients</h3>
508 A null client is a machine that can only send mail. It receives no
509 mail from the network, and it does not deliver any mail locally. A
510 null client typically uses POP or NFS for mailbox access.
514 In the following example, mail is sent as user@domain, and all mail
515 is forwarded to the mail server that is responsible for the local
516 domain.
520 <pre>
521 /etc/postfix/main.cf:
522 myorigin = $mydomain
523 relayhost = $mydomain
524 local_transport = error:local delivery is disabled
526 /etc/postfix/master.cf:
527 Comment out the SMTP server entry
528 Comment out the local delivery agent entry
529 </pre>
533 Since everything sends mail as user@domain, nothing sends mail as
534 user@nullclient, and therefore no special configuration needs to
535 be done on the mail server for mail addressed to user@nullclient.
537 <hr>
539 <a name="intranet"> <h3>Running Postfix inside an intranet</h3> </a>
541 The simplest way to set up Postfix on a host inside a firewalled
542 network is to send all your mail to an intranet mail gateway, and
543 to let that mail gateway take care of forwarding.
547 <ul>
549 <li>Send mail as user@domain. This is optional but highly recommended
550 because it allows users to change machines without hassle.
552 <pre>
553 /etc/postfix/main.cf:
554 myorigin = $mydomain
555 </pre>
559 <li>Forward <i>all</i> mail to an intranet mail gateway, except
560 for mail for the local machine:
564 <pre>
565 /etc/postfix/main.cf:
566 relayhost = $mydomain
567 </pre>
571 This assumes that your organization has set up internal MX records
572 for the local domain.
576 If your intranet does not use MX records internally, you have to
577 specify the intranet mail gateway host itself:
581 <pre>
582 /etc/postfix/main.cf:
583 relayhost = host.my.domain
584 </pre>
588 If your intranet does not use DNS internally, you have to disable
589 DNS lookups as well:
593 <pre>
594 /etc/postfix/main.cf:
595 disable_dns_lookups = yes
596 </pre>
600 <li>Instead of the above you can configure Postfix to deliver
601 intranet mail directly instead of sending it via the intranet
602 mail gateway. In this case, do not specify a relayhost!!
606 Specify default routing information for the internal domain in the
607 <a href="transport.5.html">transport</a> table, and enable <a
608 href="transport.5.html">transport</a> table lookups.
612 <pre>
613 /etc/postfix/transport:
614 my.domain :
615 .my.domain :
616 * smtp:gateway.my.domain
618 /etc/postfix/main.cf:
619 transport_maps = hash:/etc/postfix/transport
620 </pre>
624 Important: do not specify a relayhost in main.cf, or else mail for
625 internal destinations will still be given to the relayhost.
629 Specify <b>dbm</b> instead of <b>hash</b> if your system uses
630 <b>dbm</b> files instead of <b>db</b>. To find out what map types
631 Postfix supports, use the command <b>postconf -m</b>.
635 Execute the command <b>postmap /etc/postfix/transport</b> whenever
636 you edit the transport table.
640 <li>Execute the command <b>postfix reload</b> to make the
641 changes effective.
643 </ul>
645 <hr>
647 <a name="firewall"><h3>Running Postfix on a firewall</h3> </a>
649 Note: this text applies to Postfix versions 2.0 and later. To find
650 out what Postfix version you have, execute the command <b>postconf
651 mail_version</b>.
655 How to set up Postfix on the firewall machine so that it relays
656 mail for <i>domain.com</i> to a gateway machine on the inside, and
657 so that it refuses mail for <i>*.domain.com</i>? The problem is that
658 the default <a href="uce.html#relay_domains">relay_domains</a>
659 mail relaying restriction allows mail to <i>*.domain.com</i> when
660 you specify <i>domain.com</i>.
664 <ul>
666 <li>Specify a <a href="transport.5.html">transport</a> table to
667 route mail for <i>domain.com</i> to the inside machine.
671 Specify explicit settings for <a
672 href="uce.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a>
673 and for <a href="basic.html#mynetworks">mynetworks</a> that allow
674 local systems to send mail anywhere, and that allow remote systems
675 to send mail only to <i>user@domain.com</i>.
679 Specify what recipients exist (so that your queue does not fill up
680 with undeliverable mail from spammers).
684 Specify <tt>local_recipient_maps =</tt> if maintaining recipient
685 information is not practical.
689 <pre>
690 /etc/postfix/main.cf:
691 myorigin = domain.com
692 mydestination = domain.com
693 local_recipient_maps = hash:/etc/postfix/recipients
694 transport_maps = hash:/etc/postfix/transport
695 mynetworks = 12.34.56.0/24
696 smtpd_recipient_restrictions = permit_mynetworks reject_unauth_destination
697 local_transport = error:local mail delivery is disabled on this machine
699 /etc/postfix/transport:
700 domain.com smtp:inside-gateway.domain.com <i>forwards user@domain.com</i>
702 /etc/postfix/master.cf:
703 Comment out the local delivery agent
704 </pre>
708 Specify <b>dbm</b> instead of <b>hash</b> if your system uses
709 <b>dbm</b> files instead of <b>db</b>. To find out what map types
710 Postfix supports, use the command <b>postconf -m</b>.
714 <li>Execute the command <b>postmap /etc/postfix/transport</b>
715 whenever you change the transport table.
719 <li>Execute the command <b>postfix reload</b> after a
720 configuration change.
722 </ul>
724 <hr>
726 <a name="dialup"><h3>Running Postfix on a dialup machine</h3></a>
728 This section applies to dialup connections that are down most of
729 the time. For dialup connections that are up 24x7, see the <a
730 href="#workstation_server">workstations and servers</a> section
731 instead.
735 If you do not have your own hostname (as with dynamic IP addressing)
736 and must send mail as user@your-isp.com, you should also study the
737 the section on <a href="#some_local">delivering some users locally
738 while sending mail as user@domain</a>.
740 <ul>
742 <li> Route all outgoing mail to your provider.
746 If your machine is disconnected most of the time, there isn't
747 a lot of opportunity for Postfix to deliver mail to hard-to-reach
748 corners of the Internet. It's better to drop the mail to a machine
749 that is connected all the time.
753 <pre>
754 /etc/postfix/main.cf:
755 relayhost = smtprelay.someprovider.com
756 </pre>
760 <li> <a name="spontaneous_smtp">Disable spontaneous SMTP mail
761 delivery (on-demand dialup IP only).</a>
765 Normally, Postfix attempts to deliver outbound mail at its convenience.
766 If your machine uses on-demand dialup IP, this causes your system
767 to place a telephone call whenever you submit new mail, and whenever
768 Postfix retries to deliver delayed mail. To prevent such telephone
769 calls from being placed, disable spontaneous SMTP mail deliveries.
773 <pre>
774 /etc/postfix/main.cf:
775 defer_transports = smtp (Only for systems that use on-demand dialup IP)
776 </pre>
780 <li> Disable SMTP client DNS lookups (dialup LAN only).
784 Some people use Postfix to deliver mail across a LAN that is
785 disconnected most of the time. Under such conditions, mail delivery
786 can suffer from delays while the Postfix SMTP client performs sender
787 and recipient domain DNS lookups in order to be standards-compliant.
788 To prevent these delays, disable all SMTP client DNS lookups.
792 <pre>
793 /etc/postfix/main.cf:
794 disable_dns_lookups = yes (Only for delivery across LANs that are disconnected most of the time)
795 </pre>
799 <i> When you disable DNS lookups, you must specify the</i>
800 <b>relayhost</b> <i> as either a numeric IP address, or as a hostname
801 that resolves to one or more IP addresses (with DNS lookup disabled,
802 Postfix does no MX lookup</i>).
806 <li> Flush the mail queue whenever the Internet link is established.
810 Put the following command into your PPP or SLIP dialup scripts:
814 <dl>
816 <dd><b>/usr/sbin/sendmail -q</b> (whenever the Internet link is up)
818 </dl>
822 The exact location of the <b>sendmail</b> command is system-specific.
823 With some UNIX versions, use <b>/usr/lib/sendmail</b>.
827 In order to find out if the mail queue is flushed, use something
828 like:
831 <pre>
832 #!/bin/sh
834 # Start deliveries.
835 /usr/sbin/sendmail -q
837 # Allow deliveries to start.
838 sleep 10
840 # Loop until all messages have been tried at least once.
841 while mailq | grep '^[^ ]*\*' &gt;/dev/null
843 sleep 10
844 done
845 </pre>
849 If you have disabled <a href="#spontaneous_smtp">spontaneous SMTP
850 mail delivery</a>, you also need to run the above command every
851 now and then while the dialup link is up, so that newly-posted mail
852 is flushed from the queue.
854 </ul>
856 <hr>
858 <a name="verbose"><h3>Postfix breaks "sendmail -v"</h3> </a>
860 Some people will complain that <b>sendmail -v</b> no longer shows
861 the actual mail delivery.
865 With a distributed mail system such as Postfix, this is difficult
866 to implement. Unlike sendmail, no Postfix mail delivery process
867 runs under control by a user. Instead, Postfix delivers mail with
868 daemon processes that have no parent-child relationship with user
869 processes. This eliminates a large variety of potential security
870 exploits with environment variables, signal handlers, and with
871 other process attributes that UNIX passes on from parent process
872 to child process.
876 Postfix uses multiple processes in order to insulate subsystems
877 from each other. Making the delivery agents talk directly to user
878 processes would defeat a lot of the effort that went into making
879 Postfix more secure than ordinary mailers.
881 <hr>
883 <a name="delayed"><h3>Postfix sends no "delayed mail" notices</h3>
885 <blockquote>
887 When I was using Sendmail, after 4 hours, it would always send a receipt
888 back to the sender saying mail delivery is delayed.
890 </blockquote>
894 In order to make Postfix send "delayed mail" notifications after
895 four hours, specify:
899 <pre>
900 /etc/postfix/main.cf:
901 delay_warning_time = 4h
902 </pre>
907 With Postfix, delayed mail notices are turned off by default -
908 people get enough mail already.
910 <hr>
912 <a name="duplicate"><h3>Postfix sends duplicate mail</h3> </a>
914 Some people will complain that Postfix sends duplicate messages.
915 This happens whenever one message is mailed to multiple addresses
916 that reach the same user. Examples of such scenarios are:
920 <ul>
922 <li>One message is sent to the user, and to an alias that lists
923 the user. The user receives one copy of the mail directly, and
924 one copy via the alias.
928 <li>One message is sent to multiple aliases that list the user.
929 The user receives one copy of the mail via each alias.
931 </ul>
935 Some people will even argue that this is the "right" behavior. It
936 is probably more a matter of expectation and of what one is used to.
940 This can be "fixed" only by making Postfix slower. In the above
941 examples, Postfix would first have to completely expand all
942 distribution lists before starting any delivery. By design, Postfix
943 delivers mail to different destinations in parallel, and local
944 delivery is no exception. This is why Postfix can be faster than
945 sendmail.
947 <hr>
949 <a name="metoo"><h3>Postfix sends mail to every member of a
950 distribution list</h3> </a>
952 Some people will complain that Postfix sends mail to every member
953 of a distribution list, including the poster. By default, Sendmail
954 deletes the poster from distribution lists. Sendmail sends mail to
955 the poster only when the "metoo" flag is explicitly turned on.
959 Wietse believes that Postfix implements the "right" behavior,
960 and suspects that Sendmail's default behavior is a remnant from a
961 dark past when Sendmail used some obscure algorithm to avoid
962 aliasing loops.
964 <hr>
966 <a name="owner-foo"><h3>Postfix ignores the owner-list alias</h3></a>
968 Normally, when a local alias <i>foo</i> has a companion alias
969 <i>owner-foo</i>, Postfix reports delivery errors to the owner
970 address rather than the message originator.
974 However, as a result of a Postfix implementation artefact, the
975 owner-foo alias takes effect only after the alias expansion is
976 completed.
980 Delivery problems that happen while expanding the alias, including
981 delivery to commands or files, are reported to the original sender
982 envelope address.
986 The reason is that bounces are sent by the Postfix queue manager,
987 which does not know that the sender address is being replaced.
991 This limitation will be fixed by changing how the Postfix local
992 delivery agent deals with undeliverable mail.
994 <hr>
996 <a name="noalias"><h3>What does "fatal: open database /etc/aliases.db" mean?</h3></a>
998 DB files are maintained by the Berkeley DB library. The above
999 message means one of the following things:
1003 <ul>
1005 <li> The existing file does not have the expected file format.
1006 The cause is one of the following:
1010 <ul>
1012 <li>The file was created by Berkeley DB version 1 and you are using
1013 version 2 or 3 (or vice versa).
1017 <li> The file was written in "btree" format and Postfix expects
1018 "hash" format (or vice versa).
1020 </ul>
1024 To fix the problem for Postfix execute the following command as root:
1026 <blockquote>
1027 <pre>
1028 newaliases
1029 </pre>
1030 </blockquote>
1032 This creates the aliases.db in the format that Postfix expects.
1036 <li>Or the problem could be something completely different. If the
1037 result of running <tt>newaliases</tt> is a zero-length aliases.db
1038 file, then you probably suffer from the following problem.
1042 <ul>
1044 <li>Postfix was compiled with #include files for Berkeley DB version
1045 <i>X</i> and was linked against object library files for Berkeley DB
1046 version <i>Y</i>, where <i>X</i> and <i>Y</i> are different versions
1047 of the Berkeley DB library.
1049 </ul>
1053 The fix for this is to properly install the Berkeley DB library.
1054 For example, RedHat version 7.0 uses the Berkeley DB version 3
1055 object library by default, but no /usr/include/db.h file is
1056 installed by default. In order to correctly build Postfix you
1057 must install the db3-devel package.
1061 On a properly installed system, including the file <b>&lt;db.h&gt;</b>
1062 and linking with <b>-ldb</b> should access files from the same
1063 Berkeley DB library version.
1065 </ul>
1067 <hr>
1069 <a name="nosuid"><h3>sendmail has set-uid root file permissions, or is run from a
1070 set-uid root process</h3></a>
1072 Traditionally, the UNIX <b>sendmail</b> command is installed with
1073 set-uid root permissions. Even many MTAs other than Sendmail ship
1074 with a set-uid root <b>sendmail</b> command. This is not the case
1075 with Postfix. The Postfix <b>sendmail</b> command is designed not
1076 to be set-uid.
1080 Unfortunately, some Linux systems have a helpful utility called
1081 <b>linuxconf</b> that automatically "fixes" file permissions to
1082 what they are supposed to be for Sendmail's <b>sendmail</b> command.
1083 Even when you reset the set-uid bit on the Postfix <b>sendmail</b>
1084 executable file, <b>linuxconf</b> will happily turn it on again
1085 for you.
1089 On SuSE systems the file permission fixing utulity is called
1090 <b>SuSEconfig</b>. Other Linux systems may use different names.
1091 The usual disclaimers about mileages etc. apply.
1095 <h4>Solutions</h4>
1097 <ul>
1099 <li>Rask Ingemann Lambertsen has a particularly effective
1100 solution :-)
1102 <blockquote>
1103 <pre>
1104 # /etc/rc.d/init.d/linuxconf stop && rpm --erase linuxconf
1105 </pre>
1106 </blockquote>
1108 <li>According to Matthias Andree, the band-aid fix for SuSE is to
1109 add to /etc/permissions.local the following line:
1111 <blockquote>
1112 <pre>
1113 /usr/sbin/sendmail root.root 755
1114 </pre>
1115 </blockquote>
1117 and to make sure that in /etc/rc.config,
1118 PERMISSIONS_SECURITY mentions local last, EXAMPLE:
1120 <blockquote>
1121 <pre>
1122 CHECK_PERMISSIONS=set
1123 PERMISSION_SECURITY="secure local"
1124 </pre>
1125 </blockquote>
1127 </ul>
1129 <hr>
1131 <a name="whoami"><h3>sendmail: unable to find out your login name</h3>
1133 This message is logged when submitting mail from a process with a
1134 userid that does not exist in the UNIX password file. Postfix uses
1135 this information in order to set the envelope sender address.
1139 The envelope sender address is also the default value for the From:
1140 header address, when none is specified in the message.
1144 To fix, specify the envelope sender address on the sendmail command
1145 line:
1147 <blockquote>
1148 <pre>
1149 sendmail -f user@domain ...
1150 </pre>
1151 </blockquote>
1153 <hr>
1155 <a name="moby-freebsd"><h3>Running hundreds of Postfix processes on FreeBSD</h3></a>
1157 With hundreds of Postfix processes, the kernel will eventually
1158 run out of file handles; after that, it will run out of sockets.
1162 To set the following kernel parameters at boot time, add the
1163 following lines to the <b>/boot/loader.conf</b> file (this is
1164 verified with FreeBSD 4.4):
1168 <blockquote>
1169 <pre>
1170 kern.ipc.maxsockets="5000"
1171 kern.ipc.nmbclusters="65536"
1172 kern.maxproc="2048"
1173 kern.maxfiles="16384"
1174 kern.maxfilesperproc="16384"
1175 </pre>
1176 </blockquote>
1180 With FreeBSD 4.2, the last three parameters cannot be set from
1181 <b>/boot/loader.conf</b>. To set the open file limits, execute the
1182 following commands as root:
1186 <blockquote>
1187 <pre>
1188 # sysctl -w kern.maxfiles=16384
1189 # sysctl -w kern.maxfilesperproc=16384
1190 </pre>
1191 </blockquote>
1195 With FreeBSD 4.2, <b>kern.maxproc</b> can be set only by recompiling
1196 the kernel with a different <b>maxusers</b> setting in the kernel
1197 configuration file.
1199 <hr>
1201 <a name="moby-linux"><h3>Running hundreds of Postfix processes on Linux</h3></a>
1203 When you increase the number of Postfix processes into the hundreds,
1204 the kernel will eventually run out of file handles; after that it
1205 is likely to run out of process slots.
1209 The following information is kernel version dependent.
1213 To set parameters at boot time on Linux systems that have
1214 <b>/etc/sysctl.conf</b>, add the following lines:
1218 <blockquote>
1219 <pre>
1220 fs.file-max = 16384
1221 kernel.threads-max = 2048
1222 </pre>
1223 </blockquote>
1227 To set kernel parameters at run time, execute the following
1228 commands as <b>root</b>:
1232 <blockquote>
1233 <pre>
1234 # echo 16384 > /proc/sys/fs/file-max
1235 # echo 2048 > /proc/sys/kernel/threads-max
1236 </pre>
1237 </blockquote>
1239 <hr>
1241 <a name="moby-sun"><h3>Running hundreds of Postfix processes on Solaris</h3></a>
1243 In order to run hundreds of processes you may have to adjust the
1244 per-process open file limit. According to the <a
1245 href="http://www.science.uva.nl/pub/solaris/solaris2.html#q3.45">Solaris
1246 FAQ</a>, add the following lines to /etc/system on Solaris 2.4 and later:
1248 <p>
1249 <blockquote>
1250 <pre>
1251 * set hard limit on file descriptors
1252 set rlim_fd_max = 4096
1253 * set soft limit on file descriptors
1254 set rlim_fd_cur = 2048
1255 </pre>
1256 </blockquote>
1258 <hr>
1260 <a name="moby-postfix"><h3>Running thousands of Postfix delivery agents</h3></a>
1262 In order to run Postfix with more than a thousand delivery agents you
1263 need to recompile the software with an appropriate value of the
1264 <b>FD_SETSIZE</b> constant.
1267 <blockquote>
1268 <pre>
1269 % make tidy
1270 % make makefiles "CCARGS=-DFD_SETSIZE=2048"
1271 % make
1272 </pre>
1273 </blockquote>
1275 <hr>
1277 <a name="incoming"><h3>Mail stays queued in the incoming queue</h3></a>
1279 <blockquote>
1281 I have lots if mail in the incoming queue, but Postfix only runs
1282 a few outbound SMTP deliveries. Why is it not running more SMTP
1283 clients?
1285 </blockquote>
1289 Your problem could be one of several.
1293 <ul>
1295 <li>You're trying to send mail to difficult to reach sites (Hotmail,
1296 Yahoo, etc.). Solution: set up transport map entries that give special
1297 treatment (many parallel connections, short connection timeouts):
1301 <pre>
1302 /etc/postfix/main.cf:
1303 transport_maps = hash:/etc/postfix/transport
1304 deadbeats_destination_concurrency_limit = 50
1306 /etc/postfix/transport:
1307 hotmail.com deadbeats:
1308 yahoo.com deadbeats:
1310 /etc/postfix/master.cf:
1311 deadbeats unix - - n - - smtp
1312 -o smtp_connect_timeout=5 -o smtp_helo_timeout=5
1313 </pre>
1317 <li>Incoming mail, destined for a small number of inside mailhubs,
1318 is competing with outgoing mail to the Internet. As of Postfix
1319 version 2, this should be less of a problem. However, when a single
1320 internal mailhub goes down, it can totally ruin the performance
1321 because Postfix is wasting huge amounts of time on connection
1322 timeouts. The solution is to specify shorter connection timeouts
1323 for the inbound <b>relay</b> transport:
1327 <pre>
1328 /etc/postfix/main.cf:
1329 mydestination = my.own.host.name
1330 relay_domains = my.corp.domain
1331 relay_transport = relay
1333 /etc/postfix/master.cf:
1334 relay unix - - n - - smtp
1335 -o smtp_connect_timeout=2 -o smtp_helo_timeout=2
1336 </pre>
1340 <li>The disk is saturated with I/O from
1341 receiving mail, so that the Postfix queue manager gets insufficient
1342 chance to process the requests (many SMTP server processes are
1343 competing for disk access against one poor queue manager).
1347 You solve the problem by getting faster disks, and/or by using
1348 different disk drives for logging, mail queue, and mailboxes.
1352 Currently, the workaround is to configure multiple IP addresses
1353 per machine, and to run one Postfix instance per IP address, each
1354 instance preferably on a different disk. The Postfix instances
1355 can't share queue directories, but sharing mailbox directories is
1360 Just start each Postfix instance with a different configuration
1361 directory:
1365 <pre>
1366 # postfix -c config_directory start
1367 </pre>
1371 Each main.cf file has a different <b>$myhostname</b> setting,
1372 depending on the interface that it is supposed to handle.
1376 <pre>
1377 /my/own/main.cf:
1378 queue_directory = /my/own/queue/directory
1379 myhostname = foo1.my.domain
1380 inet_interfaces = $myhostname
1381 </pre>
1383 </ul>
1385 <hr>
1387 <a name="delay"><h3>Postfix responds slowly to incoming SMTP connections</h3></a>
1389 Question:
1391 <blockquote>
1393 My Postfix server is too slow. When I telnet to the SMTP port
1394 (<tt>telnet hostname 25</tt>), the response comes after 40 seconds.
1395 On the other hand, when I telnet to the POP port (<tt>telnet
1396 hostname 110</tt>) the response comes with no delay.
1398 </blockquote>
1402 Answers:
1404 <blockquote>
1406 1) You need to configure Postfix to run more SMTP server processes.
1407 Edit the <b>smtpd</b> entry in the <b>master.cf</b> file and asjust
1408 the process limit, or increase the <b>default_process_limit</b>
1409 setting in the <b>main.cf</b> file. Issue the command <b>postfix
1410 reload</b> to make the change effective.
1414 2) You have a name service problem.
1418 Postfix calls the C library routines <b>gethostbyname()</b> and
1419 <b>gethostbyaddr()</b> in order to find out the SMTP client hostname.
1420 These library routines use several system configuration files in
1421 order to satisfy the request. They may in fact end up calling the
1422 DNS for reasons that are not under control by Postfix.
1426 Depending on your system, these controlling files can be named
1427 <b>/etc/nsswitch.conf</b>, <b>/etc/svcorder</b>, <b>/etc/host.conf</b>
1428 or otherwise. Those files specify whether the C library routines
1429 will use local <b>/etc/hosts</b> before or after DNS.
1431 </blockquote>
1433 <hr>
1435 <a name="numerical_log"><h3>Postfix logs SMTP clients as IP
1436 addresses</h3>
1438 <blockquote>
1440 The Postfix SMTP server logs client connections with numerical IP
1441 addresses instead of resolving the hostname. When I use <b>nslookup</b>
1442 the address does resolve to a name.
1444 </blockquote>
1448 You run the Postfix SMTP server inside a <b>chroot</b> jail for
1449 extra security, but some configuration files are missing or have
1450 incorrect information. The command "postfix check" will report
1451 what files may have incorrect information. For example:
1453 <blockquote>
1454 <pre>
1455 warning: /var/spool/postfix/etc/resolv.conf and /etc/resolv.conf differ
1456 warning: /var/spool/postfix/etc/localtime and /etc/localtime differ
1457 </pre>
1458 </blockquote>
1462 In order
1463 to run inside a chroot jail, the Postfix SMTP client and server
1464 need copies of system configuration files inside the Postfix queue
1465 directory. The exact list of files is very system dependent, but
1466 you will probably need at the very least:
1470 <pre>
1471 /var/spool/postfix/etc/resolv.conf
1472 /var/spool/postfix/etc/services
1473 </pre>
1477 Of course, these directories and files must be owned by root, but
1478 they must be accessible by the postfix user, so directories need
1479 mode 0755 and files need mode 0644.
1482 For more details, see the files in the <b>examples/chroot-setup</b>
1483 directory of the Postfix source code distribution.
1485 <hr>
1487 <a name="paranoid"><h3>warning: xxx.xxx.xxx.xxx: address not listed
1488 for hostname yyy.yyy.yyy</h3>
1490 Postfix uses hostnames in its junk mail and mail relay controls.
1491 This means that in theory someone could be motivated to set up
1492 bogus DNS information, in order to get past your junk mail or mail
1493 relay controls.
1497 When Postfix looks up the SMTP client hostname for the SMTP client
1498 IP address, then Postfix also checks if the SMTP client IP address
1499 is listed under the SMTP client hostname.
1503 If the SMTP client IP address is not listed under the SMTP client
1504 hostname, then Postfix concludes that the SMTP client hostname does
1505 not belong to the SMTP client IP address, and ignores the SMTP
1506 client hostname. A warning is logged, so that you can find out why
1507 an SMTP client is or is not stopped by your junk mail or mail relay
1508 checks.
1512 You could contact the people who maintain the SMTP client's DNS
1513 records, and explain to them that each IP address needs one PTR
1514 record, and that this one PTR record needs a matching A record.
1518 Some people read the RFCs such that one IP address can have multiple
1519 PTR records, but that makes PTR records even less useful than they
1520 already are. And in any case, having multiple names per IP address
1521 only worsens the problem of finding out the SMTP client hostname.
1523 <hr>
1525 <a name="mobile"><h3>Relaying mail for mobile users </h3>
1527 <blockquote>
1529 I have Postfix setup on a machine but I'd like to have a select
1530 group of Internet users be able to relay mail through it. I'd
1531 either like to base the relaying on IP address (e.g., a 256-block
1532 for dynamic IP people) or on hostname (whatever.dialup.isp.com)
1534 </blockquote>
1538 The most preferable way is to have users submit mail via some
1539 authenticated protocol instead of plain old SMTP.
1543 The next best way is to use plain old SMTP and to authenticate the
1544 user first, for example, with a "please login via POP before using
1545 SMTP" scheme. In that case, some software
1546 maintains
1547 a Postfix-compatible access table with client IP address information.
1551 <pre>
1552 /etc/postfix/main.cf:
1553 smtpd_recipient_restrictions =
1554 permit_mynetworks
1555 check_client_access hash:/etc/postfix/client_access
1556 reject_unauth_destination
1558 /etc/postfix/client_access:
1559 4.3.2.1 OK
1560 5.4.3.2 987654321
1561 </pre>
1565 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
1566 <b>dbm</b> files instead of <b>db</b> files. To find out what map
1567 types Postfix supports, use the command <b>postconf -m</b>.
1571 N.B. Some non-Postfix software uses <b>btree</b>
1572 files instead of <b>hash</b> files. In that case, you will have
1573 to adjust the above <b>check_client_access</b> restriction accordingly.
1577 A less preferable way is based on client IP address (for example,
1578 a 256-block) or DNS hostname (for example, whatever.pop.isp.com).
1579 This scheme does not authenticate the user. If you use IP/DNS-based
1580 relay access control, pray that no customer with that same ISP
1581 points their spam software at your machine, or else you may end up
1582 on internet-wide black lists.
1586 The least preferable way is based on the sender address. It is
1587 trivially easy to spoof by anyone who ever received mail from your
1588 site. If you use sender address access control, pray that no
1589 spammer ever finds out the address of your users.
1593 <pre>
1594 /etc/postfix/main.cf:
1595 smtpd_recipient_restrictions =
1596 permit_mynetworks
1597 check_client_access hash:/etc/postfix/client_access
1598 check_sender_access hash:/etc/postfix/sender_access
1599 reject_unauth_destination
1601 /etc/postfix/client_access:
1602 11.22.33 OK
1603 dialup.isp.com OK
1605 /etc/postfix/sender_access:
1606 joe@my.domain OK
1607 blow@my.domain OK
1608 </pre>
1610 <hr>
1612 <a name="relay_restrict"><h3>Restricting what users can send mail to off-site destinations</h3>
1614 <blockquote>
1616 How can I configure Postfix in a way that some users can send mail
1617 to the internet and other users not. The users with no access should
1618 receive a generic bounce message. Please don't discuss whether such
1619 access restrictions are necessary, it was not my decision.
1621 </blockquote>
1625 Postfix has support for per-user restrictions. The restrictions
1626 are implemented by the SMTP server. Thus, users that violate the
1627 policy have their mail rejected by the SMTP server. Like this:
1631 <blockquote>
1633 <pre>
1634 554 &lt;user@remote&gt;: Access denied
1635 </pre>
1637 </blockquote>
1641 The implementation uses two lookup tables. One table defines what
1642 users are restricted in where they can send mail, and the other
1643 table defines what destinations are local. It is left as an exercise
1644 for the reader to change this into a scheme where only some users
1645 have permission to send mail to off-site destinations, and
1646 where most users are restricted.
1650 The example assumes DB/DBM files, but this could also be done with
1651 LDAP or SQL.
1655 <pre>
1656 /etc/postfix/main.cf:
1657 smtpd_recipient_restrictions =
1658 check_sender_access hash:/etc/postfix/restricted_senders
1659 ...other stuff...
1661 smtpd_restriction_classes = local_only
1662 local_only = check_recipient_access hash:/etc/postfix/local_domains, reject
1664 /etc/postfix/restricted_senders:
1665 foo@domain local_only
1666 bar@domain local_only
1668 /etc/postfix/local_domains:
1669 this.domain OK <i>matches this.domain and subdomains</i>
1670 that.domain OK <i>matches that.domain and subdomains</i>
1671 </pre>
1675 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
1676 <b>dbm</b> files instead of <b>db</b> files. To find out what map
1677 types Postfix supports, use the command <b>postconf -m</b>.
1681 The <b>smtpd_restriction_classes</b> verbiage exists so that Postfix can
1682 open <b>/etc/postfix/local_domains.db</b> before entering a chroot
1683 jail, so it is only an artefact of implementation.
1687 This scheme does not authenticate the user, therefore it can be
1688 bypassed in several ways:
1692 <ul>
1694 <li>By sending mail as someone else who does have permission to
1695 send mail to off-site destinations.
1699 <li>By sending mail as yourself via a less restrictive mail relay
1700 host.
1702 </ul>
1704 <hr>
1706 <a name="backup"><h3>Configuring Postfix as MX host for a remote site</h3></a>
1708 When you are <b>secondary mx</b> for a <b>remote site</b> this is
1709 all you need:
1713 <pre>
1714 DNS:
1715 the.backed-up.domain.tld IN MX 100 your.machine.tld
1717 /etc/postfix/main.cf:
1718 relay_domains = $mydestination the.backed-up.domain.tld
1719 smtpd_recipient_restrictions = permit_mynetworks reject_unauth_destination
1720 </pre>
1724 <blink><b>DO NOT LIST the.backed-up.domain.tld in MYDESTINATION</b></blink>
1728 <blink><b>DO NOT LIST the.backed-up.domain.tld as a VIRTUAL DOMAIN</b></blink>
1732 When you are <b>primary mx</b> for a <b>remote site</b> you also
1733 need:
1737 <pre>
1738 /etc/postfix/main.cf:
1739 transport_maps = hash:/etc/postfix/transport
1741 /etc/postfix/transport:
1742 the.backed-up.domain.tld relay:[their.mail.host.tld]
1743 </pre>
1747 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
1748 <b>dbm</b> files instead of <b>db</b> files. To find out what map
1749 types Postfix supports, use the command <b>postconf -m</b>.
1751 <hr>
1753 <a name="dns-again"><h3>Mail stays queued with: Host not found, try again</h3></a>
1755 <blockquote>
1757 When I send mail to a remote address, the following happens:
1761 <pre>
1762 Jul 14 12:45:38 myhostname postfix/qmgr[2246]: 74FBF30501:
1763 from=&lt;sender@sender.domain&gt; size=309 (queue active)
1764 Jul 14 12:45:39 myhostname postfix/smtp[2349]: 74FBF30501:
1765 to=&lt;recip@recip.domain&gt; relay=none, delay=3944,
1766 status=deferred (Name service error for name=recip.domain
1767 type=MX: Host not found, try again)
1768 </pre>
1772 However, I can nslookup the hostname just fine.
1774 </blockquote>
1778 There can be several different problems.
1782 <ul>
1784 <li> First of all, the result of nslookup for the hostname may be
1785 irrelevant. Postfix is required to look up the MX record first. So
1786 your nslookup test should begin with asking for the MX record. Some
1787 DNS servers are broken and produce no reply when asked for a
1788 non-existent MX record.
1790 <p> <li> Secondly, the nslookup test is invalid if you ran it as
1791 a privileged user. Postfix DNS lookups are known to fail because
1792 of incorrect permissions on system files and directories. For
1793 example, a common beginner's mistake is to lose world read permission
1794 for the <b>/etc/resolv.conf</b> file.
1796 <p> <li>
1798 Check out your Postfix <b>master.cf</b> file. If the SMTP client
1799 runs chrooted, then it needs a bunch of files inside the Postfix
1800 queue directory. Examples are in the source distribution in the
1801 <b>examples</b> subdirectory. See also the other FAQ entry on
1802 <a href="#numerical_log">name service trouble</a>.
1804 </ul>
1806 <hr>
1808 <a name="timeouts"><h3>Mail fails consistently with timeout or lost connection</h3></a>
1810 Every now and then, mail fails with "timed out while sending end
1811 of data -- message may be sent more than once", or with: "lost
1812 connection after DATA". Network outages happen, systems crash.
1813 There isn't much you can do about it. Usually the problem goes away
1814 by itself.
1818 However, when you see mail deliveries fail consistently, you may
1819 have a different problem: broken path MTU discovery. Or it could
1820 be a broken PIX firewall.
1822 <h4>Cisco PIX "fixup protocol smtp" bug</h4>
1824 The Cisco PIX firewall has a bug when running software older than
1825 version 5.2(4) or 6.0(1).
1829 The bug ID is CSCds90792. The "fixup protocol smtp" feature does
1830 not correctly handle the case where the "." and the "CRLF" at the
1831 end of mail are sent in separate packets.
1835 How does one recognize a mailer behind a Cisco PIX with "fixup
1836 protocol smtp" enabled? As of version 5.1 and later, the fixup
1837 protocol smtp command changes the characters in the SMTP banner to
1838 asterisks except for the "2", "0" and "0 SPACE" characters.
1842 When you connect to a mailer behind such a filter you see something
1843 like:
1845 <blockquote>
1846 <pre>
1847 220 **************************************0******0*********20 ****200**0*********0*00
1848 </pre>
1849 </blockquote>
1851 <h4>IP path MTU discovery</h4>
1853 A little background is in order. With the SMTP protocol, the HELO,
1854 MAIL FROM and RCPT TO commands and responses are relatively short.
1855 When you're talking to old versions of sendmail, every command and
1856 every response is sent as a separate packet, because sendmail didn't
1857 implement ESMTP command pipelining until recently.
1861 The message content, however, is sent as a few datagrams, each
1862 datagram typically a kbyte large or even bigger, depending on your
1863 local network MTU.
1867 When mail fails consistently due to a timeout, I suspect that the
1868 sending machine runs a modern UNIX which implements path MTU
1869 discovery. That causes the machine to send packets as large as it
1870 would send over the LAN, with the IP DON'T FRAGMENT bit set,
1871 preventing intermediate routers from fragmenting the packets that
1872 are too big for their networks.
1876 Depending on what network path a message follows, some router on
1877 the way responds with an ICMP MUST FRAGMENT message saying the
1878 packet is too big. Normally, the sending machine will re-send the
1879 data after chopping it up into smaller pieces.
1883 However, things break when some router closer to the sending system
1884 is dropping such ICMP feedback messages, in a mistaken attempt to
1885 protect systems against certain attacks. In that case, the ICMP
1886 feedback message never reaches the sending machine, and the connection
1887 times out.
1891 This is the same configuration problem that causes trouble with
1892 web servers behind a misconfigured packet filter: small images/files
1893 are sent intact, large images/files time out because the server
1894 does not see the MUST FRAGMENT ICMP feedback messages.
1898 Workaround: at the sending machine, disable path MTU discovery. Mail
1899 will get out, but of course everyone else will still suffer. How
1900 to disable path MTU discovery? It depends. Solaris has an <b>ndd</b>
1901 command; other systems use different means such as <b>sysctl</b>
1902 to control kernel parameters on a running system.
1906 Workaround: at the receiving machine, set a smaller MTU. For example,
1907 people using PPPoE (PPP over Ethernet) often have to choose
1908 an MTU lightly smaller than the default 1500 for ethernet.
1912 Fix: find the router that drops the ICMP MUST FRAGMENT messages,
1913 and convince the person responsible for it to fix the configuration.
1915 <hr>
1917 <a name="skip_greeting"><h3>Postfix does not try all the MX
1918 addresses</h3>
1920 When delivering mail, Postfix tries all MX addresses in order of
1921 preference, and stops at the first server that speaks SMTP. However,
1922 once an SMTP greeting is received, Postfix will not move on to the
1923 next MX host if the delivery fails.
1927 This will eventually be solved when Postfix implements SMTP
1928 connection caching.
1930 <hr>
1932 <a name="noservice"><h3>What does "fatal: unknown service: smtp/tcp"
1933 mean?</h3>
1935 Your Postfix <b>/etc/postfix/master.cf</b> file specifies that the
1936 Postfix SMTP client runs inside a <b>chroot</b> environment. However,
1937 the files necessary for that mode of operation are not installed
1938 below <b>/var/spool/postfix</b>.
1942 Enabling <b>chroot</b> operation adds a non-trivial barrier for
1943 system penetrators.
1947 Two solutions:
1949 <ul>
1951 <li> Disable the <b>chroot</b> in <b>/etc/postfix/master.cf</b>
1952 (and issue <b>postfix reload</b> when done).
1956 <li>Install the necessary files for <b>chroot</b> operation.
1957 Instructions are given in the source code distribution, in the
1958 <b>examples/chroot-setup</b> directory.
1960 </ul>
1962 <hr>
1964 <a name="broken_transport"><h3>Mail delivery fails with: "unknown
1965 mail transport error"</h3>
1967 This is an opportunity to meet your friends <b>egrep</b> and
1968 <b>less</b>. Postfix activity, including progres and failure, is
1969 logged to a logfile, typically named <b>/var/log/maillog</b>. To
1970 find out where Postfix activity is logged on your machine, examine
1971 the <b>/etc/syslog.conf</b> file.
1973 <p>
1975 To find out the cause for the "unknown mail transport error", type
1976 the following command:
1978 <blockquote>
1980 <tt>egrep '(warning|fatal|panic):' /var/log/maillog | less</tt>
1982 </blockquote>
1984 Pay particular attention to messages that are labeled as <b>fatal</b>
1985 and <b>panic</b>. These describe catastrophic failures that need
1986 to be addressed before Postfix is happy. Problems labeled as
1987 <b>fatal</b> are fixed by you, by adjusting configuration files,
1988 file permissions and so on. Problems labeled as <b>panic</b> are
1989 fixed by the Postfix author, by changing Postfix source code.
1991 <hr>
1993 <a name="root"> <h3>Root's mail is delivered to nobody</h3>
1995 If you use <a href="#procmail">procmail</a> (or some other command)
1996 for local mail delivery, Postfix will not deliver mail as root.
1997 Instead, Postfix runs <b>procmail</b> (or whatever) as <b>nobody</b>.
1998 Perhaps some day Wietse will trust Postfix enough to run external
1999 commands as <b>root</b>.
2003 Solution: just like you're not supposed to log in as <b>root</b>
2004 (except for unusual conditions), you're not supposed to receive
2005 mail as <b>root</b>.
2009 <ul>
2011 <li>Create a mail alias for <b>root</b> that forwards mail to a
2012 real user.
2016 <pre>
2017 /etc/aliases:
2018 root: you
2019 </pre>
2023 <li>Execute the command <b>newaliases</b> whenever you change the
2024 alias database.
2026 </ul>
2030 On some systems the alias database is not in <b>/etc/aliases</b>.
2031 To find out the location for your system, execute the command
2032 <b>postconf alias_maps</b>.
2034 <hr>
2036 <a name="biff"><h3>What does "biff_notify: Connection refused" mean?</h3>
2038 By default, the Postfix local delivery agent attempts to notify
2039 local users of the arrival of new mail. This feature makes use of
2040 the <b>comsat</b> network service, which is turned off on many UNIX
2041 systems for performance and/or security reasons.
2045 The Postfix warning message means that new mail notification failed
2046 because the <b>comsat</b> network service is turned off.
2050 To disable the <b>comsat</b> client code in the Postfix delivery agent,
2051 specify:
2055 <pre>
2056 /etc/postfix/main.cf:
2057 biff = no
2058 </pre>
2062 Note: recent versions of <b>procmail</b> also produce <b>biff</b>
2063 notifications. To silence <b>biff</b> completely you may also have
2064 to update <b>procmail</b> configuration files.
2068 To enable the <b>comsat</b> network service, uncomment the
2069 corresponding entry in the <b>inetd.conf</b> file, and <b>kill -HUP</b>
2070 the <b>inetd</b> process.
2072 <hr>
2074 <a name="nisdom"><h3>What does "NIS domain name not set - NIS lookups disabled" mean?</h3>
2078 The warning message means that NIS (Network Information Service)
2079 is not enabled on your machine. That is perfectly OK. It's just
2080 hard for Postfix to find out about these things ahead of time.
2084 To disable the <b>NIS</b> client code in the Postfix local delivery agent,
2085 update the corresponding section in the <b>main.cf</b> file and specify
2086 one of the following, depending on the type of aliases file:
2090 <pre>
2091 /etc/postfix/main.cf:
2092 alias_maps = $alias_database
2093 </pre>
2097 This forces Postfix to use only the local aliases database, if one
2098 is defined.
2100 <hr>
2102 <a name="bogus"><h3>Postfix rejects mail with "User unknown in
2103 local recipient table"</h3></a>
2105 As of version Postfix 2.0, you are expected to tell the Postfix
2106 SMTP server what local users exist by listing all tables with local
2107 usernames or addresses in the <b>local_recipient_maps</b> parameter.
2108 To find out what Postfix version you have, execute the command
2109 <b>postconf mail_version</b>.
2113 The default <b>local_recipient_maps</b> setting assumes that
2114 you use the default Postfix local delivery agent:
2118 <pre>
2119 /etc/postfix/main.cf:
2120 local_recipient_maps = $alias_maps, proxy:unix:passwd.byname
2121 </pre>
2125 You need the <b>proxy:</b> part only if <b>master.cf</b> specifies
2126 that the Postfix SMTP server runs chrooted. As distributed by the
2127 author, Postfix runs no daemons chrooted.
2131 The local recipients tables are searched by the recipient address
2132 (user@domain) and by the recipient name (the address minus the
2133 domain). Postfix does not care what the lookup result looks like,
2134 so you can use any database that Postfix understands the format
2139 To stop Postfix from rejecting local mail incorrectly:
2141 <ul>
2143 <li> If you run the Postfix SMTP server chrooted, you need to access
2144 the system password database through the Postfix <a href="proxymap.8.html">
2145 proxymap</a> service, as shown in the above example. The alternative
2146 is simply not practical: placing a copy of the passwd file inside
2147 the chroot jail (typically: in <b>/var/spool/postfix/etc</b>)
2148 together with a list of system dependent files.
2152 <li> If you enable the local delivery agent <b>luser_relay</b>
2153 feature, then you must disable the <b>local_recipient_maps</b>
2154 feature as described below.
2158 <li> If you use the local delivery agent <b>mailbox_transport</b>
2159 or <b>fallback_transport</b> features to receive mail for users
2160 not in /etc/passwd, then you need to list those users under
2161 <b>local_recipient_maps</b>, or you need to disable the
2162 <b>local_recipient_maps</b> feature as described below.
2166 <li> If you redefine the local delivery agent in <b>master.cf</b>
2167 or in the <b>local_transport</b> setting in <b>main.cf</b>, then
2168 you need to list the local recipients under <b>local_recipient_maps</b>,
2169 or you need to disable the <b>local_recipient_maps</b> feature as
2170 described below.
2172 </ul>
2176 To disable the <b>local_recipient_maps</b> feature, specify:
2178 <pre>
2179 /etc/postfix/main.cf:
2180 local_recipient_maps =
2181 </pre>
2185 With this setting, the Postfix SMTP server will not reject mail
2186 for unknown local recipients.
2188 <hr>
2190 <a name="some_local"><h3>Delivering some users locally while sending
2191 mail as user@domain</h3></a>
2193 <ul>
2195 <li>In order to send mail as <i>user@domain.tld</i>, specify what
2196 domain is to be appended to addresses that do not have a domain:
2200 <pre>
2201 /etc/postfix/main.cf:
2202 myorigin = domain.tld
2203 </pre>
2207 <li>In order to receive some users locally, such as <b>root</b> or
2208 <b>postmaster</b>, specify a virtual lookup table with the non-default
2209 destinations:
2213 <pre>
2214 /etc/postfix/main.cf:
2215 virtual_alias_maps = hash:/etc/postfix/virtual
2217 /etc/postfix/virtual:
2218 root root@localhost
2219 postmaster postmaster@localhost
2220 </pre>
2224 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
2225 <b>dbm</b> files instead of <b>db</b> files. To find out what map
2226 types Postfix supports, use the command <b>postconf -m</b>.
2230 <li>Execute the command <b>postmap /etc/postfix/virtual</b> whenever
2231 you edit the <b>virtual</b> table.
2235 <li>Execute the command <b>postfix reload</b> to make the changes
2236 effective.
2238 </ul>
2240 <hr>
2242 <a name="maildir"><h3>Support for maildir-style mailboxes</h3> </a>
2244 <b>Maildir</b> is a specific one-file-per-message organization that
2245 was introduced with the <b>qmail</b> system by Daniel Bernstein.
2246 In order to turn on <b>maildir</b>-style delivery, specify,
2247 for example:
2251 <pre>
2252 /etc/postfix/main.cf:
2253 home_mailbox = Maildir/
2254 </pre>
2258 Any relative pathname that ends in <b>/</b> turns on <b>maildir</b>
2259 delivery. The <b>home_mailbox</b> value is appended to the user's
2260 home directory pathname.
2264 The <b>maildir</b> format is also supported with delivery via
2265 aliases or via <b>.forward</b> files. Specify <i>/file/name/</i>
2266 as destination. The trailing <b>/</b> turns on <b>maildir</b>
2267 delivery.
2269 <hr>
2271 <a name="procmail"><h3>Using Procmail for system-wide local delivery</h3> </a>
2273 Warning: if you use <b>procmail</b> in this manner, you must set
2274 up an alias for <b>root</b> that forwards mail for <b>root</b> to
2275 a real user. See the FAQ entry titled "<a href="#root">Mail for root
2276 is delivered to nobody</a>".
2278 <ul>
2280 <li>Specify that all mailbox delivery is to be done by <b>procmail</b>.
2281 For example:
2285 <pre>
2286 /etc/postfix/main.cf:
2287 mailbox_command = /path/to/procmail
2289 /etc/postfix/main.cf:
2290 mailbox_command = /path/to/procmail -a $EXTENSION
2291 </pre>
2295 If you can, avoid using any shell meta characters or built-ins such
2296 as <b>$</b> or <b>"</b> or <b>IFS</b> or <b>&amp;&amp;</b>, because
2297 they force Postfix to run an expensive shell process. However,
2298 procmail is a pig, and the gain of avoiding a shell can be
2299 unnoticeable.
2303 <li>Execute the command <b>postfix reload</b> to make the changes
2304 effective.
2306 </ul>
2308 Postfix exports information via environment variables. The contents
2309 are censored. Characters that may have special meaning to the shell,
2310 including whitespace, are replaced by underscores.
2314 <blockquote>
2316 <dl>
2318 <dt><b>DOMAIN</b> <dd> The text to the right-hand side of the
2319 <b>@</b> in the recipient address.
2321 <dt><b>EXTENSION</b> <dd> Optional address extension part.
2323 <dt><b>HOME</b> <dd> The recipient's home directory.
2325 <dt><b>LOCAL</b> <dd> The text to the left-hand side of the <b>@</b>
2326 in the recipient address, for example, <b>$USER+$EXTENSION</b>.
2328 <dt><b>LOGNAME</b> <dd> The recipient username.
2330 <dt><b>RECIPIENT</b> <dd> The entire recipient address,
2331 <b>$LOCAL@$DOMAIN</b>.
2333 <dt><b>SENDER</b> <dd> The complete sender address.
2335 <dt><b>SHELL</b> <dd> The recipient's login shell.
2337 <dt><b>USER</b> <dd> The recipient username.
2339 </dl>
2341 </blockquote>
2343 <hr>
2345 <a name="nopass"><h3>What does "warning: cannot access UNIX password
2346 database" mean?</h3></a>
2348 This message is logged when, for example, the Postfix SMTP server
2349 is unable to access the UNIX password database.
2353 <ul>
2355 <li> If you're running the Postfix SMTP server chrooted (see
2356 <b>master.cf</b>) then you need to access the system password
2357 database through the Postfix <a href="proxymap.8.html">proxymap</a>
2358 service. The alternative is not practical: copying the password
2359 file and perhaps a bunch of other system dependent files into the
2360 Postfix queue directory.
2364 <pre>
2365 /etc/postfix/main.cf:
2366 local_recipient_maps = proxy:unix:passwd.byname $alias_maps ...
2367 </pre>
2371 <li> Chrooted or not, be sure that you have world execute permissions
2372 on directories and world read permission on the passwd file and
2373 any auxiliary files that may be needed (such as <b>/etc/nsswitch.conf</b>
2374 and <b>libnss*.so*</b> files referenced by <b>/etc/nsswitch.conf</b>).
2376 </ul>
2378 <hr>
2380 <a name="delivered"><h3>Getting rid of the ugly Delivered-To: header</h3> </a>
2382 Some people will complain about the ugly <b>Delivered-To:</b>
2383 message header that Postfix prepends to their mail. By default,
2384 Postfix prepends this header when forwarding mail, and when delivering
2385 to file (mailbox) or command. The purpose is to stop mail forwarding
2386 loops as early as possible, that is, before they have a chance to
2387 happen. But the header is ugly, no question about it.
2391 Solutions, ranging from fighting symptoms to turning off the
2392 <b>Delivered-To:</b> header:
2396 <ul>
2398 <li>
2400 Fortunately, many mail user agents have per-user or even system-wide
2401 configuration files that can be set up to suppress <b>Delivered-To:</b>
2402 headers (for example <b>~/.mailrc</b> and <b>/usr/lib/Mail.rc</b>).
2406 <li>
2408 With mailing lists, <b>Delivered-To:</b> can get in the way when
2409 the list exploder uses a "secret" alias that should not be shown
2410 in outbound mail. The recommended solution is to use a regular
2411 expression-based filter at the SMTP port:
2415 <pre>
2416 /etc/postfix/main.cf:
2417 smtpd_recipient_restrictions =
2418 ... regexp:/etc/postfix/access_regexp ...
2419 smtpd_recipient_restrictions =
2420 ... pcre:/etc/postfix/access_regexp ...
2422 /etc/postfix/access_regexp:
2423 /^(.*)-outgoing@(.*)/ 554 Use $1@$2 instead
2424 </pre>
2428 POSIX regular expression support (regexp) is enabled by default on
2429 modern UNIX systems. Perl-compatible regular expression support
2430 (pcre) is optional; see the PCRE_README file in the top-level
2431 Postfix source directory.
2435 <li>
2437 The <b>prepend_delivered_header</b> configuration parameter controls
2438 when <b>Delivered-To:</b> is prepended. The default setting is
2439 <b>command, file, forward</b> (translation: prepend <b>Delivered-To:</b>
2440 when delivering to command, when delivering to file, and when
2441 forwarding mail). <i>Turning off <b>Delivered-To:</b> when forwarding
2442 mail is not recommended</i>.
2444 </ul>
2448 See also the FAQ item for problems with the <b>majordomo</b> <a
2449 href="#majordomo-approve">approve</a> command.
2451 <hr>
2453 <a name="majordomo-approve"><h3>Postfix breaks the majordomo "approve"
2454 command</h3> </a>
2456 The Postfix local delivery agent prepends a <b>Delivered-To:</b>
2457 message header to prevent mail forwarding loops. With <b>majordomo</b>
2458 mailing lists, <b>Delivered-To:</b> gets in the way when the
2459 moderator wants to approve postings that were sent to the list.
2460 The Postfix system claims that the mail is looping.
2464 Currently, the recommended workaround is to edit the <b>approve</b>
2465 script to strip any header lines that match:
2469 <pre>
2470 /delivered-to/i
2472 </pre>
2476 Yes, this assumes that the moderator knows what she is doing.
2480 A less-preferred workaround is to not insert <b>Delivered-To:</b>
2481 when delivering to commands such as majordomo. See the FAQ entry
2482 titled "<a href="#delivered">Getting rid of the ugly Delivered-To:
2483 header</a>".
2485 <hr>
2487 <a name="worm"><h3>Postfix accepts MAIL FROM and RCPT TO "| command"</h3>
2489 With Postfix, | or / has special meaning only when it appears in
2490 aliases, .forward files or in :include: files. It has no special
2491 meaning in mail addresses.
2496 If you must receive mail for systems with 10-year old vulnerabilities,
2497 it is prudent to set up a regexp filter that rejects potentially
2498 harmful MAIL FROM or RCPT TO commands.
2502 <pre>
2503 /etc/postfix/main.cf:
2504 smtpd_sender_restrictions =
2505 regexp:/etc/postfix/envelope-regexp
2506 reject_unknown_sender_domain
2507 smtpd_recipient_restrictions =
2508 regexp:/etc/postfix/envelope-regexp
2509 permit_mynetworks
2510 reject_unauth_destination
2512 /etc/postfix/envelope-regexp:
2513 /[/|]/ REJECT
2514 </pre>
2518 However, rejecting all envelope addresses with / causes trouble
2519 with simple-minded X.400 to Internet address mappings that leave
2520 the X.400 address structure exposed.
2524 See also the documentation on <a href="uce.html#header_checks">header
2525 checks</a> restrictions for message header contents. These restrictions
2526 can be used to protect against attacks with command/file destinations
2527 in, for example, Errors-To: or Return-Receipt_To: message headers.
2529 <hr>
2531 <a name="internal-list"><h3>Protecting internal email distribution lists</h3>
2533 <blockquote>
2535 We want to implement an internal email distribution list. Something
2536 like all@our.domain.com, which aliases to all employees. My first
2537 thought was to use the aliases map, but that would lead to "all"
2538 being accessible from the "outside", and this is not desired...
2541 </blockquote>
2543 Postfix can implement per-address access controls. What follows
2544 is based on the SMTP client IP address, and therefore is subject
2545 to IP spoofing.
2549 <pre>
2550 /etc/postfix/main.cf:
2551 smtpd_recipient_restrictions =
2552 hash:/etc/postfix/access
2553 ..the usual stuff...
2555 /etc/postfix/access:
2556 all permit_mynetworks,reject
2557 </pre>
2561 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
2562 <b>dbm</b> files instead of <b>db</b> files. To find out what map
2563 types Postfix supports, use the command <b>postconf -m</b>.
2567 Now, that would be sufficient when your machine receives all Internet
2568 mail directly from the Internet. That's unlikely if your network
2569 is a bit larger than an office. For example your backup MX hosts
2570 would "launder" the client IP address of mail from outside so it
2571 would appear to come from a trusted machine.
2575 In the general case you need two lookup tables: one table that
2576 lists destinations that need to be protected, and one table that
2577 lists domains that are allowed to send to the protected destinations.
2581 What follows is based on the sender SMTP envelope address, and
2582 therefore is subject to SMTP sender spoofing.
2586 <pre>
2587 /etc/postfix/main.cf:
2588 smtpd_recipient_restrictions =
2589 hash:/etc/postfix/protected_destinations
2590 ..the usual stuff...
2592 smtpd_restriction_classes = insiders_only
2593 insiders_only = check_sender_access hash:/etc/postfix/insiders, reject
2595 /etc/postfix/protected_destinations:
2596 all@my.domain insiders_only
2597 all@my.hostname insiders_only
2599 /etc/postfix/insiders:
2600 my.domain OK
2601 another.domain OK
2602 </pre>
2606 The smtpd_restriction_classes verbiage is needed so that Postfix
2607 knows what lookup tables to open before it goes to chroot jail.
2608 It is only an artefact of the implementation.
2612 Getting past this scheme is relatively easy, because all one has
2613 to do is to spoof the SMTP sender address.
2617 If the internal list is a low-volume one, perhaps it makes more
2618 sense to make it moderated.
2620 <hr>
2622 <a name="bogus_valias"><h3>Postfix rejects mail with "User unknown in virtual alias table"</h3></a>
2624 Answer: you have listed the virtual domain name in the tables
2625 specified with the <b>virtual_alias_domains</b> parameter, but the
2626 recipient address is not listed in the tables specified with
2627 the <b>virtual_alias_maps</b> parameter.
2631 If you want to deliver the domain via the Postfix <a
2632 href="virtual.8.html">virtual</a>(8) mailbox delivery agent, then
2633 you should list the virtual domain name in the tables specified
2634 with the <b>virtual_mailbox_domains</b> parameter instead.
2636 <hr>
2638 <a name="bogus_vmbox"><h3>Postfix rejects mail with "User unknown
2639 in virtual mailbox table"</h3></a>
2641 Answer: you have listed the virtual domain name in the tables
2642 specified with the <b>virtual_mailbox_domains</b> parameter, but
2643 the recipient address is not listed in the tables specified with
2644 the <b>virtual_mailbox_maps</b> parameter.
2648 If you want to deliver the domain as a <a href="virtual.5.html">
2649 virtual</a>(5) alias domain, where each address is aliased to
2650 a real local or remote address, then you should list
2651 the virtual domain name in the tables specified with the
2652 <b>virtual_alias_domains</b> parameter instead.
2654 <hr>
2656 <a name="unknown_virtual_accept"><h3>Postfix does not refuse mail for
2657 unknown users in virtual domains</h3></a>
2659 <a name="unknown_virtual_loop"><h3>Mail for unknown users in a
2660 virtual domain fails with "mail loops back to myself"</h3></a>
2662 <a name="virtual_relay"><h3>Postfix refuses mail for virtual
2663 domains with "relay access denied"</h3></a>
2665 Solutions:
2667 <ul>
2669 <li>Specify a virtual alias domain as per the
2670 <a href="virtual.5.html">virtual(5)</a> manual page.
2674 <li>Specify a virtual mailbox domain as per the <a
2675 href="virtual.8.html">virtual(8)</a> manual page.
2677 </ul>
2679 <hr>
2681 <a name="virtual_command"><h3>Commands, mailing lists, and /file/name
2682 destinations don't work in virtual domains</h3>
2686 Quick answer: set up "punch through" virtual aliases that redirect
2687 the mail to local Postfix aliases:
2691 <pre>
2692 /etc/postfix/main.cf:
2693 virtual_alias_maps = hash:/etc/postfix/virtual
2695 /etc/postfix/virtual:
2696 listname@virtual.tld listname
2697 owner-listname@virtual.tld owner-listname
2698 listname-request@virtual.tld listname-request
2700 /etc/aliases:
2701 listname: "|whatever"
2702 owner-listname: user@domain
2703 listname-request: "|whatever"
2704 </pre>
2708 This redirects mail for virtual address <i>listname@virtual.tld</i>
2709 etc. to local address <i>listname@your.domain.tld</i> etc.. Mail
2710 for these local aliases is then delivered to external commands or
2711 files etc. by the Postfix local delivery agent.
2715 Long answer:
2719 Delivering mail to a file or command is a security-sensitive
2720 operation, because the operation must be executed with the right
2721 privileges. Only <b>root</b>-privileged software such as the
2722 Postfix local delivery agent can set the privileges for command
2723 or file delivery.
2727 For security reasons, Postfix tries to avoid using <b>root</b>
2728 privileges where possible. In particular, Postfix virtual mapping
2729 is done by an unprivileged daemon, so there is no secure way to
2730 execute commands or to deliver to files specified in virtual maps.
2732 <hr>
2734 <a name="domain_mailbox"><h3>Receiving a virtual domain in a mailbox</h3>
2736 Question: how to receive all mail for a domain in a mailbox without
2737 losing the original recipient information? The Postfix Delivered-To:
2738 mail header shows only the mailbox owner, not the virtual address
2739 that the mail was sent to.
2743 Answer: Postfix logs the original recipient address in the
2744 <b>X-Original-To:</b> message header.
2746 <hr>
2748 <a name="masquerade"><h3>Address masquerading with exceptions</h3></a>
2750 For people outside your organization it can be desirable to only
2751 see addresses of the form <i>user@company.com</i> rather than
2752 addresses with individual internal host names. This can be achieved
2753 with address masquerading.
2757 Address masquerading is intended for use only on mail gateways.
2759 <ul>
2761 <li>In order to have all mail through the gateway host appear as
2762 coming from <i>user@my.domain</i>, specify:
2766 <pre>
2767 /etc/postfix/main.cf:
2768 masquerade_domains = $mydomain
2769 </pre>
2773 Note that the gateway should have <b><a
2774 href="rewrite.html#append_dot_mydomain">append_dot_mydomain</a></b>
2775 and <b><a href="rewrite.html#append_at_myorigin">append_at_myorigin</a></b>
2776 turned on (which is the default setting) so that all addresses are
2777 fully qualified before they are subjected to address masquerading.
2779 </ul>
2783 In some cases, you may wish to have certain users or hosts exempted
2784 from masquerading.
2786 <ul>
2788 <li>To exempt certain <i>users</i> from masquerading,
2789 such as <b>root</b>, specify:
2793 <pre>
2794 /etc/postfix/main.cf:
2795 masquerade_exceptions = root
2796 </pre>
2800 <li>To exempt certain <i>hosts</i> from masquerading, write
2801 <b>masquerade_domains</b> as:
2805 <pre>
2806 /etc/postfix/main.cf:
2807 masquerade_domains = somehost.my.domain otherhost.my.domain $mydomain
2808 </pre>
2812 Note that the order above is crucial: exemptions such as
2813 <i>somehost.my.domain</i> must precede <i>$mydomain</i> in the
2814 statement.
2818 It should go without saying that if a particular host you wish to
2819 exempt this way is originating mail as <i>user@my.domain</i> in
2820 the first place, you can hardly exempt it.
2824 </ul>
2826 As usual, execute the command <b>postfix reload</b> to make the changes
2827 effective.
2831 <hr>
2833 <a name="loop"><h3>What does "Error: too many hops" mean?</h3></a>
2835 Short answer: this message means that mail is probably looping. If
2836 you see this after you turned on Postfix content filtering, then
2837 you have made a mistake that causes mail to be filtered repeatedly.
2838 This is cured by appropriate use of <tt>content_filter=</tt>,
2839 <tt>header_checks=</tt>, and <tt>body_checks=</tt>.
2843 Long answer: the message has too many Received: message headers.
2844 A received header is added whenever Postfix (or any MTA) receives
2845 a message. A large number of Received: message headers
2846 is an indication that mail is looping around.
2850 Side comment: email uses the opposite of the technique that is used
2851 to avoid IP forwarding loops. With IP, the sender sets a TTL (time
2852 to live) field in the IP header. The field is decremented by each
2853 router. When the TTL reaches zero the packet is discarded and an
2854 ICMP error message is returned to the sender.
2856 <hr>
2859 <a name="uucp-tcp"><h3>Using UUCP over TCP</h3>
2861 This subject comes up whenever someone asks about a "domain in
2862 a mailbox" solution. For first-hand information, see the guides
2863 listed below.
2865 <ul>
2867 <li>Jim Seymour's guide for using <a
2868 href="http://jimsun.LinxNet.com/jdp/uucp_over_tcp/index.html"> UUCP
2869 over TCP</a>.
2873 <li>Craig Sanders's guide for using <a
2874 href="http://taz.net.au/postfix/uucp/"> SSL-encrypted UUCP over
2875 tcp using stunnel</a>.
2877 </ul>
2879 <hr>
2881 <a name="internet-uucp"><h3>Setting up an Internet to UUCP gateway</h3> </a>
2883 Here is how to set up a machine that sits on the Internet and that
2884 delivers <i>some</i> but not all non-local mail via UUCP. See the
2885 <a href="#uucp-only">UUCP-only</a> FAQ entry for setting a UUCP-only
2886 host.
2890 <ul>
2892 <li>You need an <b>rmail</b> program that extracts the sender
2893 address from mail that arrives via UUCP, and that feeds the mail
2894 into the Postfix <b>sendmail</b> command. Most UNIX systems come
2895 with an <b>rmail</b> utility. If you're in a pinch, try the one
2896 bundled with the Postfix source code in the <b>auxiliary</b>
2897 directory. Some day Postfix may have its own <b>rmail</b> command.
2901 <li>Specify that mail for, let's say, <i>some.domain</i>, should
2902 be delivered via UUCP, for example, to a host named <i>uucp-host</i>:
2906 <pre>
2907 /etc/postfix/transport:
2908 some.domain uucp:uucp-host
2909 .some.domain uucp:uucp-host
2910 </pre>
2914 See the <a href="transport.5.html">transport</a> manual page
2915 for more details.
2919 <li>Execute the command <b>postmap /etc/postfix/transport</b> whenever
2920 you change the <b>transport</b> file.
2924 <li>Enable <b>transport</b> table lookups:
2928 <pre>
2929 /etc/postfix/main.cf:
2930 transport_maps = hash:/etc/postfix/transport
2931 </pre>
2935 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
2936 <b>dbm</b> files instead of <b>db</b> files. To find out what map
2937 types Postfix supports, use the command <b>postconf -m</b>.
2941 <li>Define a mail transport for delivery via UUCP:
2943 <pre>
2944 /etc/postfix/master.cf:
2945 uucp unix - n n - - pipe
2946 flags=F user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
2947 </pre>
2951 This runs the <b>uux</b> command, and substitutes the next-hop
2952 hostname (<i>uucp-host</i>) and the recipients before executing
2953 the command. The <b>uux</b> command is executed without assistance
2954 from the shell, so there are no problems with shell meta characters.
2958 <li>Add <i>some.domain</i> to the list of domains that your site
2959 is willing to relay mail for.
2963 <pre>
2964 /etc/postfix/main.cf:
2965 relay_domains = some.domain $mydestination ...
2966 </pre>
2970 See the <a href="uce.html#relay_domains">relay_domains</a>
2971 configuration parameter description for details.
2975 <li>Execute the command <b>postfix reload</b> to make the
2976 changes effective.
2978 </ul>
2980 <hr>
2982 <a name="uucp-only"><h3>Using UUCP as the default transport</h3> </a>
2984 Here is how to relay all your mail over a UUCP link. See the <a
2985 href="#internet-uucp">Internet to UUCP</a> FAQ entry for setting
2986 up a machine that gateways between UUCP and SMTP.
2990 <ul>
2992 <li>There is no need for a <b>transport</b> table.
2996 <li> Specify that all remote mail must be sent via the <b>uucp</b>
2997 mail transport to your UUCP gateway host, say, <i>uucp-gateway</i>:
3001 <pre>
3002 /etc/postfix/main.cf:
3003 relayhost = uucp-gateway
3004 default_transport = uucp
3005 </pre>
3009 <li>Define a message transport for mail delivery via UUCP:
3013 <pre>
3014 /etc/postfix/master.cf:
3015 uucp unix - n n - - pipe
3016 flags=F user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
3017 </pre>
3021 This runs the <b>uux</b> command, and substitutes the next-hop
3022 hostname (<i>uucp-gateway</i>, or whatever you specified) and the
3023 recipients before executing the command. The <b>uux</b> command
3024 is executed without assistance from the shell, so there are no
3025 problems with shell meta characters.
3029 <li>Execute the command <b>postfix reload</b> to make the
3030 changes effective.
3032 </ul>
3034 <hr>
3036 <a name="fax"><h3>Sending mail to a FAX machine</h3></a>
3038 The following information is by Joerg Henne:
3041 Over here we are using the scheme &lt;fax number&gt;@fax.our.domain
3042 with Postfix and HylaFax. Here's the setup used:
3046 <pre>
3047 /etc/postfix/master.cf:
3048 fax unix - n n - 1 pipe
3049 flags= user=fax argv=/usr/bin/faxmail -d -n ${user}
3051 /etc/postfix/transport:
3052 fax.your.domain fax:localhost
3054 /etc/postfix/main.cf:
3055 transport_maps = hash:/etc/postfix/transport
3056 fax_destination_recipient_limit = 1
3057 </pre>
3061 The process limit of 1 in the <b>master.cf</b> file is necessary
3062 with fax software that cannot handle multiple requests at the same
3063 time. It won't hurt otherwise.
3067 The <b>fax_destination_recipient_limit</b> entry (by Simon, Mr.
3068 Simix) is necessary with fax software that can't have more than
3069 one destination on its command line. It won't hurt otherwise.
3073 Specify <B>dbm</b> instead of <b>hash</b> if your system uses
3074 <b>dbm</b> files instead of <b>db</b> files. To find out what map
3075 types Postfix supports, use the command <b>postconf -m</b>.
3079 Note: be sure to not advertise <b>fax.your.domain</b> in the DNS :-)
3081 <hr>
3083 <a name="deleting"><h3>Deleting a message from the Postfix queue</h3></a>
3085 The <b>postsuper</b> command
3086 has an option to delete Postfix message queue files. To delete
3087 the message with queue id ABCDEF, perhaps obtained from <b>mailq</b>
3088 output, one would use:
3092 <blockquote>
3093 <pre>
3094 # postsuper -d ABCDEF
3095 </pre>
3096 </blockquote>
3100 To delete a large number of files one would use:
3104 <blockquote>
3105 <pre>
3106 # postsuper -d - < <i>filename-with-queue-ids</i>
3107 </pre>
3108 </blockquote>
3112 It is usually safe to do this while the Postfix system is running.
3113 However, there is a small chance of deleting the wrong queue
3114 file. The scenario goes like this:
3118 <ul>
3120 <li>The Postfix queue manager deletes the file that <b>postsuper</b>
3121 was supposed to delete, because Postfix was finished with the
3122 message.
3126 <li>New mail arrives, and the new message is given the same queue
3127 ID as the message that <b>postsuper</b> was supposed to delete.
3128 The probability for reusing a deleted queue ID is about 1 in
3129 2<sup>15</sup> (the number of different microsecond values that
3130 the system clock can distinguish).
3134 <li><b>postsuper</b> deletes the new message file, instead of the
3135 old file that should have been deleted.
3137 </ul>
3139 <hr>
3141 <a name="copying"><h3>Moving or restoring the Postfix queue</h3></a>
3143 It is not safe to simply copy Postfix queue files from one file
3144 system (or backup) to another file system. The reason for this is
3145 that queue file names must be unique across the Postfix <b>incoming</b>,
3146 <b>active</b> and <b>deferred</b> queue directories. If two queue
3147 files have the same file (base) name, then one of the queue files
3148 may be lost as files are moved from queue directory to queue
3149 directory.
3153 Postfix names a queue file after its inode number and after the
3154 microsecond part of the time of day. Thus, if a queue file has a
3155 name based on someone elses inode number there is a small chance
3156 that the file name will collide with another queue file.
3160 The text below describes two different procedures to restore
3161 queue files from another machine or from backup.
3163 <h4> Procedure 1: Your Postfix queue is empty, and you run Postfix
3164 release 20010525 or later</h4>
3166 <ul>
3168 <li> Stop Postfix, if it was running.
3170 <blockquote>
3171 <pre>
3172 # postfix stop
3173 </pre>
3174 </blockquote>
3178 <li> Execute the <b>mailq</b> command. If there is any output, do
3179 not complete this procedure, but use <b>procedure 2</b> instead.
3181 <blockquote>
3182 <pre>
3183 # mailq
3184 </pre>
3185 </blockquote>
3189 <li> Copy or restore the queue to the usual place.
3191 <blockquote>
3192 <pre>
3193 # cd /var/spool/postfix
3194 <i>...restore maildrop, incoming, active, deferred, defer, bounce here...</i>
3195 </pre>
3196 </blockquote>
3200 <li> Run the <b>postsuper</b> command. This command will rename
3201 queue files so that the file names match their message file inode
3202 numbers.
3204 <blockquote>
3205 <pre>
3206 # postsuper
3207 </pre>
3208 </blockquote>
3210 </ul>
3212 <h4> Procedure 2: Your Postfix queue is not empty, or you are
3213 running a Postfix release prior to 20010525</h4>
3215 <ul>
3217 <li>Stop Postfix, if it was running.
3219 <blockquote>
3220 <pre>
3221 # postfix stop
3222 </pre>
3223 </blockquote>
3227 <li> To avoid queue file name collisions when restoring queue files,
3228 copy or restore the incoming, active and deferred queue files under
3229 the maildrop directory instead.
3231 <blockquote>
3232 <pre>
3233 # cd /var/spool/postfix/maildrop
3234 <i>...restore incoming, active, deferred here...</i>
3235 </pre>
3236 </blockquote>
3240 <li>While the next step is going on, don't submit new mail locally,
3241 because that could collide with the files you are restoring under
3242 the maildrop directory.
3246 <li>As of late 2000, Postfix queues are all hashed (for example, file
3247 ABCDEF is stored as A/B/ABCDEF), so you need an additional step to
3248 move files down from their subdirectories.
3251 <pre>
3252 # find incoming active deferred -type f -exec mv '{}' . ';'
3253 # rm -rf incoming active deferred
3254 # postfix start
3255 </pre>
3259 <li>When Postfix is started, it will pick up queue files from the
3260 maildrop directory and will give them proper queue file names.
3262 </ul>
3264 <hr>
3266 <a name="bind"><h3>Undefined symbols: ___dn_expand, ___res_init etc.</h3></a>
3268 Question: When I build Postfix I get the following errors:
3272 <pre>
3273 ld: Undefined symbol
3274 ___dn_expand
3275 ___res_init
3276 ___res_search
3277 *** Error code 1
3278 </pre>
3282 Answer: you're mixing BIND version 8 include files with a
3283 different version of the resolver library.
3287 Fix: use the right include files. For example:
3291 <pre>
3292 <tt>make makefiles CCARGS="-I/usr/include"</tt>.
3293 </pre>
3295 <hr>
3297 <a name="dbm_dirfno"><h3>Undefined symbols: dbm_pagfno, dbm_dirfno etc.</h3></a>
3299 Question: When I build Postfix I get the following errors:
3303 <pre>
3304 Undefined first referenced
3305 symbol in file
3306 dbm_pagfno ../lib/libutil.a(dict_dbm.o)
3307 dbm_dirfno ../lib/libutil.a(dict_dbm.o)
3308 </pre>
3312 Answer: instead of using <b>/usr/include/ndbm.h</b>, you're building
3313 Postfix with some incompatible third-party file, typically
3314 <b>/usr/local/include/ndbm.h</b>.
3318 Fix: get rid of the third-party ndbm.h include file.
3320 <hr>
3322 <a name="db"><h3>Using third-party DB libraries</h3> </a>
3324 The old <b>dbm</b> UNIX database has severe limitations when you
3325 try to store lots of information. It breaks when the number of hash
3326 collisions becomes so large that the entries no longer fit together
3327 in a single disk block. The more modern <b>db</b> database does
3328 not suffer these limitations. It is standard on 4.4BSD and Linux
3329 systems.
3333 In order to build Postfix with <b>db</b> support on UNIX systems
3334 that do not have <b>db</b> support out of the box, you can use the
3335 Berkeley DB source code from <a
3336 href="http://www.sleepycat.com">www.sleepycat.com</a>. See the file
3337 <b>DB_README</b> in the Postfix source code distribution for
3338 instructions on how to build Postfix with Sleepycat's Berkeley DB.
3340 <hr>
3342 <a name="sgistruct">
3344 <h3>IRIX problems translating IP address to string</h3>
3346 <dl>
3348 <dt>Question: <dd> While installing IRIX 6.5.7m on a clean disk
3349 and no special options or software I stumbled upon the following
3350 problem; the inet_ntoa() function seems to return INADDR_NONE
3351 (malformed request?) for every call to it.
3355 <dt>Answer: <dd>There is an incompatibility between gcc and system
3356 libraries compiled with SGI's cc. See a description in <a
3357 href="http://freeware.sgi.com/shared/howto.html">
3358 http://freeware.sgi.com/shared/howto.html</a>.
3360 <p>If you must use gcc, a possible workaround is to use the
3361 inet_ntoa() routine from the BIND source code at <a
3362 href="http://www.isc.org/"> http://www.isc.org/</a>.
3364 </dl>
3366 <hr>
3368 <a name="compaq-chmod"><h3>Compaq mail blackhole problem</h3>
3370 On some Compaq Tru64 UNIX configurations, Postfix will receive mail
3371 and then nothing happens. The mail does not even show up with the
3372 <b>mailq</b> command.
3376 Postfix sets the execute bit on a queue file to indicate that it
3377 is done receiving a message. As long as a queue file does not have
3378 the execute bit set, Postfix will ignore it as "mail still being
3379 received".
3383 With enhanced security enabled, Compaq Tru64 UNIX has a feature
3384 that disallows non-superuser attempts to set the execute bit on a
3385 queuefile. Unfortunately, Postfix is never informed that such
3386 attempts fail, and mail seems to disappear into a black hole.
3390 Postfix could be modified to use some other bit than the execute
3391 bit, but that might equally well fail on other systems. Another
3392 possibility is to allow non-superusers to set the execute bit on
3393 files, and to mount the Postfix queue file system with the
3394 <b>noexec</b> option or equivalent.
3396 <hr>
3398 <a name="msql_limit"><h3>Too many connections</h3></a>
3400 This message is produced by the MYSQL server. You need to increase
3401 the number of connections that it can handle. Things to bear in
3402 mind: the <b>virtual</b> and <b>canonical</b> maps are accessed by
3403 every <b>smtpd</b> and <b>cleanup</b> process.
3405 <hr>
3407 <a name="reiser_bugs"><h3>write queue file: No such file or directory</h3></a>
3409 <h3>write queue file: Unknown error 4294967289</h3>
3411 Reiserfs reports the wrong error code when a message exceeds the
3412 <b>message_size_limit</b> setting. As a result, the Postfix SMTP
3413 server reports a "queue file write error" to the SMTP client, rather
3414 than reporting a "file too large" condition. The client will keep
3415 sending the same email again and again until the mail is too old.
3417 <hr>
3419 <a href="docs.html">Up one level</a> | Postfix FAQ
3421 </body>
3423 </html>