Difference between revisions of "Postfix mailer configuration"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
(New page: <nowiki>Postfix mailer configuration</nowiki> <nowiki>__ _</nowiki> <nowiki> -o)/ / (_)__ __ ____ __ Derek Winterstien</nowiki> <nowiki> /\\ /__/ / _ \/ // /\ \/ / r.o...)
 
m
 
(One intermediate revision by one user not shown)
Line 6: Line 6:
 
  <nowiki>..............................................................................</nowiki>
 
  <nowiki>..............................................................................</nowiki>
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
<nowiki></nowiki>
+
Postfix should be configured to start up on boot
<nowiki>Postfix should be configured to start up on boot</nowiki>
+
 
<nowiki></nowiki>
+
  chkconfig Postfix on
<nowiki>  chkconfig Postfix on</nowiki>
+
 
<nowiki></nowiki>
+
Make some configuration changes in postfix
<nowiki>Make some configuration changes in postfix</nowiki>
+
 
<nowiki></nowiki>
+
  vi /etc/postfix/main.cf
<nowiki>  vi /etc/postfix/main.cf</nowiki>
+
 
<nowiki></nowiki>
+
Add / Modify the following
<nowiki>Add / Modify the following</nowiki>
+
 
<nowiki></nowiki>
+
  inet_interfaces = all
  <nowiki>inet_interfaces = all</nowiki>
+
  mydestination = $myhostname, localhost.$mydomain, $mydomain
  <nowiki>mydestination = $myhostname, localhost.$mydomain, $mydomain</nowiki>
+
  myorigin = $mydomain
  <nowiki>myorigin = $mydomain</nowiki>
+
 
<nowiki></nowiki>
+
Logs: (var/log/mail)
<nowiki>Logs: (var/log/mail)</nowiki>
+
  debug
<nowiki>  debug</nowiki>
+
  errors
<nowiki>  errors</nowiki>
+
  info - mail delivery attempts
<nowiki>  info - mail delivery attempts</nowiki>
+
  notice
<nowiki>  notice</nowiki>
+
  warnings - such as hostname verification
<nowiki>  warnings - such as hostname verification</nowiki>
+
 
<nowiki></nowiki>
+
=== Hosting Domains ===
<nowiki>Hosting Domains</nowiki>
+
----------
<nowiki>----------</nowiki>
+
 
<nowiki></nowiki>
+
#. canonical hostname and/or domain of machine
<nowiki>1. canonical                   hostname and/or domain of machine</nowiki>
+
#. virtual alias domain virtual domain uses unix passwd system accounts
<nowiki>2. virtual alias domain               virtual domain uses unix passwd system</nowiki>
+
#. virtual mailbox domain virtual domain and independent accounts
<nowiki>accounts</nowiki>
+
 
<nowiki>3. virtual mailbox domain     virtual domain and independent accounts</nowiki>
+
=== Configuration: mailbox format ===
<nowiki></nowiki>
+
----------
<nowiki>Configuration: mailbox format</nowiki>
+
 
<nowiki>----------</nowiki>
+
Choose a mailbox format.  This guide will cover mbox as opposed to MailDir.
<nowiki></nowiki>
+
 
<nowiki>Choose a mailbox format.  This guide will cover mbox as opposed to MailDir.</nowiki>
+
<nowiki></nowiki>
+
 
  <nowiki>#!!  home_mailbox = Mailbox <- delete or remark out this line.  Do not specify</nowiki>
 
  <nowiki>#!!  home_mailbox = Mailbox <- delete or remark out this line.  Do not specify</nowiki>
 
  <nowiki>    the home_mailbox parameter for mbox style delivery.</nowiki>
 
  <nowiki>    the home_mailbox parameter for mbox style delivery.</nowiki>
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
 
  <nowiki>  mail_spool_directory = /var/spool/mail</nowiki>
 
  <nowiki>  mail_spool_directory = /var/spool/mail</nowiki>
<nowiki></nowiki>
+
 
<nowiki>Configuration: main.cf</nowiki>
+
=== Configuration: main.cf ===
<nowiki>----------</nowiki>
+
----------
<nowiki></nowiki>
+
 
<nowiki>Edit main.cf</nowiki>
+
Edit main.cf
<nowiki></nowiki>
+
 
 
  <nowiki>  myorigin</nowiki>
 
  <nowiki>  myorigin</nowiki>
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
Line 58: Line 56:
 
  <nowiki></nowiki>
 
  <nowiki></nowiki>
 
  <nowiki>  mynetworks          you can specify a plain text file to contain valid</nowiki>
 
  <nowiki>  mynetworks          you can specify a plain text file to contain valid</nowiki>
