<?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>unsaturated.com &#187; hosting</title>
	<atom:link href="http://www.unsaturated.com/tag/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unsaturated.com</link>
	<description>The personal and professional website of Matthew Crumley</description>
	<lastBuildDate>Mon, 19 Apr 2010 03:51:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Last Spam</title>
		<link>http://www.unsaturated.com/projects/the-last-spam/</link>
		<comments>http://www.unsaturated.com/projects/the-last-spam/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 04:23:43 +0000</pubDate>
		<dc:creator>Matthew Crumley</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[SpamAssassin]]></category>

		<guid isPermaLink="false">http://www.unsaturated.com/?p=362</guid>
		<description><![CDATA[The decision to move my e-mail to Google was rather sudden.  I reached the inflection point where SpamAssassin and Dreamhost could no longer co-exist peacefully and cooperatively.  When it takes four applications to handle e-mail, its time to reevaluate the situation.]]></description>
			<content:encoded><![CDATA[<p>For the past six years I&#8217;ve used SpamAssassin as my primary e-mail filter.  It worked beautifully and was a great learning experience from an IT standpoint.  I was a vocal advocate for the software and felt my contribution to the open source community was in my clear, <a href="http://www.unsaturated.com/projects/spamassassin-for-dreamhost/">step-by-step tutorial</a> on its installation.  As a bonus, I received many thankful comments from Dreamhosters in response to those tutorials.  The benefits were nice but time and convenience always triumph.  That&#8217;s why I moved my mail to Google. </p>
<p>I kept my mail on Dreamhost for several reasons, the most paramount being security, privacy, and access.  I truly felt it was <em>my</em> mail.  I can do with it whatever I please.  I&#8217;m sure my thinking is not unique in this regard.  Not to offend anyone at Dreamhost or to question their integrity, but their administrators are no more trustworthy than those at Google.  Like any data not residing on <em>your own</em> PC, it&#8217;s subject to inspection by absolutely anyone with sufficient privileges.  I overcame that hesitation or fear, if you will.  </p>
<p>I next asked myself what value I could derive from using SquirrelMail.  Besides reading an e-mail and responding in plain text, there was nothing more.  It was fine software but its development stalled in the 20th century.  Using my custom SpamAssassin installation I was pushed into using an SSH client whenever I needed to tweak my approved sender list.  That&#8217;s three applications (SA, SquirrelMail, and PuTTY) just to keep my inbox clean.  Then the straw dropped.</p>
<p>The camel&#8217;s back was broken when Dreamhost upgraded their servers and split e-mail and hosting.  Granted, my hosted apps are performing much better but I had to <a href="http://www.unsaturated.com/projects/spamassassin-changes-for-dreamhost/">revamp</a> my SpamAssassin installation.  This is when I reached the inflection point of managing my own spam software:  value began to trend downwards.  </p>
<p>During a short weekend project, I updated the Dreamhost MX records, moved my e-mail, and updated my existing forwarding addresses.  Google&#8217;s &#8220;Report spam&#8221; button has made life easier for now but I also wonder when in the future I&#8217;ll use SpamAssassin and where will that be?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unsaturated.com/projects/the-last-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SpamAssassin Changes for Dreamhost</title>
		<link>http://www.unsaturated.com/projects/spamassassin-changes-for-dreamhost/</link>
		<comments>http://www.unsaturated.com/projects/spamassassin-changes-for-dreamhost/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 16:19:47 +0000</pubDate>
		<dc:creator>Matthew Crumley</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[SpamAssassin]]></category>

		<guid isPermaLink="false">http://www.unsaturated.com/?p=303</guid>
		<description><![CDATA[When hosting companies make changes to their network architecture, something is going to break. Dreamhost is no exception.  If your SpamAssassin installation broke as a result of their recent mail and web server split, then this tutorial is for you.]]></description>
			<content:encoded><![CDATA[<p>When hosting companies accommodate increased traffic they&#8217;re likely to make changes to the network architecture and <a href="http://www.dreamhost.com/rewards.cgi">Dreamhost</a> is no exception.  Most recently, they separated the mail and hosting servers for better performance.  On the upside my e-mail is much faster.  On the downside my SpamAssassin (SA) installation is not working.</p>
<p>One solution for this problem is to use Dreamhost&#8217;s installation of SA.  However, there&#8217;s no support for Bayesian rules.  Those rules require a per-user database.  Save whitelists, blacklists, and rule sensitivity, there&#8217;s no customization allowed.  Another annoyance is logging into webmail to do anything meaningful with false positives; it&#8217;s <a href="http://wiki.dreamhost.com/KB_/_Email_/_Spam_/_NEW!_Junk_Mail_Filter">explained further on the DH wiki</a>.</p>
<p>Another option, and the best in my opinion, is using an IMAP client of my choice.  This requires some modifications to my <a href="http://www.unsaturated.com/projects/spamassassin-for-dreamhost/">previous tutorial</a> which takes you through the entire process of installing SA.  Assuming that first tutorial is complete, you can now begin this tutorial.  Yes, you will <i>undo</i> some of the work in the original tutorial.  That&#8217;s the way it goes.</p>
<p>Because mail is being forwarded, moved, and synchronized <i>all over the place</i>, I thought a basic flowchart could simplify the end objective of this tutorial.  As you can see, everything is setup to move e-mail to and from the mail server and hosting server.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-steps-overview.png" alt="Tutorial Overview" title="Tutorial Overview" width="454" height="363" id="centered"/></p>
<p>A few assumptions before we get started&#8230;</p>
<ul>
<li>You have a basic understanding of Linux.</li>
<li>You have an active DH account.</li>
<li>You have access to the DH Panel.</li>
<li>The <code>%&gt;</code> notation indicates what you should type at the command prompt.</li>
<li>The <code>&lt;Valid URL for: FileXYZ&gt;</code> notation indicates you need to insert a URL that points to the file in question.</li>
</ul>
<ol>
<li><b>Create a new fully hosted e-mail account.</b>  <u>All</u> of your e-mail aliases should be re-routed to this account&#8217;s address; this is now the gateway account through which everything must pass.  You&#8217;ll have to create a similar account for each user with a SpamAssassin installation.  The address doesn&#8217;t have to be user friendly, but choose something you can remember.  In this example, I&#8217;ve created a new fully hosted address called spam_checker@unsaturated.com.<br />
<br/>If you have an alias called my.cool.address@unsaturated.com which forwards to your main user account, it will have to forward to spam_checker@unsaturated.com.  <b>Do not update all your aliases now because we want the transition to be seamless.</b> Let&#8217;s keep e-mail flowing until all steps are complete.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-step1-fullyhosted.png" alt="Fully hosted e-mail" title="Fully hosted e-mail" width="326" height="120" id="centered"/>
</li>
<li><b>Create a new forward-only e-mail address.</b>  After your mail is checked by SpamAssassin it will be forwarded to this new address, which then passes the e-mail along to your main user account, usually <i>your_user_name@yourdomain.com</i>.  This step allows your e-mail to find its way back to the mail servers from the hosting servers. In this example, I&#8217;ve created a new forward-only address called spam_checker_passed@unsaturated.com.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-step2-forwardonly.png" alt="Forward-only" title="Forward only e-mail" width="367" height="95"  id="centered"/>
</li>
<li><b>Move the spam.rc file to your home folder.</b>  The spam.rc file was originally in a folder called procmail but it was the only file in there.  This is a matter of preference but it&#8217;s important to keep this in mind for the rest of the tutorial. If nothing else is stored in your procmail folder, then delete it. Type the following at the command prompt:
<pre>
<code>%&gt; cd ~
%&gt; mv ~/procmail/spam.rc ~
%&gt; rm -Rf procmail/</code>
</pre>
</li>
<li><b>Update the .procmailrc file in your home directory.</b>  You&#8217;ll notice several changes to this file, most notably all e-mail is forwarded to the address made in step 2 or then deleted.  Remember, the spam has already been filtered to the .Spam folder according to the spam.rc file.  <b>Don&#8217;t forget to update the forwarding address!</b>  Type the following at the command prompt and insert the text shown:
<pre>
<code>%&gt; pico .procmailrc

#=======================================
# ~/.procmailrc
#
# Uses Maildir format mail directory.

# Uncomment the following three lines to debug
#LOGFILE=$HOME/procmail.log
#VERBOSE=yes
#LOGABSTRACT=all

## Directory for storing procmail-related files 
PMDIR=$HOME 

# Message directory (Courier IMAP and mutt)
MAILDIR=$HOME/MaildirSync 

# Spam filtering rules should run last
INCLUDERC=$HOME/spam.rc 

# Forward non-spam mail to validated address
# REMEMBER TO UPDATE THIS ADDRESS!!!
:0c
! spam_checker_passed@unsaturated.com

# Everything should be filtered to the local .Spam folder 
# or forwarded to the new mail server, so go ahead and 
# delete whatever remains 
:0
/dev/null
#=======================================</code>
</pre>
</li>
<li><b>Rename the Maildir directory.</b>  Again, you might be wondering why this is necessary.  In my opinion, the typical name for Maildir is okay if you&#8217;re actually using it for reading mail.  However, this directory is now used exclusively for synchronizing mail accounts.  Type the following at the command prompt:
<pre>
<code>%&gt; mv Maildir MaildirSync
%&gt; chmod -R 700 MaildirSync</code>
</pre>
</li>
<li><b>Download and extract offlineimap.</b>  The features and speed of <a href="http://software.complete.org/software/projects/show/offlineimap">offlineimap</a> looked compelling, so I tried it and decided to keep it. You can configure the script for many different scenarios but we&#8217;re keeping the steps basic.  This step deletes the default configuration files but don&#8217;t worry because I&#8217;ll provided one later.  Type the following at the command prompt:
<pre>
<code>%&gt; cd ~
%&gt; wget &lt;Valid URL for: offlineimap_6.0.3.tar.gz&gt;
%&gt; tar xvfz offlineimap_6.0.3.tar.gz
%&gt; cd offlineimap
%&gt; rm offlineimap.conf
%&gt; rm offlineimap.conf.minimal</code>
</pre>
</li>
<li><b>Create an .offlineimaprc configuration file.</b>  Offlineimap needs to know some basic information like where to find your remote and local mail, folders to ignore, and more.  To complete this you&#8217;ll need to know your mail server&#8217;s name, which can be accessed in the panel.  You might wonder why this program is necessary.  Consider a false positive e-mail, which is incorrectly marked spam.  You could move that message to the correct folder but that change needs to be reflected on the <i>hosting</i> server where SpamAssassin can learn from the change.  <b>Remember to update all the values marked <code>YOUR_</code>.</b> Type the following at the command prompt and insert the text shown:
<pre>
<code>%&gt; cd ~
%&gt; pico .offlineimaprc

#=======================================
# ~/.offlineimaprc

[general]
accounts = MainAccount
metadata = ~/.offlineimap
ignore-readonly = no
ui = Noninteractive.Quiet

[Account MainAccount]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = Maildir
localfolders = ~/MaildirSync

[Repository Remote]
type = IMAP
remotehost = YOUR_MAIL_SERVER_NAME.mail.dreamhost.com
ssl = true
remoteuser = main_account@YOUR_DOMAIN.com
remotepass = YOUR_PASSWORD
nametrans = lambda foldername: re.sub('^INBOX.*', '.', foldername)
folderfilter = lambda foldername: foldername in ['INBOX.Spam']
maxconnections = 1
holdconnectionopen = no
#=======================================</code>
</pre>
</li>
<p></p>
<li><b>Update the salearn.bat script.</b>  The old Bayes update script is obsolete because we have to ensure spam is synchronized between your hosting account and your mail account.  This script synchronizes your .Spam folders, copies all messages (read and unread) to a single directory, tells SpamAssassin to update the Bayesian database, purges all the spam, then does a final synchronization.  Type the following at the command prompt and insert the text shown:
<pre>
<code>echo '========================================================'
TESTED=false
if [ "$1" ]
then
  if [ $1 = "spam" ]
  then
    TESTED=true
    echo '--------------------------------------------------------'
    echo Synchronizing Spam folder...

    ~/offlineimap/offlineimap.py
    mv ~/MaildirSync/.Spam/new/* ~/MaildirSync/.Spam/cur/

    echo Messages synchronized and ready for processing.
    ~/sausr/bin/sa-learn -V
    echo Learning what is spam...
    ~/sausr/bin/sa-learn --spam ~/MaildirSync/.Spam/cur
    rm -f ~/MaildirSync/.Spam/cur/*
    echo Learning complete.  All spam messages were deleted.
    echo '--------------------------------------------------------'
    echo Resynchronizing your spam folder...
    ~/offlineimap/offlineimap.py
    echo All folders are synchronized. 
  elif [ $1 = "ham" ]
  then
    TESTED=true
    ~/sausr/bin/sa-learn -V
    echo '--------------------------------------------------------'
    echo Learning what is ham...
    ~/sausr/bin/sa-learn --ham ~/MaildirSync/cur  
  fi
  
  if [ $TESTED = true ]
  then
    echo '--------------------------------------------------------'
    echo Summary statistics of Bayes database...
    ~/sausr/bin/sa-learn --dump magic
    echo '--------------------------------------------------------'
  fi
else
  echo Enter one argument:  [ham | spam]
fi
echo '========================================================'</code>
</pre>
</li>
<p></p>
<li><b>Update your cron jobs.</b>  Because some e-mail are marked as spam incorrectly (false positives), we need to ensure all mail is synchronized.  This gives you a chance to correct those false positives and move valid e-mail back into your inbox.  The first cron task runs frequently to ensure your folders are up-to-date.  Some spam systems would do this once daily but I prefer to know sooner if an important e-mail got trashed.  The second task runs the Bayes update script.  Type the following at the command prompt, acknowledge prompts for e-mail according to your preferences, and enter the text shown:
<pre>
<code>%&gt; crontab -e

30 * * * * ~/offlineimap/offlineimap.py
10 0 * * 7 ~/salearn.bat spam</code>
</pre>
</li>
<li><b>Create an e-mail filter through the panel.</b>  Remember that e-mail account you created back in step 1 (spam_checker@unsaturated.com)?  It&#8217;s time to give it a trivial filter using the panel.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-step10a-filter.png" alt="E-mail Filter" title="E-mail Filter" width="163" height="241"  id="centered"/></a><br />
This will create a <code>.procmailrc</code> on the mail server, which you can&#8217;t see or edit via the shell.  By trivial, I mean an obvious pass.  Your rule would go something like this.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-step10b-trivial.png" alt="Trivial filter" title="Trivial filter" width="520" height="29"  id="centered"/></p>
<p>Now once the trivial filter is establish you want to select the &#8220;<b>Forward to shell account</b>&#8221; option.  Be sure to select the matching user account from the drop-down menu.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-step10c-forward.png" alt="Forward to shell" title="Forward to shell" width="213" height="24"  id="centered"/>
</li>
<li><b>Update all e-mail aliases.</b>  Remember that e-mail account you created back in step 1 (spam_checker@unsaturated.com)?  It&#8217;s time to update all your <i>other</i> aliases to point to that address.  With each updated alias, the system goes &#8220;live&#8221; so you might try it on an infrequently used address, then send a test message.<br />
<img src="http://www.unsaturated.com/wordpress/wp-content/data/sa-step11-aliases.png" alt="Update aliases" title="Update aliases" width="520" height="31"  id="centered"/>
</li>
<li><b>Send a test message.</b>  If everything is working properly, you can run the salearn.bat script and you should be error-free.  Send a test message and look for SA headers (X-Spam-Level, etc).  Lastly, if you find an error in my tutorial please post a comment.
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.unsaturated.com/projects/spamassassin-changes-for-dreamhost/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
