Difference between revisions of "Postfix"

From Freephile Wiki
Jump to navigation Jump to search
(might need the CA file)
(Created page with "Notes on using Postfix <ref>loosely following the info at http://braiden.org/?p=15</ref>. Quick and dirty procedure for setting up Postfix on a new machine that needs email....")
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Internet-mail.svg|right|thumb|300px|link=http://www.postfix.org|visit www.postfix.org]]
 
 
 
Notes on using Postfix <ref>loosely following the info at http://braiden.org/?p=15</ref>.  Quick and dirty procedure for setting up Postfix on a new machine that needs email.  
 
Notes on using Postfix <ref>loosely following the info at http://braiden.org/?p=15</ref>.  Quick and dirty procedure for setting up Postfix on a new machine that needs email.  
  
Line 9: Line 7:
 
     <li><source lang="bash"> sudo su - </source>
 
     <li><source lang="bash"> sudo su - </source>
 
     <li><source lang="bash"> apt-get install postfix </source>
 
     <li><source lang="bash"> apt-get install postfix </source>
     <li><source lang="bash"> apt-get install bsd-mailx
+
     <li><source lang="bash"> apt-get install bsd-mailx </source>
# or
 
apt-get install mailutils
 
</source>
 
 
     <li><pre>cat <<HERE | sudo tee /etc/postfix/main.cf > /dev/null
 
     <li><pre>cat <<HERE | sudo tee /etc/postfix/main.cf > /dev/null
# work-around for Digital Ocean's blocking of IPv6 for email
+
 
smtp_bind_address = 0.0.0.0
 
# or set inet_protocols = ipv4
 
 
# satellite configuration
 
# satellite configuration
 
smtp_use_tls = yes
 
smtp_use_tls = yes
Line 23: Line 16:
 
smtp_sasl_security_options = noanonymous
 
smtp_sasl_security_options = noanonymous
 
smtp_sasl_tls_security_options = noanonymous
 
smtp_sasl_tls_security_options = noanonymous
# list of CAs to trust when verifying server certificate
 
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
 
  
 
HERE
 
HERE
Line 38: Line 29:
 
   </ol>
 
   </ol>
  
 
== Security ==
 
https://drownattack.com/postfix.html illustrates how to secure your Postfix installation against weak encryption.
 
 
== Version ==
 
Run <code>postconf -d | grep mail_version</code> to find out your Postfix version.
 
 
 
== Log ==
 
All mail activity goes to the mail log, and you can see what's going on there:
 
<source lang="bash">
 
sudo tail -100 /var/log/mail.log
 
</source>
 
 
== Delete Mail ==
 
Postfix stores mails in a queue before sending it. Sometimes you wish to remove the mails from the queue but wonder how. Postfix offers the <code>postsuper</code> command which can be used to delete unsent mails from the queue. Before removing the mail from the queue it is good idea to list all mails in the queue. By issuing the command:
 
<source lang="bash">
 
mailq
 
</source>
 
you will list all of the mails which are queued or simply timed out for some reason.
 
 
If you want to remove a mail from the "mailq" type:
 
<source lang="bash">
 
postsuper -d mailID
 
</source>
 
where mailID is the ID of the message in the mail queue.
 
 
Issuing the command:
 
<source lang="bash">
 
postsuper -d ALL
 
</source>
 
will delete all queued messages from the mailq.
 
  
 
{{References}}
 
{{References}}
  
 
[[Category:Email]]
 
[[Category:Email]]
[[Category:Security]]
 

Revision as of 12:24, 29 July 2014

Notes on using Postfix [1]. Quick and dirty procedure for setting up Postfix on a new machine that needs email.

Setting up Postfix[edit | edit source]

Add Postfix Mail Transfer Agent as satellite smarthosting through Google, install mail utilities, setup an alias for root's mail and test it all

  1.  sudo su -
    
  2.  apt-get install postfix
    
  3.  apt-get install bsd-mailx
    
  4. cat <<HERE | sudo tee /etc/postfix/main.cf > /dev/null
    
    # satellite configuration
    smtp_use_tls = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_sasl_tls_security_options = noanonymous
    
    HERE
    
  5.  echo "smtp.gmail.com me@example.com:PASSWORD" > /etc/postfix/sasl_passwd
    
  6.  postmap /etc/postfix/sasl_passwd
    
  7.  chmod 640 /etc/postfix/sasl_passwd*
    
  8.  chown postfix:postfix /etc/postfix/sasl_passwd*
    
  9.  /etc/init.d/postfix restart
    
  10.  echo "root: me@example.com" >> /etc/aliases && newaliases
    
  11.  echo test |mail -s "test mail sent to external" greg.rundlett@gmail.com
    
  12.  echo test |mail -s "test mail sent to root" root
    


References[edit source]

  1. loosely following the info at http://braiden.org/?p=15