<nowiki>relays (ex a10)</nowiki>
+
 
<nowiki></nowiki>
+
=== Example a10:  mynetworks ===
<nowiki>  virtual_alias_domains        you can specify a plain text file containing hosted</nowiki>
+
----------
<nowiki>virtual domains</nowiki>
+
You can list the relays in the main.cf file:
<nowiki></nowiki>
+
  mynetworks = 168.100.189.0/28, 127.0.0.0/8
<nowiki>  virtual_alias_maps  equiv to virtusertable in sendmail, cannot be plain</nowiki>
+
Or refer to a hash file:
<nowiki>text file (ex a20)</nowiki>
+
  mynetworks = hash:/etc/postfix/relay_table
<nowiki></nowiki>
+
Or a flat text file:
<nowiki>Example a10:  mynetworks</nowiki>
+
  mynetworks = /etc/postfix/relay_table
<nowiki>----------</nowiki>
+
In the flat text file, # comments a line, an IP specifies a single host
<nowiki>You can list the relays in the main.cf file:</nowiki>
+
allowed relay.  The sendmail format of a partial IP, X.X.X does NOT work.  To
<nowiki>  mynetworks = 168.100.189.0/28, 127.0.0.0/8</nowiki>
+
specify a network use network metrics X.X.X.X/24
<nowiki>Or refer to a hash file:</nowiki>
+
 
<nowiki>  mynetworks = hash:/etc/postfix/relay_table</nowiki>
+
=== Example a20: virtual_alias_maps ===
<nowiki>Or a flat text file:</nowiki>
+
----------
<nowiki>  mynetworks = /etc/postfix/relay_table</nowiki>
+
You can specify a hash table file for virtual_alias_maps, which is simular to
<nowiki>In the flat text file, # comments a line, an IP specifies a single host</nowiki>
+
sendmail's 'virtusertable' file with one important difference: postfix virtual
<nowiki>allowed relay.  The sendmail format of a partial IP, X.X.X does NOT work.  To</nowiki>
+
domains do not automatically map to unix system accounts.
<nowiki>specify a network use network metrics X.X.X.X/24</nowiki>
+
 
<nowiki></nowiki>
+
*Specify in main.cf:
<nowiki>Example a20: virtual_alias_maps</nowiki>
+
  virtual_alias_maps = hash:/etc/postfix/virtusers
<nowiki>----------</nowiki>
+
*Format:
<nowiki>You can specify a hash table file for virtual_alias_maps, which is simular to</nowiki>
+
  username@virtualdomain.com unixmailbox
<nowiki>sendmail's 'virtusertable' file with one important difference: postfix virtual</nowiki>
+
*Hash it:
<nowiki>domains do not automatically map to unix system accounts.</nowiki>
+
  postmap virtusers
<nowiki>  Specify in main.cf:</nowiki>
+
*Explained:
<nowiki>virtual_alias_maps = hash:/etc/postfix/virtusers</nowiki>
+
:The addess username@virtualdomain.com will be directed to the unix system
<nowiki>  Format:</nowiki>
+
mailbox named unixmailbox.  
<nowiki>username@virtualdomain.com     unixmailbox</nowiki>
+
 
<nowiki>  Hash it:</nowiki>
+
=== Postfix Lookup Table Types:  type:name ===
<nowiki>postmap virtusers</nowiki>
+
----------
<nowiki>  Explained:</nowiki>
+
Not all of them, but on Linux here are a few important ones...
<nowiki>The addess username@virtualdomain.com will be directed to the unix system</nowiki>
+
 
<nowiki>mailbox named unixmailbox. </nowiki>
+
<nowiki></nowiki>
+
<nowiki>Postfix Lookup Table Types:  type:name</nowiki>
+
<nowiki>----------</nowiki>
+
<nowiki>Not all of them, but on Linux here are a few important ones...</nowiki>
+
<nowiki></nowiki>
+
 
  <nowiki>regexp regular expressions lookup table</nowiki>
 
  <nowiki>regexp regular expressions lookup table</nowiki>
 
  <nowiki>hash  standard hash index file</nowiki>
 
  <nowiki>hash  standard hash index file</nowiki>
 
  <nowiki>sdbm  sdbm supported hash index file</nowiki>
 
  <nowiki>sdbm  sdbm supported hash index file</nowiki>
 
  <nowiki>pcre  perl style regular expressions table</nowiki>
 
  <nowiki>pcre  perl style regular expressions table</nowiki>
<nowiki></nowiki>
+
 
