<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; Postfix</title> <atom:link href="http://www.ghacks.net/tag/postfix/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 09:52:46 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Stop SPAM in Postfix with Spamassassin</title><link>http://www.ghacks.net/2009/10/26/stop-spam-in-postfix-with-spamassassin/</link> <comments>http://www.ghacks.net/2009/10/26/stop-spam-in-postfix-with-spamassassin/#comments</comments> <pubDate>Mon, 26 Oct 2009 20:46:31 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Email]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[email filtering]]></category> <category><![CDATA[Postfix]]></category> <category><![CDATA[spam]]></category> <category><![CDATA[SPAM scoring]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=17653</guid> <description><![CDATA[So you have your Ubuntu server up and running with a Postfix mail server (see &#8220;Install Postfix for reliable email delivery&#8220;). You have also set up Postfix for antivirus with the help of ClamAV (see &#8220;Add antivirus to Post fix with ClamAV&#8220;). Finally you have Postfix set up to relay (see &#8220;Mail relaying made simple [...]]]></description> <content:encoded><![CDATA[<p>So you have your Ubuntu server up and running with a Postfix mail server (see &#8220;<a
title="Install Postfix for reliable email delivery" href="http://www.ghacks.net/2009/10/24/install-postfix-for-reliable-email-delivery/" target="_blank">Install Postfix for reliable email delivery</a>&#8220;). You have also set up Postfix for antivirus with the help of ClamAV (see &#8220;<a
title="Add antivirus to Postfix with ClamAV" href="http://www.ghacks.net/2009/10/24/install-postfix-for-reliable-email-delivery/" target="_blank">Add antivirus to Post fix with ClamAV</a>&#8220;). Finally you have Postfix set up to relay (see &#8220;<a
title="Mail relaying made simple with Postfix" href="http://www.ghacks.net/2009/09/23/mail-relaying-made-simple-with-postfix/" target="_blank">Mail relaying made simple with Postfix</a>&#8220;). The last trick in this bag is to add SPAM prevention to Postfix.</p><p>Fortunately there is a tool for that. The tool? <a
title="Spamassassin" href="http://spamassassin.apache.org/" target="_blank">Spamassassin</a>. Spamassassin is a very versatile SPAM tool that is part of the <a
title="Apache Foundation" href="http://www.apache.org/" target="_blank">Apache Foundation</a>. Spamassassin uses numerous means to detect SPAM including: DNS and Checksum based SPAM detection as well as Bayesian filtering, external programs, black lists, and online databases. These tools together make for a fairly powerful detection system.</p><p>In this article you are going to see how to install and configure Spamassassin to work in conjunction with Postfix to further enhance your email server.</p><p><span
id="more-17653"></span><strong>Installing Spamassassin</strong></p><p>Obviously the first thing you need to do is install Spamassassin. You will find Spamassassin in the Ubuntu repositories. And since this entire series has been laid on top of a Ubuntu Server installation, that is quite convenient. So, to install Spamassassin, open up your terminal window and issue the following command:</p><p><em>sudo apt-get install spamassassin</em></p><p>There may or may not be some dependencies to install in order for the Spamassassin  installation to complete. Go ahead and OK those. Once this installation is complete you are ready to start configuring.</p><p><strong>Configuration</strong></p><p>Before we actually get to the configuration it is important to understand the SPAM scoring system. With Spamassassin, messages are tagged as SPAM only when they have enough SPAM-matching characteristics (according to a scoring level). The scoring level is 0-5, however it&#8217;s not as simple as saying a 0 means it is 0% SPAM. The system is set up so that every characteristic can add to the overall score. For example a message tested to find a base64 attachment does not have a file name filtered with both bayes+net will add 0.224 to the over all score of the message. When all of the characteristic scores are added up, if they exceed the default score you have set in the configuration file, that message is considered SPAM.</p><p>Now that you have a basic understand of how the scoring system works. Let&#8217;s start configuring Spamassassin.</p><p>The main configuration file is <strong>/etc/spamassassin/local.cf. </strong>The first option you want to configure is the default score. Look for the line:</p><p><em> # required_score 5.0</em></p><p>The first thing you want to do is uncomment that line (by removing the &#8220;#&#8221; character) and then changing the score. A score of 5 is pretty high and sure to be SPAM. Understand the more you lower that score the likely you are of missing message messages that are tagged false-positives. A score of 3.5 is a fairly reliable score that will catch a lot of SPAM but not a lot of false positives.</p><p>Above this line are a couple of other options that are important. The first is the option to set the option:</p><p>report_safe</p><p>To 0. This option can be set to either 0 or 1. A zero means that if a message is found to be SPAM the message will not be deleted, but instead the subject line will be rewritten to include a message marking it as SPAM.  This is handy to prevent users from losing important messages to false positives. This also allows you to set a lower score threshold.</p><p>To do this first look for the line:</p><p><em># report_safe 1</em></p><p>Uncomment this line by removing the &#8220;#&#8221; character and then change the &#8220;1&#8243; to &#8220;0&#8243; (no quotes).</p><p>The next step is to uncomment the line:</p><p># rewrite_header Subject *****SPAM*****</p><p>Now you can alter the &#8220;*****SPAM*****&#8221; section of this line to reflect what you&#8217;d prefer it to say. Just make sure it is clear to your users that a message with this rewritten subject line is most likely SPAM.</p><p>Now restart the Spamassassin daemon with the command:</p><p><em>sudo /etc/init.d/spamassassin restart </em></p><p><strong>Configure Postfix</strong></p><p>The last step is to set up Postfix to use Spamassassin. To do this open up the file <strong>/etc/postfix/master.cf<em> </em><span
style="font-weight: normal">and look for the line:</span></strong></p><p><strong><span
style="font-weight: normal"><em>smtp     inet    n   &#8211;   &#8211;   &#8211;   &#8211;   smtpd</em></span></strong></p><p>You need to alter this line to look like:</p><p><code>smtp      inet   n   -   -   -   -   smtpd -o content_filter=spamassassin</code></p><p>Finally, at the end of this file add the following:</p><p><code>spamassassin<br
/> unix - n n - - pipe<br
/> flags=R<br
/> user=spamd<br
/> argv=/usr/bin/spamc<br
/> -e /usr/sbin/sendmail<br
/> -oi -f ${sender} ${recipient}</code></p><p>Now all you need to do is restart Postfix with the command:</p><p><em>sudo /etc/init.d/postfix restart</em></p><p>Your mail server should now be scoring incoming message as SPAM or HAM.</p><p><strong>Final thoughts</strong></p><p>The mail server is a tricky beast. You have to ensure that users are getting their mail, but you have to make sure they aren&#8217;t receive SPAM or viruses. After completing this series of articles, you should have a pretty solid server running that will send out mail that is safe for users eyes.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/10/26/stop-spam-in-postfix-with-spamassassin/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Add antivirus to Postfix with ClamAV</title><link>http://www.ghacks.net/2009/10/25/add-antivirus-to-postfix-with-clamav/</link> <comments>http://www.ghacks.net/2009/10/25/add-antivirus-to-postfix-with-clamav/#comments</comments> <pubDate>Sun, 25 Oct 2009 15:46:17 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Email]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[anti virus]]></category> <category><![CDATA[Postfix]]></category> <category><![CDATA[virus definitions]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=17707</guid> <description><![CDATA[By now you have your Postfix mail server up and running (see &#8220;Install Postfix for reliable email delievery&#8220;). You even have relaying working (see &#8220;Mail relaying made simple with Postfix&#8220;). But one of the most important features you can add to a mail server is an system to prevent viruses from being passed to users. [...]]]></description> <content:encoded><![CDATA[<p>By now you have your Postfix mail server up and running (see &#8220;<a
title="Install Postfix for reliable email delievery" href="http://www.ghacks.net/2009/10/24/install-postfix-for-reliable-email-delivery/" target="_blank">Install Postfix for reliable email delievery</a>&#8220;). You even have relaying working (see &#8220;<a
title="Mail relaying made simple with Postfix" href="http://www.ghacks.net/2009/09/23/mail-relaying-made-simple-with-postfix/" target="_blank">Mail relaying made simple with Postfix</a>&#8220;). But one of the most important features you can add to a mail server is an system to prevent viruses from being passed to users. Naturally, the Linux fan will say &#8220;But Linux isn&#8217;t affected by viruses!&#8221;. Although that may, for the most part, be true, this is a mail SERVER which could be serving up mail to Windows users. And Windows machines ARE effected by viruses. To that end, anti-virus measures are a necessity on a Linux email server.</p><p>One of the best anti-virus systems for a Postfix server is <a
title="ClamAV" href="http://www.clamav.net/" target="_blank">ClamAV</a>. This anti-virus tool kit is open sourced and can be used on all UNIX-like operating systems. It&#8217;s easy to install and effective. In this article we will be following our series started way back in the <a
title="Installing Ubuntu Server 9.04" href="http://www.ghacks.net/2009/09/03/installing-ubuntu-server-9-04/" target="_blank">Installing Ubuntu Server 9.04 article</a>. Of course we will be installing ClamAV on a Ubuntu server running LAMP and Postfix. With that in mind, let&#8217;s get busy!</p><p><span
id="more-17707"></span><strong>Installation</strong></p><p>The first thing to take care of is the installation of ClamAV. There are a number of tools you will need to install. Open up a terminal window and issue the command:</p><p><code>sudo apt-get install clamav clamav-freshclam clamsmtp</code></p><p>The above command should also pick up all of the necessary dependencies. The installation will also start the clamav daemon. You will restart that momentarily</p><p><strong>Configuration</strong></p><p>Once installed you have some configurations to take care of. There are three files you are going to have to edit:</p><ul><li><span
style="background-color: #ffffff"><strong>/etc/clamsmtpd.conf</strong></span></li><li><span
style="background-color: #ffffff"><strong>/etc/postfix/main.cf</strong></span></li><li><span
style="background-color: #ffffff"><strong>/etc/postfix/master.cf</strong></span></li></ul><p>The first file to configure is the <strong>clamsmtpd.conf </strong>file. The configuration in this file is simple. Look for the lines:</p><p><em>OutAddress: 10025</em></p><p><em><em>127.0.0.1:10026</em></em></p><p>Change them to:</p><p><em>OutAddress: 10026</em></p><p><em><em>127.0.0.1:10025</em></em></p><p>That&#8217;s it for the <strong>clamsmtpd.conf </strong>file. Now let&#8217;s move on to the heavier configurations.</p><p>Open up the <strong>/etc/postfix/main.cf </strong>file. Scroll down to the bottom of this file and add the following:</p><p><em>content_filter = scan:127.0.0.1:10025</em></p><p><em>receive_override_options = no_address_mappings</em></p><p>Save that file and now move on over to the <strong>/etc/postfix/master.cf</strong> file. Again, scroll down to the bottom of this file and add the following:</p><p><code># AV scan filter (used by content_filter)<br
/> scan      unix  -       -       n       -       16      smtp<br
/> -o smtp_send_xforward_command=yes<br
/> # For injecting mail back into postfix from the filter<br
/> 127.0.0.1:10026 inet  n -       n       -       16      smtpd<br
/> -o content_filter=<br
/> -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks<br
/> -o smtpd_helo_restrictions=<br
/> -o smtpd_client_restrictions=<br
/> -o smtpd_sender_restrictions=<br
/> -o smtpd_recipient_restrictions=permit_mynetworks,reject<br
/> -o mynetworks_style=host<br
/> -o smtpd_authorized_xforward_hosts=127.0.0.0/8</code></p><p>Save that file.</p><p><strong>Restarting</strong></p><p>The first thing you need to do is restart Postfix with the command:</p><p><em>sudo /etc/init.d/postfix restart</em></p><p>Once that has restarted you need to restart clamsmtpd with the command:</p><p><em>sudo /etc/init.d/clamsmtpd restart</em></p><p>Now, if nothing has gone horribly wrong, you should have a virus protected Postfix mail server.</p><p><strong>Updating signatures</strong></p><p>You should never go without updating your virus signatures. This is critical for keeping your mail server virus-free as new viruses are created or old viruses mutate. Fortunately ClamAV has its own tool for this. You will need to go back to that terminal window and issue the command:</p><p><em>sudo freshclam</em></p><p>Which will update the signatures.</p><p>You might even add the <em>freshclam</em> command into the root users crontab for regular signature updates.</p><p><strong>Final thoughts</strong></p><p>Your Postfix mail server is getting better and stronger each day. Adding anti-virus is a critical step in the grand scheme of Postfix things. In our next addition to the Postfix series, we will add Spamassassin for anti-spam measures.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/10/25/add-antivirus-to-postfix-with-clamav/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Install Postfix for reliable email delivery</title><link>http://www.ghacks.net/2009/10/24/install-postfix-for-reliable-email-delivery/</link> <comments>http://www.ghacks.net/2009/10/24/install-postfix-for-reliable-email-delivery/#comments</comments> <pubDate>Sat, 24 Oct 2009 15:43:36 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Email]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[mail server]]></category> <category><![CDATA[Postfix]]></category> <category><![CDATA[ubuntu mail server]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=17656</guid> <description><![CDATA[With your Ubuntu LAMP Server up and running (see my previous article &#8220;Installing Ubuntu Server 9.04&#8221; and &#8220;How to: install a LAMP server&#8220;) and you are ready to set it up as a mail server. For the longest time Sendmail was the de facto standard Linux mail server. But over time serious security issues drove [...]]]></description> <content:encoded><![CDATA[<p>With your Ubuntu LAMP Server up and running (see my previous article &#8220;<a
title="Installing Ubuntu Server 9.04" href="http://www.ghacks.net/2009/09/03/installing-ubuntu-server-9-04/" target="_blank">Installing Ubuntu Server 9.04</a>&#8221; and &#8220;<a
title="How to: Install a LAMP server" href="http://www.ghacks.net/2009/07/23/how-to-install-a-lamp-server/" target="_blank">How to: install a LAMP server</a>&#8220;) and you are ready to set it up as a mail server. For the longest time Sendmail was the de facto standard Linux mail server. But over time serious security issues drove users to a much more reliable, secure, and easier to configure alternative. That alternative is <a
title="Postfix" href="http://www.postfix.org" target="_blank">Postfix</a>. Postfix is much easier to configure than Sendmail and it is easier to add third-party &#8220;modules&#8221; (such as Spamassassin and ClamAV &#8211; will be discussed in later articles).</p><p>In this article you are going to learn how to install Postfix on your already running Ubuntu Server 9.04. I am going to assume you have it networked and have a domain registered that you want to use. At the end of this article you should have a working mail server, ready for use.</p><p><span
id="more-17656"></span></p><p>NOTE: For the purposes of this article, I will use the fake domain &#8220;www.ubuntumail.net&#8221;. You will want to use your domain in place of that.</p><p>The first step is to install the software necessary. Since you already have LAMP up and running all you will need to do is install Postfix and it&#8217;s dependencies. To do this open up a terminal and issue the following command:</p><p><em>sudo apt-get install postfix</em></p><p>The installation will not only install Postfix, but will start the Postfix daemon for you. You will most likely want to test this installation by running the old telnet test like so:</p><p><em>telnet localhost 25</em></p><p>You should see something like:<br
/> <code>Trying 127.0.0.1...<br
/> Connected to www.ubuntumail.net.<br
/> Escape character is '^]'.<br
/> 220 localhost.localdomain ESMTP Postfix (Ubuntu)</code></p><p>If you do, success! Now you are ready to take care of the configuration steps.</p><p><strong>Configuration</strong></p><p>There is only one file you need to deal with in Postfix. That file is <strong>/etc/postfix/main.cf</strong>. There really isn&#8217;t much to configuring this file (for a basic installation &#8211; which is all we are dealing with right now).</p><p>To set your Postfix installation up for your domain you will want to open that file for editing like so:</p><p><em>sudo nano /etc/postfix/main.cf</em></p><p>The above command opens <strong>main.cf </strong>in the Nano editor. What you need to look for is this section:</p><p><code>myhostname = ubuntumail<br
/> alias_maps = hash:/etc/aliases<br
/> alias_database = hash:/etc/aliases<br
/> myorigin = /etc/mailname<br
/> mydestination = ubuntumail.net, ubuntumail, localhost.localdomain, localhost<br
/> relayhost =<br
/> #mynetworks = 127.0.0.0/8<br
/> mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128<br
/> mailbox_command = procmail -a "$EXTENSION"<br
/> mailbox_size_limit = 0<br
/> recipient_delimiter = +<br
/> inet_interfaces = all</code></p><p>As you can see, I have already configured the above section to work with our sample domain. You will need to go through the above section and insert your domain where you see ubuntumail.net. You will want to pay close attention to the <strong>mydestination</strong> line. As you can see that line contains:</p><p>ubuntumail.net, ubuntumail, localhost.localdomain</p><p>This helps to avoid mailloops in Postfix.</p><p>Some people also like to use the <strong>mydomain</strong> parameter, but since <strong>mydomain </strong>is taken from <strong>$myhostname </strong>by removing the first part (unless that would cause the domain to be a top-level domain) it can be redundant. If, however, your mail server serves your entire domain, you will need to use the <strong>mydomain</strong> parameter. For that you would insert:</p><p><code>mydomain = ubuntumail.net</code></p><p>at the top of the section shown above.</p><p>Once you have that configuration saved, restart Postfix with the command:</p><p><em>sudo /etc/init.d/postfix reload</em></p><p>To reload the mail server.</p><p><strong>Users</strong></p><p>As this is a Linux box, you will want to make sure you have a user created for every email address you need to serve up. So create your users with your favorite user creation tool. Since you are most likely installing on a Ubuntu Server (sans GUI), you will be using the <em>useradd </em>command. You can accomplish this with the command:</p><p><em>sudo useradd -m USERNAME</em></p><p>Where USERNAME is the actual username you want to use. Next you will need to give the user a password with the command:</p><p>sudo passwd USERNAME</p><p>Where USERNAME is the actual username you want to use. You will be prompted to enter the password twice.</p><p>After you have entered the users, you can then test the mail server by sending an email from an external source to see if it arrives. If there is a problem make sure the first place you look is <strong>/var/log/mail.err</strong>.</p><p><strong>Final thoughts</strong></p><p>At this point you should have a basic, working mail server. Postfix does make this task much more simple than did Sendmail. In my next article I will cover adding Spamassassin to your Postfix mail server to keep SPAM from getting in.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/10/24/install-postfix-for-reliable-email-delivery/feed/</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>Mail relaying made simple with Postfix</title><link>http://www.ghacks.net/2009/09/23/mail-relaying-made-simple-with-postfix/</link> <comments>http://www.ghacks.net/2009/09/23/mail-relaying-made-simple-with-postfix/#comments</comments> <pubDate>Wed, 23 Sep 2009 01:17:26 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Email]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Networks]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Advanced]]></category> <category><![CDATA[mail relaying]]></category> <category><![CDATA[mail server]]></category> <category><![CDATA[Postfix]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=16586</guid> <description><![CDATA[Have you installed the Postfix as an easier to use, more secure alternative to Sendmail only to find yourself having trouble with the old &#8220;unable to relay&#8221; errors? This can be very frustrating and have you pulling out your hair in no time. MTAs (Mail Transfer Agents) can be a tricky lot to set up. [...]]]></description> <content:encoded><![CDATA[<p>Have you installed the Postfix as an easier to use, more secure alternative to Sendmail only to find yourself having trouble with the old &#8220;unable to relay&#8221; errors? This can be very frustrating and have you pulling out your hair in no time.</p><p>MTAs (Mail Transfer Agents) can be a tricky lot to set up. Add in to the mix something like relaying and you have all the ingredients for an installation NOT working. Fortunately <a
title="Postfix" href="http://www.postfix.org/" target="_blank">Postfix</a> isn&#8217;t nearly as complicated as Sendmail, so relaying isn&#8217;t something you need guru-level access to solve. In this tutorial I am going to show you how to set up Postfix for easy relaying. You can always add this to the Ubuntu Server series that started with the article &#8220;<a
title="Installing Ubuntu Server 9.04" href="http://www.ghacks.net/2009/09/03/installing-ubuntu-server-9-04/" target="_blank">Installing Ubuntu Server 9.04</a>&#8220;.</p><p><span
id="more-16586"></span><strong>Installing Postfix</strong></p><p>Just in case you haven&#8217;t already, you can install Postfix on your already running Ubuntu Server install with the command:</p><p><em>sudo apt-get install postfix</em></p><p>But I am going to assume you already have Postfix up and running already. And if you&#8217;re looking into relaying with Postfix, your problem is that you can receive mail, you just can&#8217;t send it. Let&#8217;s fix that problem.</p><p><strong>Configure Postfix</strong></p><p>The file you need to first take care of is <strong>/etc/postfix/main.cf</strong>. You will need sudo access so open this file with the command:</p><p><em>sudo nano /etc/postfix/main.cf</em></p><p>Now add this to the bottom of that file:</p><p><code># SMTP Authentication<br
/> smtp_sasl_auth_enable = yes<br
/> smtpd_sasl_type = dovecot<br
/> smtpd_sasl_path = private/auth<br
/> smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd</code></p><p>NOTE: The portion starting with &#8220;smtpd_recipient_restrictions&#8221; and ending with &#8220;reject_unauth_destination&#8221; is actually one line.</p><p>NOTE: The portion starting with &#8220;reject_unauth&#8221; and ending with &#8220;sasl_passwd&#8221; is also only one line.</p><p>NOTE: The above assumes you are using Dovecot as your IMAP server.</p><p>The last line of the above should give you a hint as to what is next. Yes, you have to create a file, <strong>sasl_passwd</strong>, for Postfix to use as a password file. This file will be located in <strong>/etc/postfix/sasl/</strong> and will look like the following:</p><p>address.for.relaying   username:password</p><p>Where<em>:</em></p><ul><li><em>address.for.relaying </em>is the actual mail server you will use for relaying.</li><li><em>username</em> is the username for authentication on the relaying mail server.</li><li><em>password</em> is the password for authentication on the relaying mail server.</li></ul><p>The next step is to create the the sasl_passwd DB file so that Postfix has something it can read. To do this, issue the command:</p><p><em>sudo postmap hash:/etc/postfix/sasl/sasl_passwd</em></p><p>You should now see a new file in the <strong>/etc/postfix/sasl </strong>directory called <strong>sasl_passwd.db.</strong></p><p>One file step before restarting Postfix. Because the password file is plaintext it should be secured so that it can not be read by just any user. Say, for instance, you want Postfix to only be read by the root user. For this issue the command:</p><p><em>sudo chown root:root /etc/postfix/sasl/sasl_passwd &amp;&amp; chmod 600 /etc/postfix/sasl/sasl_passwd</em></p><p>Do the same thing with the <strong>sasl_passwd.db </strong>file like so:</p><p><em>sudo chown root:root /etc/postfix/sasl/sasl_passwd.db &amp;&amp; chmod 600 /etc/postfix/sasl/sasl_passwd.db</em></p><p>NOTE: If you have need for a different user, you can chown the file to whatever user you want&#8230;just make sure it is a secure user.</p><p>You&#8217;re finished. All that is left is to restart Postfix with the command:</p><p><em>sudo /etc/init.d/postfix restart</em></p><p>Open up your mail client and text to see if relaying is now working for you.</p><p><strong>Final thoughts</strong></p><p>Gone are the days of the overly complicated (and insecure) Sendmail configurations. Setting up relaying is simple when you are using Postfix.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/09/23/mail-relaying-made-simple-with-postfix/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
