<?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>nikrivers.com &#187; linksys</title>
	<atom:link href="http://www.nikrivers.com/tag/linksys/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nikrivers.com</link>
	<description></description>
	<lastBuildDate>Tue, 07 Sep 2010 16:42:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Popular pages</title>
		<link>http://www.nikrivers.com/2009/03/07/popular-pages</link>
		<comments>http://www.nikrivers.com/2009/03/07/popular-pages#comments</comments>
		<pubDate>Sat, 07 Mar 2009 11:13:12 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[nslu2]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?p=398</guid>
		<description><![CDATA[This website is a sort of personal project, rather than a proper blog &#8211; the reason I make this distinction is because I usually don&#8217;t have anything interesting to say; at least, nothing that would be of any interest to anyone who doesn&#8217;t know me. Much like being able to tell (but not necessarily care) [...]]]></description>
			<content:encoded><![CDATA[<p>This website is a sort of personal project, rather than a proper blog &#8211; the reason I make this distinction is because I usually don&#8217;t have anything interesting to say; at least, nothing that would be of any interest to anyone who doesn&#8217;t know me.</p>
<p><span id="more-398"></span></p>
<p>Much like being able to tell (but not necessarily care) when I&#8217;m boring someone with a particular conversation, I use website analytics to see where website visitors come from, what they look at, and how frequently they return. Yes, some people come back. In fact, most people do. And the most popular pages are actually the<a href="http://www.nikrivers.com/linksys-nslu2/"> </a><a href="http://www.nikrivers.com/linksys-nslu2/" target="_self">NSLU2 guides</a> which describe how to configure a very small, low-power Linux server based on a Linksys NAS device.</p>
<p>I have no delusions about the overall importance of nikrivers.com; nobody knows about it, it doesn&#8217;t appear very high up in any Google results unless you search for my name, and even my mum keeps forgetting how to find it (though she also has to keep asking me how to find the Internet, because &#8220;it&#8217;s gone from my desktop&#8221;).</p>
<p>That said, 101 different people have visited my NSLU2 guides in the last 20 days alone, about a third of which are visitors who have never been to my website before. Even after Linksys has discontinued the NSLU2, it still remains popular as a web and mail server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/2009/03/07/popular-pages/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hardcore HTML</title>
		<link>http://www.nikrivers.com/2008/09/08/hardcore-html</link>
		<comments>http://www.nikrivers.com/2008/09/08/hardcore-html#comments</comments>
		<pubDate>Mon, 08 Sep 2008 17:20:30 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[kvetch]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[visual studio 2005]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?p=224</guid>
		<description><![CDATA[I&#8217;ve never really had any cause to write large posts using WordPress, except for my NSLU2 guides &#8211; and even then the built-in WYSIWYG editor was good enough, albeit a little clunky and requiring gentle persuasion every so often. But after changing blog themes the other day, I realised the NSLU2 pages were actually quite [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve never really had any cause to write large posts using WordPress, except for my <a href="http://www.nikrivers.com/linksys-nslu2/">NSLU2 guides</a> &#8211; and even then the built-in WYSIWYG editor was good enough, albeit a little clunky and requiring gentle persuasion every so often.</p>
<p>But after changing blog themes the other day, I realised the NSLU2 pages were actually quite dependent on the underlying CSS &#8211; and for some themes, this means that they looked rubbish.</p>
<p><span id="more-224"></span></p>
<p>So I went about reformatting the pages. There are only half a dozen of them, and only one or two are of any considerable size &#8211; but this was enough to find exactly how annoying the WordPress WYSIWYG editor can be. I ended up with inconsistent newlines (although the HTML was consistent), weird closing tags that didn&#8217;t match anything else in the document, and random behaviour whereby the editor would say something along the lines of &#8220;hey, I can&#8217;t figure out exactly what you&#8217;re trying to do, so why don&#8217;t I double-space half of this here single-spaced text, indent the whole document from this point onwards, and completely unformat all your headings?&#8221;</p>
<p>There&#8217;s a little feature on the WordPress.org website called <a href="http://wordpress.org/extend/kvetch/" target="_blank">Kvetch!</a>, which allows users to anonymously vent their annoyance at WordPress&#8217;s quirks and bugs. I had seen that several people don&#8217;t like the built-in HTML editor that WordPress has, but I myself had only ever needed to write a few paragraphs and make a couple of words bold, nothing more &#8211; and for this it is <span style="text-decoration: line-through;">fine</span> adequate.</p>
<p>But for decent formatting capabilities, the built-in editor just doesn&#8217;t cut it. It is what I have decided to call a WYSINWYWBYWJHTGWI editor. Yes, a What-You-See-Is-Not-What-You-Want-But-You-Will-Just-Have-To-Go-With-It editor. I&#8217;m going to register that as a trademark so that the WordPress people can&#8217;t thieve it from me when they release their next iteration.</p>
<p>So, there was else nothing for it. I cracked open Microsoft Visual Studio 2005, and used <em>that</em> as my editor to reformat everything. I didn&#8217;t use the WYSIWYG designer, I just wanted something that would give me syntax colouring.</p>
<p>I was fully prepared to go so far as to use notepad &#8211; but I think that would have been a little <em>too</em> hardcore for my liking.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/2008/09/08/hardcore-html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another new look</title>
		<link>http://www.nikrivers.com/2008/09/04/another-new-look</link>
		<comments>http://www.nikrivers.com/2008/09/04/another-new-look#comments</comments>
		<pubDate>Thu, 04 Sep 2008 19:10:10 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[k2]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?p=132</guid>
		<description><![CDATA[One of the features of WordPress is the ability to change the theme of a blog with the click of a button; and that&#8217;s exactly what I did when the K2 theme, although quite powerful in its own right, was found lacking again. With this theme, my NSLU2 guides currently look like they were formatted [...]]]></description>
			<content:encoded><![CDATA[<p>One of the features of <a href="http://wordpress.org/">WordPress</a> is the ability to change the theme of a blog with the click of a button; and that&#8217;s exactly what I did when the K2 theme, although quite powerful in its own right, was found lacking again.</p>
<p>With this theme, my <a href="http://www.nikrivers.com/linksys-nslu2/">NSLU2 guides</a> currently look like they were formatted by a 4-year-old, so I might get round to fixing them, eventually. They&#8217;re by far the most popular pages on this site!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/2008/09/04/another-new-look/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2: print server with CUPS</title>
		<link>http://www.nikrivers.com/linksys-nslu2/print-server-with-cups</link>
		<comments>http://www.nikrivers.com/linksys-nslu2/print-server-with-cups#comments</comments>
		<pubDate>Thu, 24 Apr 2008 20:15:07 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cups]]></category>
		<category><![CDATA[hpijs]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[print server]]></category>
		<category><![CDATA[printers]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=41</guid>
		<description><![CDATA[Installing and configuring CUPS with an HP PhotoSmart 8150 was ridiculously easy, since CUPS comes complete with HPIJS (the HP linux print drivers). The printer is attached via a USB hub on port 1. Installing CUPS First off, install CUPS and its documentation package. Strangely enough, the docs include a lot of the files required [...]]]></description>
			<content:encoded><![CDATA[<p>Installing and configuring CUPS with an HP PhotoSmart 8150 was ridiculously easy, since CUPS comes complete with HPIJS (the HP linux print drivers). The printer is attached via a USB hub on port 1.</p>
<h3>Installing CUPS</h3>
<p>First off, install CUPS and its documentation package. Strangely enough, the docs include a lot of the files required to run the CUPS web interface.</p>
<blockquote><p>ipkg install cups<br />
ipkg install cups-doc</p></blockquote>
<p>First of all, edit the CUPS config file.</p>
<blockquote><p>vi /opt/etc/cups/cupsd.conf</p></blockquote>
<p>There are a few lines which restrict access to CUPS to only the <strong>192.168.0.0/24</strong> network. This is fine for a lot of people, but if your network doesn&#8217;t use that range of addresses, you need to edit them accordingly.</p>
<p>Now you need to make sure your printer is connected to the Slug. By default, CUPS has no permissions on the device that represents the printer (<strong>/dev/lp0</strong>). Fix that with:</p>
<blockquote><p>chmod 777 /dev/lp0</p></blockquote>
<p>Next you need to put the startup script in <strong>/opt/etc/init.d</strong> so that CUPS can start automatically. Most other packages do this as part of their installation/configuration process, but with CUPS this has to be done manually. Also, start CUPS.</p>
<blockquote><p>cp /opt/doc/cups/S88cups /opt/etc/init.d<br />
/opt/doc/cups/S88cups</p></blockquote>
<p>Now you can use a web browser to browse to <strong>http://your-slug:631</strong> (where <strong>your-slug</strong> is the host name or IP address of your Slug) and use the CUPS web interface to manage your printer. Under <strong>Manage Printers </strong>you&#8217;ll see there&#8217;s already an HP 990c installed. While the HP990c apparently works with the majority of printers, I prefer to use the right driver for my printer &#8211; so I deleted the HP 990c, then went through the &#8216;Adding a printer to CUPS&#8217; process.</p>
<h3>Adding a printer to CUPS</h3>
<p>From the main page in the CUPS web interface, click <strong>Add Printer</strong>. You will probably be presented with the message <strong>426 Upgrade Required</strong>. This means that CUPS requires that your browser switches from <strong>http</strong> to <strong>https</strong>, but can&#8217;t do it automatically &#8211; you need to click the link, and you&#8217;ll be asked to provide a valid username and password to continue. Using <strong>root</strong> here is fine.</p>
<p>On the page that follows, give your printer a name &#8211; bear in mind this name will be part of the printer&#8217;s URL, so it can&#8217;t contain spaces, hashes or slashes. Provide a description and the location if you want, too.</p>
<p>On the next page, choose your printer from the drop-down list. CUPS queries the printer for this information, so it&#8217;s pretty accurate. If your printer isn&#8217;t listed, you probably forgot to change the permissions on <strong>/dev/lp0</strong> as described above.</p>
<p>CUPS will then display a list of drivers, and you&#8217;ll probably not see your printer there. So head over to <a href="http://www.linuxprinting.org/printer_list.cgi">http://www.linuxprinting.org/printer_list.cgi</a>, search for your printer, and download the PPD file for it. Once that&#8217;s done, return to the CUPS page. Click <strong>Browse&#8230;</strong> and select the PPD you downloaded, then click <strong>Add Printer</strong>. You&#8217;re done.</p>
<p>All you need to do now is click the <strong>Printers</strong> tab at the top of the page, and start your printer if it isn&#8217;t already started.</p>
<p>Note that your printer needs <strong>foomatic-rip</strong> if your Printers page shows a message such as this:</p>
<p><em>Filter &#8220;foomatic-rip&#8221; for printer &#8220;HP-PhotoSmart-8150&#8243; not available: No such file or directory</em></p>
<p>My testing showed that my printer worked fine without foomatic-rip, but the printer needed to be started manually every time CUPS (or the Slug) restarted. There is probably a setting in the configuration file to force a printer to attempt to start regardless of errors, but I found installing foomatic-rip to be a cleaner fix:</p>
<blockquote><p>cd /opt/lib/cups/filter<br />
wget http://www.linuxprinting.org/foomatic-rip<br />
wget http://www.linuxprinting.org/foomatic-gswrapper<br />
chmod 755 foomatic-rip foomatic-gswrapper<br />
/opt/etc/init.d/S88cups restart</p></blockquote>
<p>No more error message, and the printer starts automatically when CUPS starts.</p>
<p>It is also worth backing up the <strong>/opt/etc/cups/printers.conf</strong> file. CUPS has a tendency to overwrite it with a file of the wrong format when you click on certain options in the web interface, resulting in 403 Forbidden errors when you try to access the web interface.</p>
<blockquote><p>cp /opt/etc/cups/printers.conf /opt/etc/cups/printers.conf.backup</p></blockquote>
<h3>Using a CUPS printer in Windows</h3>
<p>In Windows Vista, installing the printer is simple. Open the <strong>Control Panel</strong>, go to <strong>Printers</strong>, and then <strong>Add Printer</strong>. Select <strong>Add a network, wireless or Blutooth printer</strong>, and click <strong>Stop</strong> on the next page of the wizard; it won&#8217;t detect the printer, but you can add it easily, so click <strong>The printer that I want isn&#8217;t listed</strong>.</p>
<p>In the <strong>Select a shared printer by name</strong> text field, enter <strong>http://your-slug:631/printers/printer-name</strong>. You need to replace <strong>your-slug</strong> with either the host name or IP address of your Slug, and <strong>printer-name</strong> with the printer name you chose. Click <strong>Next</strong>. You will then be presented with a list of printer drivers to choose from. The list contains all the drivers that shipped with your release of Windows Vista plus all those that you have installed. If you don&#8217;t see the right printer driver in the list, visit your printer manufacturer&#8217;s website to download the right driver, and install it.</p>
<p>In Windows XP, open the <strong>Control Panel</strong>, go to <strong>Printers and Faxes</strong>, and then <strong>Add a Printer</strong>. Select <strong>Connect to a printer on the Internet or on a home or office network</strong>, and in the <strong>URL</strong> field enter <strong>http://your-slug:631/printers/printer-name</strong>. You need to replace <strong>your-slug</strong> with either the host name or IP address of your Slug, and <strong>printer-name</strong> with the printer name you chose.</p>
<p>Windows XP doesn&#8217;t have as comprehensive a driver database as Windows Vista, so the likelihood is that your printer won&#8217;t be shown in the dialog you see next (unless you had already installed your printer drivers on that computer). Download the drivers from your manufacturer&#8217;s website (or use the printer&#8217;s driver disk), and select <strong>Have Disk</strong>. Locate the driver and click <strong>OK</strong>, then choose the exact printer from the list that follows.</p>
<h3>Issues</h3>
<p>On Windows XP, certain actions or operations will cause a crash in Word 2003 and Word 2007 if a CUPS printer is installed and set as the default printer, but the CUPS server is unavailable.</p>
<p>The action that triggers the crash does not obviously relate the problem to the printer&#8217;s availability, but removing the printer (or setting a different printer to default) will prevent the problem &#8211; as will ensuring CUPS is always online and available to Windows XP clients.</p>
<p>This doesn&#8217;t seem to happen on Windows Vista.</p>
<p><em>If this information was useful, please leave a comment to let me know!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/print-server-with-cups/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2: time server with NTP</title>
		<link>http://www.nikrivers.com/linksys-nslu2/time-server-with-ntp</link>
		<comments>http://www.nikrivers.com/linksys-nslu2/time-server-with-ntp#comments</comments>
		<pubDate>Thu, 24 Apr 2008 20:04:47 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[ntp]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=42</guid>
		<description><![CDATA[If you&#8217;re running an email server on your Slug, where accurate server time is vital, or you simply want the Slug&#8217;s system time to be accurate, you need to make a few changes. When it comes out of the factory the Slug has an inherrent bug which causes the internal clock to lose time; apparently [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re running an email server on your Slug, where accurate server time is vital, or you simply want the Slug&#8217;s system time to be accurate, you need to make a few changes.</p>
<p>When it comes out of the factory the Slug has an inherrent bug which causes the internal clock to lose time; apparently Linksys tried to fix this problem by adjusting the time regularly (using cron) but it seems the time is adjusted in the wrong direction &#8211; thus, the error is doubled. This problem is fixed in Unslung 2.6 and higher anyway (Unslung 2.10 is the latest release as at Jan 2009), so we can remove the relevant crontab entry.</p>
<p>Edit the crontab file:</p>
<blockquote><p>vi /etc/crontab</p></blockquote>
<p>Comment out the call to hwclock (the Linksys &#8216;fix&#8217;). The hash (#) symbol is used to denote a comment:</p>
<blockquote><p>#1 * * * * root /usr/sbin/hwclock -s &amp;&gt;/dev/null</p></blockquote>
<p>Now install ntpd, and edit the config file to contain time servers that are geographically close to you &#8211; you can find out what these are by visiting <a href="http://www.pool.ntp.org/">http://www.pool.ntp.org/</a>. Editing the config file is quite self-explanatory.</p>
<blockquote><p>install ntp<br />
vi /opt/etc/ntp/ntp.conf</p></blockquote>
<p>Now edit the ntp startup script; there are a few things we need to do to make sure the time is set and maintained correctly.</p>
<blockquote><p>vi /opt/etc/init.d/S77ntp</p></blockquote>
<p>Add the following lines just before the existing call to ntp:</p>
<blockquote><p>/opt/bin/tickadj 10000 &gt; /dev/null<br />
/opt/bin/ntpd -q -c /opt/etc/ntp/ntp.conf &gt; /dev/null</p></blockquote>
<p>The first line corrects the Slug&#8217;s tick value, and the second line makes ntp quickly (-q) set the time using the specified time servers, and exits. It is important to note that when ntp is running, it does not just simply set the correct time regularly; it constantly checks the time against that of the time servers, and gradually brings the system time in line. The call we just added, with the -q flag, ensures that the Slug has pretty accurate time before ntp starts properly.</p>
<p>Speaking of which, you will need to make sure the Slug has accurate time now. This can be done using the web interface, for example. It only needs to be as accurate as you can get it, and ntp will take care of the rest.</p>
<p>Now simply restart ntp:</p>
<blockquote><p>/opt/etc/init.d/S77ntp restart</p></blockquote>
<p>It will take a while for ntp to synchronise with the time servers you specified in the config file, sometimes upwards of 15 minutes &#8211; so don&#8217;t be too concerned if nothing seems to be happening straight away. You can check what&#8217;s going on with the ntpq tool:</p>
<blockquote><p>ntpq -p</p></blockquote>
<p>The command will list information about the time servers. If ntp has decided on a server&#8217;s suitability for synchronisation, the time server&#8217;s name will be preceeded by <strong>*</strong> (the chosen server), <strong>+</strong> (server is suitable), or <strong>-</strong> (server is unsuitable).</p>
<p><strong>Note:</strong> if you are running Dovecot on your Slug, and ntp adjusts the time backwards after you initially set the Slug&#8217;s time (using the web interface), Dovecot will complain about time going backwards, and die. You will need to restart Dovecot; but this only happens while you&#8217;re configuring ntp, and won&#8217;t happen during normal operation once ntp is running.</p>
<p><em>If this information was useful, please leave a comment to let me know!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/time-server-with-ntp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2: SSL and TLS for Postfix and Dovecot</title>
		<link>http://www.nikrivers.com/linksys-nslu2/ssl-and-tls-for-postfix-and-dovecot</link>
		<comments>http://www.nikrivers.com/linksys-nslu2/ssl-and-tls-for-postfix-and-dovecot#comments</comments>
		<pubDate>Wed, 23 Apr 2008 19:21:57 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[tls]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=40</guid>
		<description><![CDATA[If you installed openssh (which is highly recommended, rather than using telnet to connect to your Slug), you already have openssl installed. It can&#8217;t hurt to check though (openssl is a prerequisite for this guide): ipkg install openssl Without going too deeply into SSL or TLS discussion, there are a few things to know. TSL [...]]]></description>
			<content:encoded><![CDATA[<p>If you installed openssh (which is highly recommended, rather than using telnet to connect to your Slug), you already have openssl installed. It can&#8217;t hurt to check though (openssl is a prerequisite for this guide):</p>
<blockquote><p>ipkg install openssl</p></blockquote>
<p>Without going too deeply into SSL or TLS discussion, there are a few things to know. TSL is the successor to SSL, but they&#8217;re both very similar, being protocols for secure communication. We&#8217;ll be using SSL for pop3 and TLS for smtp.</p>
<p>In addition to encryption, SSL and TLS offer the ability to ensure we are communicating with the server we think we are. This is achieved through trust; when we first enter communication with our server, it will send us its certificate. This certificate is signed by a Certification Authority (CA) attesting that the server is who it says it is. Of course, we have to trust the CA&#8217;s word on this, but usually the CA will be someone reputable like <a href="http://www.comodo.com/" target="_blank">Comodo</a> or <a href="http://www.verisign.com/" target="_blank">VeriSign</a>.</p>
<p>But we don&#8217;t need to convince the public we are who we say we are, we only need to make sure that we&#8217;re connecting to our own email server. So we&#8217;ll be acting as our own CA, and signing our own certificate. After all, if you can&#8217;t trust yourself, who <em>can </em>you trust?</p>
<h3>Versions</h3>
<p>This how-to guide was updated in May 2009 for compatibility with the following package versions:</p>
<ul>
<li>Postfix 2.3.6-3</li>
<li>Dovecot v1.2.0.beta1-2</li>
</ul>
<p>This how-to may also work with previous versions, but may require slight changes with respect to paths &#8211; for example, previous versions of Dovecot installed <strong>dovecot.conf</strong> to <strong>/opt/etc/dovecot.conf</strong>, but the latest version installs it to <strong>/opt/etc/dovecot/dovecot.conf</strong>.</p>
<h3>Creating the CA key and certificate</h3>
<p>First of all, let&#8217;s find somewhere to store all our SSL stuff. I chose <strong>/opt/etc/ssl</strong>. Make the directory if it&#8217;s not already there, and <strong>cd</strong> to it. We need to create a few directories and files that openssl expects.</p>
<blockquote><p>mkdir certs crl csr newcerts private<br />
touch index.txt<br />
echo 01 &gt; serial</p></blockquote>
<p>The openssl distribution came with a default configuration file, and we&#8217;re going to edit some of the values, so be sure to back it up first:</p>
<blockquote><p>cp /opt/share/openssl/openssl.cnf /opt/share/openssl/openssl.cnf.orig</p></blockquote>
<p>Now edit the config file:</p>
<blockquote><p>vi /opt/share/openssl/openssl.conf</p></blockquote>
<p>And modify the contents as you see fit. Pay particular attention to the paths; there&#8217;s only a few things you need to change:</p>
<blockquote><p>dir = /opt/etc/ssl<br />
[ policy_match ]<br />
countryName = match<br />
stateOrProvinceName = optional<br />
organizationName = optional<br />
organizationalUnitName = optional<br />
commonName = supplied<br />
emailAddress = optional</p></blockquote>
<p>Save the file, and you are ready to create your own CA private key and certificate with the following command:</p>
<blockquote><p>openssl req -new -x509 -days 3650 -keyout private/cakey.pem -out cacert.pem</p></blockquote>
<p>You&#8217;ll be prompted for a little bit of information; you can leave fields empty to accept the [default], or enter a period to leave the field blank. Note that I edited the default values in the config file.</p>
<blockquote><p>Country Name (2 letter code) [UK]:<br />
State or Province Name (full name) [England]:<br />
Locality Name (eg, city) [London]:<br />
Organization Name (eg, company) []:<br />
Organizational Unit Name (eg, section) []:<br />
Common Name (eg, YOUR name) []:Nik Rivers CA<br />
Email Address []:</p></blockquote>
<p>The important field is Common Name (CN); it is the name of your CA. Once you have entered all the required data, openssl will generate a private key and a certificate. Note that you will be asked for a passphrase; your private key cannot be used by anyone who doesn&#8217;t know this passphrase. You can remove the passphrase if you like &#8211; I chose to do so because I couldn&#8217;t imagine anyone wanting to misuse it, let alone being able to find it in the first place.</p>
<blockquote><p>mv private/cakey.pem private/cakey.pem.orig<br />
openssl rsa -in private/cakey.pem.orig -out private/cakey.pem<br />
rm private/cakey.pem.orig</p></blockquote>
<h3>Creating the mail server key and certificate</h3>
<p>Now simply issue this command to create your mail server certificate signing request:</p>
<blockquote><p>openssl req -newkey rsa:1024 -keyout private/mailserver.key -keyform PEM -out csr/mailserver.csr</p></blockquote>
<p>You&#8217;ll be asked a few familiar questions; this time, answer the questions bearing in mind this is the certificate for your mail server. Of particular importance is the CN field, which should ideally be the fully-qualified hostname of your mail server, such as mail.yourdomain.com. The challenge password and optional company name can be left blank. Now we <em>must</em> remove the passphrase from the mail server key &#8211; since otherwise Dovecot requires the passphrase to be provided in the config file (in plain text) and Postfix just plain won&#8217;t work.</p>
<blockquote><p>mv private/mailserver.key private/mailserver.key.orig<br />
openssl rsa -in private/mailserver.key.orig -out private/mailserver.key<br />
rm private/mailserver.key.orig</p></blockquote>
<p>Finally, sign your request with:</p>
<blockquote><p>openssl ca -in csr/mailserver.csr</p></blockquote>
<p>You will be asked if you want to sign the certificate, and whether you want to commit. Double-check the data, answer yes to both questions, and openssl will dump a load of info in front of you. You can now view your mail server&#8217;s signed certificate with the command:</p>
<blockquote><p>more newcerts/01.pem</p></blockquote>
<p>You can copy and rename the <strong>01.pem</strong> and <strong>cacert.pem</strong> files to something more meaningful if you like, and if you will be using Windows clients to access the email server I recommend changing the file extension from <strong>pem</strong> to <strong>crt</strong>, so that Windows understands the file format:</p>
<blockquote><p>cp newcerts/01.pem certs/mailserver.pem<br />
cp newcerts/01.pem certs/mailserver.crt<br />
cp cacert.pem certs/<br />
cp cacert.pem certs/ca.crt</p></blockquote>
<p>I then removed the certificate signing request.</p>
<blockquote><p>rm csr/mailserver.csr</p></blockquote>
<h3>Configuring Postfix</h3>
<blockquote><p>vi /opt/etc/postfix/main.cf</p></blockquote>
<p>Add this at the bottom of the file:</p>
<blockquote><p># TLS<br />
smtpd_tls_cert_file = /opt/etc/ssl/certs/mailserver.crt<br />
smtpd_tls_key_file = /opt/etc/ssl/private/mailserver.key<br />
smtpd_tls_security_level = may</p></blockquote>
<p>Setting the <strong>smtpd_tls_security_level</strong> parameter to <strong>may</strong> allows clients to connect with or without TLS; we <em>could</em> set this to <strong>encrypt</strong>, which forces the use of TLS, but my testing shows that it prevents other MTAs from being able to relay mail to the Slug.</p>
<p>Restart Postfix:</p>
<blockquote><p>/opt/etc/init.d/S69postfix restart</p></blockquote>
<h3>Configuring Dovecot</h3>
<blockquote><p>vi /opt/etc/dovecot/dovecot.conf</p></blockquote>
<p>Change or add (as appropriate) the following:</p>
<blockquote><p>protocols = pop3s<br />
ssl_disable = no<br />
ssl_cert_file = /opt/etc/ssl/certs/mailserver.crt<br />
ssl_key_file = /opt/etc/ssl/private/mailserver.key</p></blockquote>
<p>Restart Dovecot:</p>
<blockquote><p>/opt/etc/init.d/S90dovecot restart</p></blockquote>
<p>Done.</p>
<h3>Using the certificates</h3>
<p>You have a couple of options. Your email client will probably ask you if you should trust the server&#8217;s certificate now and always, and agreeing to this is good enough.</p>
<p>Or you could install your CA certificate on your computer, which would cause all certificates that you, as a CA, sign &#8211; including your mail server&#8217;s certificate.</p>
<p>In Windows Vista, this is simply a case of right-clicking on the <strong>cakey.crt</strong> file, and selecting <strong>Install Certificate</strong>. The Certificate Import Wizard then guides you through the process &#8211; but when it asks you which certificate store to use, select the <strong>Trusted Root Certification Authorities</strong> store. Now when you open your <strong>mailserver.crt</strong> file Windows will show the certificate as being trusted implicitly since it was issued by you.</p>
<h3>Configuring your mail client</h3>
<p>All you need to do is tell your mail client to use TLS when connecting to the smtp server, and to use SSL over port 995 (pop3s) when connecting to the pop3 server.</p>
<p>For example, in Office Outlook 2007, when editing your mail account, click <strong>More Settings&#8230;</strong> and go to the <strong>Advanced</strong> tab. Under <strong>Incoming server (POP3)</strong> tick <strong>This server requires an encrypted connection (SSL)</strong>. This will automatically change the pop3 port to 995. Under <strong>Outgoing server (SMTP)</strong> change <strong>Use the following type of encrypted connection</strong> to <strong>TLS</strong>. The <strong>Auto</strong> setting will also work, but why make Outlook guess when you can tell it the answer?</p>
<p><em>If this information was useful, please leave a comment to let me know!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/ssl-and-tls-for-postfix-and-dovecot/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2: email with Postfix and Dovecot</title>
		<link>http://www.nikrivers.com/linksys-nslu2/email-with-postfix-and-dovecot</link>
		<comments>http://www.nikrivers.com/linksys-nslu2/email-with-postfix-and-dovecot#comments</comments>
		<pubDate>Tue, 22 Apr 2008 22:42:15 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=38</guid>
		<description><![CDATA[I&#8217;m using Postfix as the mail transport agent (MTA) and Dovecot as the mail delivery agent (MDA), and the mail server will serve just one domain (for now). The domain will be served as a virtual host. This means that the mail users don&#8217;t need their own login account on the server, and additional domains [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Postfix as the mail transport agent (MTA) and Dovecot as the mail delivery agent (MDA), and the mail server will serve just one domain (for now). The domain will be served as a virtual host. This means that the mail users don&#8217;t need their own login account on the server, and additional domains can be served in future with minimal changes.</p>
<p>Many thanks go to Raymond Mentjens (<a href="http://www.mentjens.nl">www.mentjens.nl</a>) for his help in fixing a few (actually, <em>quite</em> a few) errors, and for all his feedback while he followed this article.  He has also created his own guides in Dutch &#8211; so if you read Dutch better than English, you may want to take a look at his site.</p>
<h3>Versions</h3>
<p>This how-to guide was updated in May 2009 for compatibility with the following package versions:</p>
<ul>
<li>Postfix 2.3.6-3</li>
<li>Dovecot v1.2.0.beta1-2</li>
</ul>
<p>This how-to may also work with previous versions, but may require slight changes with respect to paths &#8211; for example, previous versions of Dovecot installed <strong>dovecot.conf</strong> to <strong>/opt/etc/dovecot.conf</strong>, but the latest version installs it to <strong>/opt/etc/dovecot/dovecot.conf</strong>.</p>
<h3>Install Postfix</h3>
<p>Issue the command:</p>
<blockquote><p>ipkg install postfix</p></blockquote>
<p>The Postfix installation automatically creates a new group called maildrop; check maildrop is created:</p>
<blockquote><p>more /etc/group</p></blockquote>
<p>If the group is not there, you will have to create it yourself. Also note that it might suddenly disappear, requiring you to add it manually. For both eventualities, see the notes below.</p>
<p>Now we&#8217;ll need to start editing the configuration files to customise Postfix to our needs.</p>
<blockquote><p>vi /opt/etc/postfix/master.cf</p></blockquote>
<p>Add -v to the end of the line that specifies the smtp daemon so it reads <strong>smtpd -v</strong> (the line you need to modify is the first in the table, just beneath several lines of comments). This enables verbose output to the log file, which you should monitor in a separate PuTTY window using the following command:</p>
<blockquote><p>tail -f /var/log/messages</p></blockquote>
<p>This will help give you an idea of when and why problems occur. Note that tail sometimes hangs, and if you don&#8217;t see log output when you think you should then it may be time to abort tail (with CTRL+C) and restart it.</p>
<p>Let&#8217;s edit the main Postfix configuration file:</p>
<blockquote><p>vi /opt/etc/postfix/main.cf</p></blockquote>
<p>And provide our own values for the following parameters:</p>
<blockquote><p>myhostname = &lt;your slug&#8217;s host name &#8211; eg. mail.yourdomain.com&gt;<br />
inet_interfaces = all<br />
proxy_interfaces = &lt;your external ip address&gt;<br />
mynetworks_style = subnet</p></blockquote>
<p>Before Postfix can be started, it needs to know where to deliver mail that is addressed to users such as root, postmaster, and other pseudo-accounts. The file that contains this mapping is /opt/etc/postfix/aliases. Edit the file:</p>
<blockquote><p>vi /opt/etc/postfix/aliases</p></blockquote>
<p>Uncomment the root alias, and provide the address where mail to root should be delivered (using your own address is a wise choice):</p>
<blockquote><p># Person who should get root&#8217;s mail. Don&#8217;t receive mail as root!<br />
root: &lt;your email address&gt;</p></blockquote>
<p>Now the file should be copied to <strong>/opt/etc/aliases</strong>, and turned into a hash file that postfix can read, using the <strong>newaliases</strong> tool. The output file is <strong>/opt/etc/aliases.db</strong>:</p>
<blockquote><p>cp /opt/etc/postfix/aliases /opt/etc/aliases<br />
newaliases</p></blockquote>
<p>Now start Postfix, keeping an eye on your second PuTTY window for any messages Postfix might emit.</p>
<blockquote><p>/opt/etc/init.d/S69postfix</p></blockquote>
<p>At various points you&#8217;ll need to change Postfix configuration, and Postfix will need to reload those changes. You can do this with:</p>
<blockquote><p>/opt/etc/init.d/S69postfix restart</p></blockquote>
<p>Or, if you don&#8217;t like to keep stopping and starting it, you can simply issue:</p>
<blockquote><p>postfix reload</p></blockquote>
<h3>Testing Postfix</h3>
<p>Use telnet to connect to your slug&#8217;s smtp port:</p>
<blockquote><p>telnet &lt;slug&#8217;s host name or IP address&gt; smtp</p></blockquote>
<p>Make sure you can send mail, by having the following conversation with Postfix:</p>
<blockquote><p>220 mail.yourdomain.com ESMTP Postfix<br />
mail from:some_user<br />
250 2.1.0 Ok<br />
rcpt to:&lt;an external email address you can check&gt;<br />
250 2.1.5 Ok<br />
data<br />
354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<br />
Subject:Test Mail 1<br />
This is a test message.<br />
.<br />
250 2.0.0 Ok: queued as EF7E4208003</p></blockquote>
<p>When you check the email address to which you sent your test mail, you&#8217;ll see it comes from some_user@mail.localdomain (or something similar, according to what you put in your postfix configuration file), and is generally badly formed. Don&#8217;t worry, a proper email client will provide the necessary data, whereas we only provided the bare minimum. Note that some mail servers may reject this test mail because the sender&#8217;s address is malformed (i.e. the domain doesn&#8217;t exist). In this case, you will need to use a valid-looking email address (such as some_user@test.com) or even your own address.</p>
<p>If you don&#8217;t receive the test email, you can check the postfix queue to see whether an error occured:</p>
<blockquote><p>postqueue -p</p></blockquote>
<p>And also delete any failed/stuck messages:</p>
<blockquote><p>postsuper -d &lt;queue_id&gt;</p></blockquote>
<p>On a side note, it&#8217;s a good demonstration of how easy it is to send untraceable spam. The IP address in the email header is the only indication of where the email originated; but this can be faked quite easily.</p>
<h3>Finalise Postfix Configuration</h3>
<p>There&#8217;s already a convenient user and group (both called mail) configured by the system which Postfix can use to manage the mail store, so all we need to do it find out the uid and gid.</p>
<blockquote><p>grep mail /etc/passwd</p></blockquote>
<p>The 3rd and 4th elements of the output are the uid and gid respectively. Write them down; we&#8217;ll need them in a minute.</p>
<p>We need a disk location for storing users&#8217; mail; I chose <strong>/var/spool/vmail</strong>, which seems as good as any. The following script creates the initial directory structure, along with the additional directories for user@yourdomain.com mail storage. The <strong>/var/spool</strong> directory didn&#8217;t exists on my system, so rather than checking to see if there was a more logical/suitable storage location elsewhere, I simply created it with brute force.</p>
<blockquote><p>mkdir /var/spool<br />
cd /var/spool<br />
mkdir vmail<br />
cd vmail<br />
mkdir yourdomain.com<br />
cd yourdomain.com<br />
mkdir user<br />
cd user<br />
mkdir new cur tmp</p></blockquote>
<p>Now the new directories need the right owners and permissions: <strong>root</strong> owns <strong>/var/spool</strong> (and gives full permission to everyone), whereas the <strong>vmail</strong> directory (and everything within it) is owned by <strong>mail</strong>, and only <strong>mail</strong> (and members of the <strong>mail</strong> group) have permissions.</p>
<blockquote><p>chmod ugo=rwx /var/spool<br />
chown -R mail:mail /var/spool/vmail<br />
chmod -R ug=rwx,o= /var/spool/vmail</p></blockquote>
<p>You can double-check this afterwards:</p>
<blockquote><p>ls -l -R /var/spool/vmail | more</p></blockquote>
<p>In order to use Dovecot&#8217;s SMTP AUTH mechanism, Postfix needs to know where Dovecot&#8217;s daemon socket is located. Currently it isn&#8217;t located anywhere, so that needs to be fixed:</p>
<blockquote><p>cp /opt/var/spool/postfix/private/anvil /opt/var/spool/postfix/private/auth<br />
chmod go=rw /opt/var/spool/postfix/private/auth<br />
chown mail:mail /opt/var/spool/postfix/private/auth</p></blockquote>
<p>Time to edit the postfix config again.</p>
<blockquote><p>vi /opt/etc/postfix/main.cf</p></blockquote>
<p>The config file isn&#8217;t set up with default values for virtual hosts, so these need to be added. We also tell Postfix that we&#8217;re using Dovecot for SMTP AUTH, and point it to the socket location we just created (relative to the queue directory). Note that as soon as we tell Postfix about the socket, it will grumble and complain (and fail to run) because Dovecot hasn&#8217;t created the socket yet. We&#8217;ll do that shortly.</p>
<blockquote><p># LOCAL CONFIG<br />
local_recipient_maps = $virtual_mailbox_maps<br />
# SMTP AUTH<br />
smtpd_sasl_type = dovecot<br />
smtpd_sasl_path = private/auth<br />
# VIRTUAL HOSTS<br />
# Config for virtual domains that are hosted by this server.<br />
virtual_mailbox_domains = /opt/etc/postfix/virtual-hosts<br />
virtual_mailbox_base = /var/spool/vmail<br />
virtual_mailbox_maps = hash:/opt/etc/postfix/virtual-maps<br />
virtual_uid_maps = static:&lt;mail uid&gt;<br />
virtual_gid_maps = static:&lt;mail gid&gt;<br />
virtual_minimum_uid = &lt;mail uid&gt;</p></blockquote>
<p>Replace <strong>&lt;mail uid&gt;</strong> and <strong>&lt;mail gid&gt;</strong> with the uid and gid you noted earlier on.</p>
<p>Now we are left with two files to create. The file <strong>/opt/etc/postfix/virtual-hosts</strong> should contain a list of all the domains you are hosting, one on each line. The file <strong>/opt/etc/postfix/virtual-maps</strong> defines the storage location for your mail users.</p>
<p>virtual-hosts:</p>
<blockquote><p>yourdomain.com</p></blockquote>
<p>virtual-maps:</p>
<blockquote><p>you@yourdomain.com yourdomain.com/you/<br />
me@yourdomain.com yourdomain.com/me/</p></blockquote>
<p>The second column is the storage path, relative to <strong>$virtual_mailbox_base</strong>. So mail for you@yourdomain.com will be stored in <strong>/var/spool/vmail/yourdomain.com/you</strong>. The trailing slash in the file is important, and specifies that the Maildir format of mail storage is to be used, as opposed than mbox. Maildir stores each mail as a separate file, which makes more sense to me than mbox, which stores all mail in one file.</p>
<p>We now turn <strong>/opt/etc/postfix/virtual-maps </strong>into a hash file, and give Postfix read permission:</p>
<blockquote><p>postmap /opt/etc/postfix/virtual-maps<br />
chmod o+r /opt/etc/postfix/virtual-maps.db</p></blockquote>
<p>You can now restart the server so your changes take effect, but bear in mind that the <strong>smptd</strong> process will crash if you try to connect to it &#8211; because the Dovecot socket doesn&#8217;t exist yet.</p>
<blockquote><p>/opt/etc/init.d/S69postfix restart</p></blockquote>
<h3>Install Dovecot</h3>
<blockquote><p>ipkg install dovecot</p></blockquote>
<p>First, a warning: Dovecot caused more trouble than anything I&#8217;ve done with the Slug so far. It&#8217;s easier to configure than Postfix, but easier to mess up, too!</p>
<p>For starters, you will definitely want to edit the Dovecot config to turn logging on:</p>
<blockquote><p>vi /opt/etc/dovecot/dovecot.conf</p></blockquote>
<p>At the start of the file insert the following parameters (we&#8217;ll be removing them again later):</p>
<blockquote><p>log_path = /var/log/dovecot<br />
info_log_path = /var/log/dovecot<br />
auth_debug = yes<br />
auth_verbose = yes</p></blockquote>
<p>Let&#8217;s tell Dovecot where mail can be found. Edit the mail_location parameter as follows. This tells Dovecot that mail for you@yourdomain.com can be found at <strong>/var/spool/vmail/yourdomain.com/you</strong>. Note that in older versions of Dovecot this setting was default_mail_env.</p>
<blockquote><p>mail_location = maildir:/var/spool/vmail/%d/%n</p></blockquote>
<p>Now we want to tell Dovecot about the STMP AUTH socket it needs to create. Find the auth default configuration block (about 80% of the way through the file) and add/edit the following configuration block inside the auth default block.</p>
<blockquote><p>socket listen {<br />
client {<br />
path = /opt/var/spool/postfix/private/auth<br />
mode = 0660<br />
user = mail<br />
group = mail<br />
}<br />
}</p></blockquote>
<p>This tells Dovecot what we&#8217;ve already told Postfix &#8211; now Dovecot knows to create the auth socket, and put it in the right location. We now need to tell Dovecot which users are allowed to use our SMTP server and where it can find their passwords. The relevant sections, <strong>passdb</strong> and <strong>userdb</strong>, already exist in the auth default block, and should be edited as follows.</p>
<blockquote><p>passdb passwd-file {<br />
args = /etc/passwd-mail<br />
}</p></blockquote>
<blockquote><p>userdb static {<br />
args = uid=&lt;mail uid&gt; gid=&lt;mail gid&gt;<br />
}</p></blockquote>
<p>The passdb section tells Dovecot to use a passwd-like file located at <strong>/etc/passwd-mail</strong> to check users&#8217; passwords. The userdb section is usually used in a similar way to look up valid email users &#8211; but since we don&#8217;t need another look up, we can use the &#8216;static&#8217; mechanism, in which case Dovecot will rely on the passdb section for both valid users AND passwords.</p>
<p>Don&#8217;t forget to replace <strong>&lt;mail uid&gt;</strong> and <strong>&lt;mail gid&gt;</strong> with the uid and gid of your mail user and group. If your uid is less than 500 (which, if you used the built-in mail account, it is) you will need to change the <strong>first_valid_uid </strong>value in the config file to something less than or equal to the uid you are using.</p>
<p>The last thing involving the configuration file is to tell Dovecot which protocol we want clients to be able to use. By default, Dovecot supports only IMAP &#8211; but I prefer POP3.</p>
<blockquote><p>#protocols = imap imaps<br />
protocols = pop3</p></blockquote>
<p>IMAP has some significant <a href="http://en.wikipedia.org/wiki/IMAP#Advantages_over_POP3" target="_blank">advantages</a> over POP3, providing an Exchange-like environment for email, but it also has its <a href="http://en.wikipedia.org/wiki/IMAP#Disadvantages_of_IMAP" target="_blank">disadvantages</a>. If you&#8217;re happy to store all your email locally, you&#8217;re only going to connect from a single client, and prefer ISP-like email, the more common POP3 should be just fine.</p>
<p>Now we need to create the passwd-like lookup file.</p>
<blockquote><p>vi /etc/passwd-mail</p></blockquote>
<p>It&#8217;s content will be of the format &lt;username&gt;:{encryption_scheme}password, for example:</p>
<blockquote><p>you@yourdomain.com:{plain}yourpassword</p></blockquote>
<p>The {plain} directive denotes that the password is in plain text; this overrides whatever encryption Dovecot might be expecting &#8211; DES in this case (the same as you&#8217;d find in /etc/passwd). If you DES-encrypt your password before putting it in <strong>/etc/passwd-mail</strong> you do not need an {encryption_scheme} directive.</p>
<p>By default, the dovecot-auth process runs as user admin, which is a member of the group administrators. You can change this by editing dovecot.conf, but it is not necessary. The admin user needs read privileges on the mail password file, so give this permission to the group to which user admin belongs:</p>
<blockquote><p>chown root:administrators /etc/passwd-mail<br />
chmod g=r /etc/passwd-mail</p></blockquote>
<p>Now you&#8217;re ready to start Dovecot. You may like to open a separate session on your Slug and run <strong>tail -f /var/log/dovecot</strong> to monitor what&#8217;s going on:</p>
<blockquote><p>/opt/etc/init.d/S90dovecot start</p></blockquote>
<p>If this produces errors, double-check the edits you made to /opt/etc/dovecot/dovecot.conf &#8211; a common problem is the mismatching of curly braces { and }.</p>
<h3>Testing Dovecot</h3>
<p>Now use telnet to connect to Dovecot on your slug:</p>
<blockquote><p>telnet &lt;slug&#8217;s host name or IP address&gt; pop3</p></blockquote>
<p>You can have the following conversation with it:</p>
<blockquote><p>+OK Dovecot ready.<br />
user you@yourdomain.com<br />
+OK<br />
pass wrongpassword<br />
-ERR Authentication failed.<br />
user you@yourdomain.com<br />
+OK<br />
pass yourpassword<br />
+OK Logged in.</p></blockquote>
<p>Great. You now have a working email server which offers SMTP without being an open relay, and provides POP3 to the user(s) you specified.</p>
<p>If Dovecot crashes when you authenticate, and logs &#8220;<em>Panic: POP3(you@yourdomain.com): Trying to allocate 0 bytes</em>&#8220;, you have found a kown bug with the Dovecot 1.2 beta 1 release (the latest release that is available through ipkg). Although this doesn&#8217;t prevent you from using Dovecot, most email clients will complain that the connection to the POP3 server was prematurely terminated. A patch is available at <a href="http://hg.dovecot.org/dovecot-1.2/rev/22d70947597c">http://hg.dovecot.org/dovecot-1.2/rev/22d70947597c</a>, but I have not had a chance to try it.</p>
<h3>Finally</h3>
<p>Don&#8217;t forget to turn off verbose logging for Postfix and Dovecot. For Postfix, remove the &#8216;-v&#8217; smtpd parameter from /opt/etc/postfix/master.cf, and for Dovecot remove the first four lines of /opt/etc/dovecot/dovecot.conf (log_path, info_path, auth_debug and auth_verbose).</p>
<h3>Limitations</h3>
<p>The one big limitation with this set up is that the administration of mail users involves a lot of work. Every time you add a user you must create the relevant entry in virtual-maps, create the user&#8217;s mail delivery directory structure, and set permissions. The mitigation against this drawback is that you (probably) won&#8217;t be using your Slug as a mail server for more than a handful of email addresses &#8211; any heavier use would probably require a more significant investment, and hence more powerful tools.</p>
<h3>Notes</h3>
<p><strong>Group &#8216;maildrop&#8217; disappears</strong><br />
It seems that, at some point, the maildrop group &#8216;disappears&#8217; from <strong>/etc/group</strong>. It may be something to do with the fact that <strong>/etc/group</strong> is a symbolic link to <strong>/share/flash/conf/group</strong>, and thus may be more closely-managed by the Slug than it appears. Regardless, it causes SMTP clients to be unable to connect (because Postfix fails to start), and Postfix emits an appropriate message to <strong>/var/log/message</strong>.</p>
<p>This can be resolved by manually recreating the appropriate entry in <strong>/etc/group </strong>for maildrop:</p>
<blockquote><p>maildrop:x:69:</p></blockquote>
<p>Fortunately, it seems that this is only required once.</p>
<p><strong>Using your ISP&#8217;s SMTP server</strong><br />
Some ISPs may require that any email you send is relayed through their SMTP server; in this case you will likely need to add the <em>relayhost</em> parameter to your <strong>main.cf</strong> as well (although this wasn&#8217;t necessary in my case). Documentation for this parameter can be found on the Postfix website at <a href="http://www.postfix.org/postconf.5.html#relayhost" target="_blank">http://www.postfix.org/postconf.5.html#relayhost</a>. Explicit authentication with your ISP&#8217;s SMTP server is usually not required as long as you are connected to the Internet via that ISP&#8217;s connection (either dial-up or always-on).</p>
<p><strong>Encryption of stored passwords</strong><br />
When installing and configuring Dovecot, I store email users&#8217; passwords in plain text. If you want to store passwords in an encrypted format, see <a href="http://wiki.dovecot.org/Authentication/PasswordSchemes">http://wiki.dovecot.org/Authentication/PasswordSchemes</a> for an explanation.</p>
<h3>Next Steps</h3>
<p><strong>Firewall</strong><br />
If you have a firewall or NAT between your Slug and the outside world (which is highly recommended) and you want to access your email from anywhere, you will need to configure your firewall or NAT to forward ports 25 (smtp) and 110 (pop3) to your Slug.</p>
<p>Of course, if you open up your email server to the rest of the world, you may want to make sure it can&#8217;t be abused. Go to <a href="http://www.abuse.net/relay.html">http://www.abuse.net/relay.html</a>, provide your external IP address, and let it test your email server for being an open relay.</p>
<p><strong>Date/Time</strong><br />
It&#8217;s a good idea to keep your Slug&#8217;s time accurate so that the mail server can timestamp email correctly. This can be done by running an NTP client, which will synchronise the Slug&#8217;s time with reliable time servers around the world, or by running an NTP server, which will synchronise the Slug&#8217;s time AND allow you to synchronise your network computers&#8217; time with the Slug.</p>
<p>Due to a glitch in the Slug, this isn&#8217;t as straight-forward as it could be &#8211; but it&#8217;s not beyond anyone with enough patience to work with vi.</p>
<p>Detailed instructions are <a href="http://www.nikrivers.com/linksys-nslu2/time-server-with-ntp">here</a>.</p>
<p><strong>SSL/TLS</strong><br />
These instructions give you a working email server, but all authentication is performed using plain text. That means that anyone using a network sniffer in the right place at the right time could steal your usernames and passwords as you transmit them to the server.</p>
<p>Rather than configure authentication mechanisms that prevent this (and which, to be honest, look difficult to configure), we can encrypt the whole of the communication between client and server using SSL and TLS.</p>
<p>Detailed instructions are <a href="http://www.nikrivers.com/linksys-nslu2/ssl-and-tls-for-postfix-and-dovecot">here</a>.</p>
<h3>Useful Links</h3>
<p><a href="http://www.postfix.org/">http://www.postfix.org/</a><br />
<a href="http://www.dovecot.org/">http://www.dovecot.org/</a><br />
<a href="http://www.nslu2-linux.org/">http://www.nslu2-linux.org/</a><br />
<a href="http://www.howtoforge.com/linux_postfix_virtual_hosting">http://www.howtoforge.com/linux_postfix_virtual_hosting</a><br />
<a href="http://www.howtoforge.com/linux_postfix_virtual_hosting_2">http://www.howtoforge.com/linux_postfix_virtual_hosting_2</a></p>
<p><em>If this information was useful, please leave a comment to let me know!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/email-with-postfix-and-dovecot/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2: enabling SSH access</title>
		<link>http://www.nikrivers.com/linksys-nslu2/enabling-ssh-access</link>
		<comments>http://www.nikrivers.com/linksys-nslu2/enabling-ssh-access#comments</comments>
		<pubDate>Tue, 22 Apr 2008 19:49:53 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=37</guid>
		<description><![CDATA[After unslinging your Slug, you should install openssh. This will allow you to connect securely (as opposed to using an unencrypted Telnet connection), and you won&#8217;t need to re-enable Telnet access every time your Slug reboots. Installation is very simple: ipkg install openssh This will also install and configure openssl, and generate the necessary key [...]]]></description>
			<content:encoded><![CDATA[<p>After unslinging your Slug, you should install openssh. This will allow you to connect securely (as opposed to using an unencrypted Telnet connection), and you won&#8217;t need to re-enable Telnet access every time your Slug reboots.</p>
<p>Installation is very simple:</p>
<blockquote><p>ipkg install openssh</p></blockquote>
<p>This will also install and configure openssl, and generate the necessary key and certificate files to enable encrypted connections.</p>
<p>If you don&#8217;t already have an SSH client you can download PuTTY for free from <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank">http://www.chiark.greenend.org.uk/~sgtatham/putty/</a>.</p>
<p>Once you have successfully connected using PuTTY and SSH, you can turn off Telnet access to your Slug.</p>
<p><em>If this information was useful, please leave a comment to let me know!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/enabling-ssh-access/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2</title>
		<link>http://www.nikrivers.com/linksys-nslu2</link>
		<comments>http://www.nikrivers.com/linksys-nslu2#comments</comments>
		<pubDate>Tue, 22 Apr 2008 18:58:23 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=35</guid>
		<description><![CDATA[About the NSLU2 The Linksys NSLU2 is a lovely little NAS storage server with 2 USB ports and an Ethernet LAN port. You can attach two USB hard drives to it and connect it to your network, and use it as a file server. Or you can download alternative firmware, run a customised version of [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 206px"><img title="Linksys NSLU2" src="http://ecx.images-amazon.com/images/I/4127FqymOSL._SL500_AA280_.jpg" alt="Linksys NSLU2" width="196" height="196" /><p class="wp-caption-text">Linksys NSLU2</p></div>
<h3>About the NSLU2</h3>
<p>The Linksys NSLU2 is a lovely little NAS storage server with 2 USB ports and an Ethernet LAN port. You can attach two USB hard drives to it and connect it to your network, and use it as a file server.</p>
<p>Or you can download alternative firmware, run a customised version of Linux on it, and use it as a mail server, a torrent server, a print server, a web server, and more.</p>
<p>It supports NTFS, USB hubs, and flash drives. It&#8217;s silent, draws no more than 10W of power, runs at 266MHz, and is the size of two Weetabix.</p>
<p>And it&#8217;s known as a Slug.</p>
<p>Full details, including the data sheet, user guide and firmware, can be found over at the <a href="http://www.linksys.com/servlet/Satellite?c=L_Product_C2&amp;childpagename=US/Layout&amp;cid=1118334819312&amp;pagename=Linksys/Common/VisitorWrapper&amp;lid=1931222279B14">Linksys website</a>, and some information is available at <a href="http://en.wikipedia.org/wiki/NSLU2">Wikipedia</a>.</p>
<p>The NSLU2 is now discontinued, but don&#8217;t let that put you off &#8211; this will only really affect you if you need to return your Slug for replacement under warranty. Flashing your firmware voids the warranty (as does making hardware modifications, which a lot of users seem to do), so its discontinuation seems hardly relevant.</p>
<p>Opinion seems to be divided on this issue, with a few differing viewpoints given on Paul Hutchinson&#8217;s <a href="http://paulhutch.com/wordpress/?p=266">blog</a>. Regardless, I predict the NSLU2 will maintain a cult following of users and developers for quite some time.</p>
<h3>Where to buy</h3>
<p><span style="text-decoration: line-through;">These things aren&#8217;t particularly easy to get hold of in the UK at a decent price, but LambdaTek has them </span><a href="http://www.lambda-tek.com/componentshop/index.pl?origin=gbase6.3&amp;prodID=960362"><span style="text-decoration: line-through;">available</span></a><span style="text-decoration: line-through;"> at around £70, although at dwindling stock levels.</span></p>
<p><span style="text-decoration: line-through;">Or, if you&#8217;re in the market for a second-hand Slug, I have a spare for which I cannot find a use; I&#8217;m more than happy to consider offers on it. It&#8217;s the 266MHz version (as opposed to the 133MHz version) and has a UK power supply. For use outside the UK, a travel adapter should be fine since the power supply is auto-switching, or a generic 5V-2A power supply would do the trick.</span></p>
<p>The Linksys NSLU2 is no longer available &#8211; it seems all retailers have run down their stocks.  You might be lucky on eBay, but if you don&#8217;t own one already I recommend you find an alternative.</p>
<h3>Finding more help</h3>
<p>The NSLU2 community is at <a href="http://www.nslu2-linux.org">www.nslu2-linux.org</a>, where there&#8217;s a LOT of information. However, it&#8217;s a community built on voluntary user contribution, so the information is sometimes incomplete, outdated, or otherwise inaccurate. There&#8217;s also a lot of information about the available packages out there on the Internet, but it doesn&#8217;t necessarily relate to the NSLU2 and often assumes you will be using packages that simply aren&#8217;t available to you.</p>
<p>The <a href="http://www.nslu2-linux.org/wiki/Unslung/HomePage">Unslung</a> firmware is the first custom firmware that most users try. The binary download, which also contains all the information you need to get started, can be found at <a href="http://www.slug-firmware.net/">www.slug-firmware.net</a>.</p>
<p>Getting the Unslung firmware up and running on my Slug was relatively easy. However, finding the information I needed to configure certain software packages proved more difficult, even though the actual installation of each package was quite simple.</p>
<p>In order to document my Slug&#8217;s configuration and to provide a reference point to others, I have created step-by-step NSLU2 instructions for the following tasks:</p>
<ul>
<li><a href="http://www.nikrivers.com/linksys-nslu2/enabling-ssh-access">Enabling SSH access</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/email-with-postfix-and-dovecot">Setting up an email server using Postfix and Dovecot</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/time-server-with-ntp">Setting up an NTP server using ntp</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/print-server-with-cups">Setting up a print server using CUPS</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/ssl-and-tls-for-postfix-and-dovecot">Configuring SSL and TLS for Postfix and Dovecot</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