<nowiki>Virtual Mailbox Domains and Non-UNIX Accounts</nowiki>
+
=== Virtual Mailbox Domains and Non-UNIX Accounts ===
<nowiki>----------</nowiki>
+
----------
<nowiki>You must use a pop or imap server that is compatible with every recipient</nowiki>
+
You must use a pop or imap server that is compatible with every recipient
<nowiki>address having its own virtual mailbox. For example, popa3d is a great pop</nowiki>
+
address having its own virtual mailbox. For example, popa3d is a great pop
<nowiki>server known for simplicity and security, but it will not recognize your</nowiki>
+
server known for simplicity and security, but it will not recognize your
<nowiki>virtual, non system mailboxes. </nowiki>
+
virtual, non system mailboxes.  
<nowiki></nowiki>
+
 
<nowiki>Graylisting and spamd</nowiki>
+
=== Graylisting and spamd ===
<nowiki>-----------</nowiki>
+
-----------
<nowiki></nowiki>
+
 
<nowiki>http://www.elwood.net/greyspamd.html</nowiki>
+
*http://www.elwood.net/greyspamd.html
<nowiki>http://www.greylisting.org/implementations/postfix.shtml</nowiki>
+
*http://www.greylisting.org/implementations/postfix.shtml
<nowiki></nowiki>
+
 
<nowiki></nowiki>
+
== Visit these updated and related pages ==
 +
 
 +
* [[Dovecot and Postfix Hybrid Authentication Example]]
 +
* [[Understand Postfix Account Types]]
  
 
[[Category:Computer_Technology]]
 
[[Category:Computer_Technology]]
 
[[Category:Linux]]
 
[[Category:Linux]]

Latest revision as of 20:35, 13 February 2014

Postfix mailer configuration
__   _
  -o)/ /  (_)__  __ ____  __      Derek Winterstien
  /\\ /__/ / _ \/ // /\ \/ /      r.o.a.c.h.@.r.o.b.o.t.z...c.o.m
 _\_v __/_/_//_/\_,_/ /_/\_\      Trustix Secure Linux
..............................................................................

Postfix should be configured to start up on boot

  chkconfig Postfix on

Make some configuration changes in postfix

  vi /etc/postfix/main.cf

Add / Modify the following

inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
myorigin = $mydomain

Logs: (var/log/mail)

 debug
 errors
 info - mail delivery attempts
 notice
 warnings - such as hostname verification

Hosting Domains


  1. . canonical hostname and/or domain of machine
  2. . virtual alias domain virtual domain uses unix passwd system accounts
  3. . virtual mailbox domain virtual domain and independent accounts

Configuration: mailbox format


Choose a mailbox format. This guide will cover mbox as opposed to MailDir.

#!!  home_mailbox = Mailbox <- delete or remark out this line.  Do not specify
     the home_mailbox parameter for mbox style delivery.

  mail_spool_directory = /var/spool/mail

Configuration: main.cf


Edit main.cf

  myorigin

  mydestination

  mynetworks_style     ignord if mynetworks list specified

  mynetworks           you can specify a plain text file to contain valid

Example a10: mynetworks


You can list the relays in the main.cf file:

 mynetworks = 168.100.189.0/28, 127.0.0.0/8

Or refer to a hash file:

 mynetworks = hash:/etc/postfix/relay_table

Or a flat text file:

 mynetworks = /etc/postfix/relay_table

In the flat text file, # comments a line, an IP specifies a single host allowed relay. The sendmail format of a partial IP, X.X.X does NOT work. To specify a network use network metrics X.X.X.X/24

Example a20: virtual_alias_maps


You can specify a hash table file for virtual_alias_maps, which is simular to sendmail's 'virtusertable' file with one important difference: postfix virtual domains do not automatically map to unix system accounts.

  • Specify in main.cf:
 virtual_alias_maps = hash:/etc/postfix/virtusers
  • Format:
 username@virtualdomain.com	unixmailbox
  • Hash it:
 postmap virtusers
  • Explained:
The addess username@virtualdomain.com will be directed to the unix system

mailbox named unixmailbox.

Postfix Lookup Table Types: type:name


Not all of them, but on Linux here are a few important ones...

regexp regular expressions lookup table
hash   standard hash index file
sdbm   sdbm supported hash index file
pcre   perl style regular expressions table

Virtual Mailbox Domains and Non-UNIX Accounts


You must use a pop or imap server that is compatible with every recipient address having its own virtual mailbox. For example, popa3d is a great pop server known for simplicity and security, but it will not recognize your virtual, non system mailboxes.

Graylisting and spamd


Visit these updated and related pages