Difference between revisions of "Postfix"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(subpages: internal apps, user apps)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
<hide>
 +
[[page type::article]]
 +
[[thing type::software]]
 +
[[software type::mail transfer agent]]
 +
[[architecture::server]]
 +
[[license::open source]]
 +
[[category:software]]
 +
</hide>
 
==About==
 
==About==
[[category:software]][[Postfix]] is an [[open-source]] [[mail transfer agent]] (MTA) for [[POSIX]] systems. It is fully supported by [[Webmin]] and is part of the [[Dovecot]] stack.
+
[[Postfix]] is an [[open source]] [[mail transfer agent]] (MTA) for [[POSIX]] systems. It is fully supported by [[Webmin]]/[[VirtualMin]] and is part of the [[Dovecot]] stack.
 +
===Pages===
 +
* [[/aliasing]]: managing email redirects/aliases
 +
* [[/fixing]]: diagnosis of installations that aren't working right
 +
* see also: [[DKIM]], [[DMARC]], [[Sender Policy Framework]] (SPF)
 +
* [[/chroot]]: running Postfix in a [[chroot]]ed environment
 +
 
 
===Files===
 
===Files===
 
* [[/main.cf]]
 
* [[/main.cf]]
 
* [[/master.cf]]: formatted list of transport helper applications
 
* [[/master.cf]]: formatted list of transport helper applications
 +
* [[/mail.log]] (typically found in /var/log)
 
===Internal Apps===
 
===Internal Apps===
 
* [[/aliases]] ([http://www.postfix.org/aliases.5.html reference])
 
* [[/aliases]] ([http://www.postfix.org/aliases.5.html reference])
Line 12: Line 27:
 
* [[/qmgr]] ([http://postfix.org/qmgr.8.html reference])
 
* [[/qmgr]] ([http://postfix.org/qmgr.8.html reference])
 
* [[/smtpd]] ([http://postfix.org/smtpd.8.html reference])
 
* [[/smtpd]] ([http://postfix.org/smtpd.8.html reference])
* [[/transport]] (http://www.postfix.org/transport.5.html reference])
+
* [[/transport]] ([http://www.postfix.org/transport.5.html reference])
 
* [[/trivial-rewrite]] ([http://postfix.org/trivial-rewrite.8.html reference]))
 
* [[/trivial-rewrite]] ([http://postfix.org/trivial-rewrite.8.html reference]))
 
===User Applets===
 
===User Applets===
 
* [[/newaliases]]
 
* [[/newaliases]]
 +
===Other Applets===
 +
These are installed as part of the postfix package; not sure how they should be classified:
 +
{|
 +
|-
 +
| valign=top |
 +
* '''/usr/bin''':
 +
** [[/mailq]]
 +
** [[/newaliases]] - user utility
 +
** [[/rmail]]
 +
* '''/usr/lib''':
 +
** [[/postfix_groups.pl]]
 +
** [[/sendmail]]
 +
| valign=top |
 +
* '''/usr/lib/postfix''':
 +
** [[/anvil]]
 +
** [[/bounce]]
 +
** [[/cleanup]]
 +
** [[/discard]]
 +
** [[/error]]
 +
** [[/flush]]
 +
** [[/fsstone]]
 +
** [[/lmtp]]
 +
** [[/local]]
 +
** [[/master]]
 +
** [[/oqmgr]]
 +
** [[/pickup]]
 +
** [[/pipe]]
 +
** [[/post-install]]
 +
** [[/postfix-files]]
 +
** [[/postfix-script]]
 +
** [[/postfix-wrapper]]
 +
** [[/postmulti-script]]
 +
** [[/proxymap]]
 +
** [[/qmgr]]
 +
** [[/qmqpd]]
 +
** [[/scache]]
 +
** [[/showq]]
 +
** [[/smtp]]
 +
** [[/smtpd]]
 +
** [[/spawn]]
 +
** [[/tlsmgr]]
 +
** [[/trivial-rewrite]]
 +
** [[/verify]]
 +
** [[/virtual]]
 +
| valign=top |
 +
* '''/usr/sbin''':
 +
** [[/postalias]]
 +
** [[/postcat]]
 +
** [[/postconf]]
 +
** [[/postdrop]]
 +
** [[/postfix]] - core binary
 +
** [[/postfix-add-filter]]
 +
** [[/postfix-add-policy]]
 +
** [[/postkick]]
 +
** [[/postlock]]
 +
** [[/postlog]]
 +
** [[/postmap]]
 +
** [[/postmulti]]
 +
** [[/postqueue]]
 +
** [[/postsuper]]
 +
** [[/qmqp-sink]]
 +
** [[/qmqp-source]]
 +
** [[/qshape]]
 +
** [[/rmail]]
 +
** [[/sendmail]]
 +
** [[/smtp-sink]]
 +
** [[/smtp-source]]
 +
|}
 +
 
===Error Messages===
 
===Error Messages===
 +
* [[503 5.5.1 Error: authentication not enabled]]
 
* [[Connect to private/dovecot-auth failed: No such file or directory]]
 
* [[Connect to private/dovecot-auth failed: No such file or directory]]
 +
 +
===Other Subpages===
 +
* [[/flow]]: the flow of messages across the various helper programs that make up Postfix
 +
* [[/SSL]]: Postfix and SSL
  
 
==Notes==
 
==Notes==
 
After making changes to the Postfix configuration files, you don't actually have to stop and restart Postfix to load the changes; you can just type (as root) "postfix reload".
 
After making changes to the Postfix configuration files, you don't actually have to stop and restart Postfix to load the changes; you can just type (as root) "postfix reload".
===flow===
 
There are multiple stages inside Postfix, and each stage can be affected by configuration parameters. I have not yet found a clear documentation of the data flow, but it seems to go like this (only much more complicated) under normal circumstances:
 
 
: [[SMTP]] &rarr; Postfix delivery queue &rarr; user alias mappings &rarr; [[mail delivery agent|local delivery]] (MDA, e.g. [[Dovecot]])
 
 
However, when using virtual (non-system) users, internally-generated emails (e.g. mail from [[cron]] or [[PHP]]'s mail() function) seem to bypass the alias mappings, which the MDA then rejects if they are addressed to an alias instead of a user.
 
 
A table from the official documentation is more detailed, if perhaps less clear (where does the message ''end up''? qmgr? how does it get delivered?):
 
<table align=center>
 
<tr>
 
<td colspan="2"> </td>
 
<td align="center" bgcolor="#f0f0ff"> [http://postfix.org/trivial-rewrite.8.html trivial-<br>rewrite(8)]<br>(std
 
form) </td>
 
<td colspan="5"> </td>
 
<td align="center" bgcolor="#f0f0ff"> [http://postfix.org/trivial-rewrite.8.html trivial-<br>rewrite(8)]<br>(resolve)
 
</td>
 
</tr>
 
<tr>
 
<td colspan="2"> </td>
 
<td align="center"><table><tr><td align="center"> ^<br> <tt> |
 
</tt> </td><td align="center"> <tt> |<br>v </tt> </td></tr></table>
 
</td><td colspan="5"> </td>
 
<td align="center"><table><tr><td align="center"> ^<br> <tt> |
 
</tt> </td><td align="center"> <tt> |<br>v </tt> </td></tr></table>
 
</td><td colspan="2"> </td>
 
</tr>
 
<tr>
 
<td valign="middle" align="center" bgcolor="#f0f0ff"> [http://postfix.org/smtpd.8.html smtpd(8)]
 
</td>
 
<td rowspan="3" valign="middle" align="center"> <tt> &gt;- </tt>
 
</td>
 
<td rowspan="3" align="center" bgcolor="#f0f0ff"> [http://postfix.org/cleanup.8.html cleanup(8)] </td>
 
<td rowspan="3" valign="middle" align="center"> <tt> -&gt; </tt>
 
</td>
 
<td rowspan="3" align="center" bgcolor="#f0f0ff"> [http://postfix.org/QSHAPE_README.html#incoming_queue incoming] </td>
 
<td rowspan="3" valign="middle" align="center"> <tt> -&gt; </tt>
 
</td>
 
<td rowspan="3" align="center" bgcolor="#f0f0ff"> [http://postfix.org/QSHAPE_README.html#active_queue active] </td>
 
<td rowspan="3" valign="middle" align="center"> <tt> -&gt; </tt>
 
</td>
 
<td rowspan="3" align="center" bgcolor="#f0f0ff"> [http://postfix.org/qmgr.8.html qmgr(8)]</td>
 
<td rowspan="3" valign="middle" align="center"> <tt> -&lt; </tt>
 
</td>
 
<td valign="middle" align="center" bgcolor="#f0f0ff">
 
[http://postfix.org/smtp.8.html smtp(8)]</td>
 
</tr>
 
<tr>
 
<td valign="middle" align="center" bgcolor="#f0f0ff">
 
[http://postfix.org/qmqpd.8.html qmqpd(8)]</td>
 
<td valign="middle" align="center" bgcolor="#f0f0ff"> [http://postfix.org/lmtp.8.html lmtp(8)]</td>
 
</tr>
 
<tr>
 
<td valign="middle" align="center" bgcolor="#f0f0ff"> [http://postfix.org/pickup.8.html pickup(8)]
 
</td>
 
<td valign="middle" align="center" bgcolor="#f0f0ff"> [http://postfix.org/local.8.html local(8)]
 
</td>
 
</tr>
 
<tr>
 
<td colspan="2"> </td>
 
<td align="center"> ^<br> <tt> | </tt> </td>
 
<td colspan="3"> </td>
 
<td align="center"><table><tr><td align="center"> ^<br> <tt> |
 
</tt> </td><td align="center"> <tt> |<br>v </tt> </td></tr></table>
 
</td><td colspan="4"> </td>
 
</tr>
 
<tr>
 
<td colspan="2"> </td>
 
<td align="center"> bounces<br> forwarding<br> notices</td>
 
<td colspan="3"> </td>
 
<td align="center" bgcolor="#f0f0ff"> [http://postfix.org/QSHAPE_README.html#deferred_queue deferred]
 
</td><td colspan="2"> </td>
 
</tr>
 
</table>
 
There are two more diagrams [http://www.postfix.org/OVERVIEW.html here]; the first shows the input stage in a bit more detail, and the second shows the delivery stage. There are two more diagrams [http://www.postfix.org/FILTER_README.html here], showing where filtering takes place.
 
 
===aliases===
 
To set up aliases, either edit the file specified by the [[/main.cf/alias_maps|alias_maps]] setting in [[/main.cf|main.cf]] ([[etc/aliases|/etc/aliases]] by default) and then run [[newaliases]] (or "postalias /etc/aliases") to update the database, or else use [[Webmin]] ("Mail Aliases" icon, then click on the "Create a new alias" link).
 
 
'''Notes''':
 
* Webmin seems to automatically run newaliases when you add or modify an individual alias, but ''not'' when you use it to edit the [[etc/aliases|/etc/aliases]] file directly. Changes made to /etc/aliases will not take effect until the database is updated.
 
* Stopping and starting the postfix daemon does ''not'' update from the aliases file; you still have to run newaliases.
 
* see [http://www.postfix.org/aliases.5.html aliases] for more information.
 
===virtual users===
 
By default, virtual aliases seem to get looked up only when email comes from the outside; locally generated emails are "returned" as undeliverable with the error message "Diagnostic-Code: x-unix; user unknown"
 
 
The following change in main.cf solves that problem &ndash;
 
* '''change''': {{link/subpage|pfx=/main.cf/|receive_override_options}} = no_address_mappings
 
* '''to this''': receive_override_options =
 
&ndash; but creates a new one, in that externally-sourced messages are now delivered ''twice'' (or ''four'' times if addressed directly to a virtual user instead of a virtual alias).
 
 
Someone who understands the internal structure of postfix could probably figure out what this means (and how to fix it), but I'm still working on it.
 
  
===catch-all===
 
To set up a catch-all address, edit {{link/subpage|main.cf}} and set the following parameters:
 
* {{link/subpage|pfx=/main.cf/|local_recipient_maps}} =
 
* {{link/subpage|pfx=/main.cf/|luser_relay}} = <u>whereToSend</u>
 
 
The syntax for <u>whereToSend</u> is explained [http://www.postfix.org/postconf.5.html#luser_relay here].
 
 
Examples:
 
* luser_relay = $user@anotherdomain.org
 
** forwards all email addressed to "invaliduser@firstdomain.org" to "invaliduser@anotherdomain.org"
 
* luser_relay = youraddress@anotherdomain.org
 
** forwards all email addressed to invalid users to "youraddress@anotherdomain.org".
 
 
===automatic BCC===
 
===automatic BCC===
 
To automatically [[blind carbon copy|BCC]] outgoing mail ''from'' any given set of users, set [[/main.cf/sender_bcc_maps|sender_bcc_maps]] in [[/main.cf]] to <u>hash:/etc/postfix/sender_bcc</u>. (In [[Webmin]]: BCC Mapping: Sender BCC mapping lookup tables)
 
To automatically [[blind carbon copy|BCC]] outgoing mail ''from'' any given set of users, set [[/main.cf/sender_bcc_maps|sender_bcc_maps]] in [[/main.cf]] to <u>hash:/etc/postfix/sender_bcc</u>. (In [[Webmin]]: BCC Mapping: Sender BCC mapping lookup tables)
Line 133: Line 119:
 
  @vbz.com archive{{CURRENTYEAR}}@vbz.com
 
  @vbz.com archive{{CURRENTYEAR}}@vbz.com
 
===pages to index===
 
===pages to index===
I have these open in tabs, so they are probably relevant to something:
+
Possibly useful pages:
 +
* [https://www.howtoforge.com/postfix_backup_mx Setting Up Postfix As A Backup MX]
 
* [http://www.postfix.org/ADDRESS_REWRITING_README.html Postfix Address Rewriting]
 
* [http://www.postfix.org/ADDRESS_REWRITING_README.html Postfix Address Rewriting]
 
* [http://www.postfix.org/trivial-rewrite.8.html trivial-rewrite] (manpage)
 
* [http://www.postfix.org/trivial-rewrite.8.html trivial-rewrite] (manpage)
 
* [http://www.postfix.org/postconf.5.html Postfix Configuration Parameters] (includes [[/main.cf]] parameters)
 
* [http://www.postfix.org/postconf.5.html Postfix Configuration Parameters] (includes [[/main.cf]] parameters)
 +
* [http://www.postfix.org/FILTER_README.html Postfix After-Queue Content Filter]
 +
* [http://www.group-office.com/wiki/Mailserver Group-Office Mailserver] plugin: helps administer Postfix
 +
* [http://en.gentoo-wiki.com/wiki/Mail_server_using_Postfix_and_Dovecot Mail server using Postfix and Dovecot] on [[Gentoo Linux]]
 +
 
==Links==
 
==Links==
 
===Official===
 
===Official===
 
* [http://www.postfix.org/ home page]
 
* [http://www.postfix.org/ home page]
 +
* {{link/manpage/only|Postfix|manpage}}
 +
 
===Reference===
 
===Reference===
 
* {{wikipedia|Postfix (software)}}
 
* {{wikipedia|Postfix (software)}}
* [http://postfix.wiki.xs4all.nl/ wiki]
 
** [http://postfix.wiki.xs4all.nl/index.php?title=Relay_recipient_maps_using_LDAP_against_Active_Directory Relay recipient maps using LDAP against Active Directory]
 

Latest revision as of 16:00, 17 September 2021

About

Postfix is an open source mail transfer agent (MTA) for POSIX systems. It is fully supported by Webmin/VirtualMin and is part of the Dovecot stack.

Pages

Files

Internal Apps

User Applets

Other Applets

These are installed as part of the postfix package; not sure how they should be classified:

Error Messages

Other Subpages

  • /flow: the flow of messages across the various helper programs that make up Postfix
  • /SSL: Postfix and SSL

Notes

After making changes to the Postfix configuration files, you don't actually have to stop and restart Postfix to load the changes; you can just type (as root) "postfix reload".

automatic BCC

To automatically BCC outgoing mail from any given set of users, set sender_bcc_maps in /main.cf to hash:/etc/postfix/sender_bcc. (In Webmin: BCC Mapping: Sender BCC mapping lookup tables)

Each line in the /sender_bcc file will contain the sender (which can be user@domain, user, or @domain), one or more blanks, then the recipient (which can be one address or multiple addresses separated by commas).

Example -- BCCs all mail sent by vbz.com users to an archive address:

@vbz.com archive2024@vbz.com

pages to index

Possibly useful pages:

Links

Official

Reference