<?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>tolaris.com &#187; ubuntu</title>
	<atom:link href="http://www.tolaris.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tolaris.com</link>
	<description>When the going gets tough, the tough sniff packets.</description>
	<lastBuildDate>Wed, 08 Sep 2010 10:20:44 +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>Remmina, the last remote desktop client you&#8217;ll ever need</title>
		<link>http://www.tolaris.com/2010/08/20/remmina-the-last-remote-desktop-client-youll-ever-need/</link>
		<comments>http://www.tolaris.com/2010/08/20/remmina-the-last-remote-desktop-client-youll-ever-need/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 22:43:29 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1003</guid>
		<description><![CDATA[I&#8217;ve been searching for a good remote desktop client for a long time. My requirements are simple. It must: save passwords manage connections via the GUI support VNC and RDP work with our IP KVM This last requirement is the kicker. When I change hosts on our Adderview IP KVM, it draws one frame at [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been searching for a good remote desktop client for a long time. My requirements are simple. It must:</p>
<ol>
<li>save passwords</li>
<li>manage connections via the GUI</li>
<li>support VNC and RDP</li>
<li>work with our IP KVM</li>
</ol>
<p>This last requirement is the kicker. When I change hosts on our <a href="http://www.adder.com/uk/products/adderviewip.aspx">Adderview IP KVM</a>, it draws one frame at 0&#215;0 resolution, and then changes to the resolution of the new host. This has crashed every VNC client I&#8217;ve tried except <a href="http://packages.ubuntu.com/lucid/xvnc4viewer">xvnc4viewer</a>. Which of course, doesn&#8217;t save passwords or have a GUI (the raw X menu when you press F8 does not count).</p>
<p>I have tried <a href="http://en.wikipedia.org/wiki/KRDC">KRDC</a>, <a href="http://projects.gnome.org/vinagre/">Vinagre</a>, <a href="http://www.tightvnc.com/download-old.php">xtightvncviewer</a>, and a number of simpler command-line VNC clients. They all seem to be designed to support the &#8220;my Mom needs tech support&#8221; problem, not the &#8220;I manage remote servers&#8221; problem. KRDC won&#8217;t even login to my KVM; it just hangs after authentication. I suppose that&#8217;s better than crashing, but it is still a show stopping bug for me.</p>
<p><span id="more-1003"></span>Over a year ago, I hacked up a scripted solution involving zenity GTK dialogs, saved password files, and xvnc4viewer, but I&#8217;m not going to release that. Instead, meet the last remote desktop client you&#8217;ll ever need: <a href="http://remmina.sourceforge.net/">Remmina</a>.</p>
<p>Remmina meets all of my requirements, has tons of useful features, and works flawlessly. Not only that, it is extremely responsive. Key presses are limited only by the round-trip time, with no added delay from VNC itself. There are no redrawing or tearing problems. It supports full-screen mode and scrolling inside a view port. It can forward over SSH and will use SSH keys files or your SSH key agent. It can synchronise the clipboard between host and remote server; this is the first time I&#8217;ve actually seen that feature work reliably. It can even open a standard SSH or SFTP session, or host a VNC server.</p>
<p>Installation is easy. An older release is available in the Ubuntu Lucid Universe repository, or get the latest version from their <a href="http://remmina.sourceforge.net/downloads.shtml">PPA</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/08/20/remmina-the-last-remote-desktop-client-youll-ever-need/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upgrading from Kubuntu 9.10 to 10.04</title>
		<link>http://www.tolaris.com/2010/08/04/upgrading-from-kubuntu-9-10-to-10-04/</link>
		<comments>http://www.tolaris.com/2010/08/04/upgrading-from-kubuntu-9-10-to-10-04/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 20:39:36 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=967</guid>
		<description><![CDATA[Last week I upgraded from Kubuntu 9.10 &#8220;Karmic Koala&#8221; to 10.04 &#8220;Lucid Lynx&#8221;. The word &#8220;upgrade&#8221; here is misleading, since I chose to reformat to take advantage of filesystem changes. However, I imported much of my customisations from backup. Here are my notes on Lucid, from the perspective of a long-time Kubuntu user. My opinion [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I upgraded from Kubuntu 9.10 &#8220;Karmic Koala&#8221; to 10.04 &#8220;Lucid Lynx&#8221;. The word &#8220;upgrade&#8221; here is misleading, since I chose to reformat to take advantage of filesystem changes. However, I imported much of my customisations from backup. Here are my notes on Lucid, from the perspective of a long-time Kubuntu user.</p>
<p><span id="more-967"></span>My opinion is that Lucid improves on <a href="/2009/11/01/upgrading-from-kubuntu-9-04-to-9-10/">Karmic</a> in almost every way. That&#8217;s not saying much, since the KDE 4 upgrade has been so painful. We&#8217;re finally back to KDE 3.5 functionality, and speed is improving with each release. On the other hand, there are a lot of new features in the OS since Hardy &#8211; grub2, ext4, ecryptfs, upstart, kernel mode setting, compositing window management, Strigi indexing and Nepomuk semantic desktop. Some of these have dramatically improved performance, while others have increased system requirements just to add eye candy. It&#8217;s hard to evaluate KDE on its own, so I&#8217;m not going to focus on that.</p>
<p>I backed up my entire drive to an external USB drive formatted for ext3 using <a href="/tag/rsync/">rsync</a>. I then booted from the Kubuntu 10.04 AMD64 Desktop CD, and followed the default install options until the disk partitioning step. I always install with separate /, /home, and swap partitions (this normally makes upgrades easier, unless you are reformatting as I did here). I used ext4 for / and /home, and chose to encrypt my home directory. I then followed the rest of the steps and rebooted at the end.</p>
<p>Following the reboot, I used rsync to restore my lost files and most of my dotfiles &#8211; .mozilla, .gnome, .gconf, .Virtualbox, and the like. However, I did not restore .kde. Instead I manually copied only some configs, for KGPG, Akregator, and Kopete. The rest of my KDE apps I reconfigured from scratch. I did this because we use Kolab at work, which integrates with Kontact but can be fussy with local contacts files. As of Lucid, Kontact uses Akonadi to manage contacts. I expected trouble, and found it. More on that later.</p>
<p>Finally, since I have an encrypted home directory, I also encrypted swap and created a tmpfs on /tmp. I followed the steps in <a href="/2009/11/14/securing-laptops-with-ecryptfs-cryptsetup-and-tmpfs/">my guide</a>, and rebooted with no problems.</p>
<p>What&#8217;s better:</p>
<p>The <strong>ext4</strong> filesystem is noticeably faster. This is the reason I reformatted instead of upgrading. I used ext3 under Karmic, and really wanted to see if what I&#8217;d been hearing about the speedy new filesystem is true. It is. It&#8217;s faster for booting and it&#8217;s faster for reading large data. My Virtualbox virtual machines load in almost half the time, even compared to the same Virtualbox 3.2.6 release on Karmic. I suppose there could be other differences contributing to this but it really stands out. I haven&#8217;t run an fsck yet but others report that it is much faster as well.</p>
<p>ext4 has definitely improved performance of copying data inside my encrypted home directory. I barely notice the performance hit from using ecryptfs now. The only time I do is when using rsync to compare large directories (like when my backup process examines my mail archive).</p>
<p>There is a new <strong>touchpad control</strong> in KDE Control Center. This enables gestures, including two-finger scrolling (but not pinch-to-zoom, which I hope is forthcoming), and different actions for tapping in corners, multi-finger tapping, and so on. Still missing is tap suppression (accidentally tapping while typing), so I still use syndaemon. Create ~/.kde/Autostart/syndaemon.sh, make it executable, and insert:</p>
<pre>#!/bin/sh
# Disable touchpad while typing to prevent accidental tapping.
/usr/bin/syndaemon -d -t -i 1</pre>
<p>The <strong>device notifier plasmoid</strong> now has multiple actions when opening attached storage devices, and can be configured to automatically mount drives. This is a vast improvement.</p>
<p>The <strong>system tray plasmoid</strong> now obeys my auto-hide preferences. Under Jaunty and Karmic, some applications had overriding preferences that caused them to always be hidden or visible. For instance, it was impossible to make KGPG always visible. I frequently use KGPG, so this caused me to almost always have the system tray expanded to show all applications.</p>
<p><strong>Firefox/KDE integration</strong> works very well. Open/save file dialogs use KDE, and menus and icons use KDE defaults. The printer dialog is still the native Firefox one.</p>
<p><strong>virt-manager</strong> is vastly improved. The GUI is more responsive when connecting, is prettier, and has graphs for CPU, disk, and network I/O.</p>
<p><strong>ClusterSSH</strong> works with KWin again. Since 8.10, <a href="http://sourceforge.net/projects/clusterssh/">ClustterSSH</a> has been nearly broken in KDE. First, simply starting it caused copy (to clipboard or selection) to stop working in most QT/KDE apps. Second, the ClusterSSH master window would grab focus and prevent you from giving focus to any of its children xterms. This made it very hard to run commands on just one host without running it on all. I gave up and used various other techniques for managing my servers. But nothing beats ClusterSSH for managing 2-20 servers at once, and I&#8217;ve sorely missed it. Welcome back, old friend!</p>
<p>What needed tweaking:</p>
<p>The <strong>Oxygen</strong> window decoration theme still doesn&#8217;t colourise the active window. Open System Settings, go to &#8220;Appearance&#8221;, then the &#8220;Windows&#8221; side bar.  Under the &#8220;Window Decoration&#8221; tab, choose &#8220;Oxygen&#8221;.  Under the &#8220;Decoration Options&#8221; area, choose the &#8220;Fine Tuning&#8221; sub-tab. Check &#8220;Outline active window title&#8221;.</p>
<p><strong>Hotkeys in Kmenu</strong> are ignored. I use a few quick-launch shortcuts, such as &#8220;Win+T&#8221; to start a terminal. You can set these when editing the K menu, but they are <a href="http://kubuntuforums.net/forums/index.php?topic=3110677.0">ignored by default</a>. Open System Settings, select &#8220;Input Actions&#8221;, and then check &#8220;KMenuEdit&#8221;.</p>
<p><strong>VirtualBox and virt-manager</strong> don&#8217;t play well together. I don&#8217;t use Xen or KVM on my desktop, but I do manage several KVM-based virtual machine servers. Thanks to the new &#8220;install recommends&#8221; preference in the package manager, simply installing virt-manager also installs libvirt-bin. This loads the kvm-intel or kvm-amd modules on boot, which then <a href="http://forums.virtualbox.org/viewtopic.php?p=52266&#038;sid=f2a1898a3036872a16717f7e52e8b4e3">prevents VirtualBox from starting virtual machines</a>, with the error &#8220;VirtualBox can&#8217;t operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).&#8221;</p>
<p>I suppose this is really a problem with the &#8220;install recommends&#8221; behaviour. I&#8217;ve complained about that elsewhere, but I always repeat a good gripe when the opportunity presents.</p>
<p>The solution is to edit /etc/default/libvirt-bin and disable libvirtd:</p>
<pre>start_libvirtd="no"</pre>
<p>And for good measure, blacklist the modules. Create /etc/modprobe.d/local.conf and insert:</p>
<pre>blacklist kvm-intel
blacklist kvm-amd</pre>
<p>What still needs work:</p>
<p><strong>Akonadi</strong> doesn&#8217;t start before Kontact tries to access it. <a href="http://kubuntuforums.net/forums/index.php?topic=3112175.0">This solution</a> (autostarting &#8220;akonadictl start&#8221; at login) worked for me, although I (painfully) developed it independently. If only I had used Google.</p>
<p><strong>openvpn with knetworkmanager</strong> still doesn&#8217;t work. I still prefer Gnome&#8217;s network manager applet, which works just fine with Kubuntu. Kill knetworkmanager, and start nm-applet. Next time you login, KDE will tell you that another network manager is running, and ask you if you still want to use Knetworkmanager. Say no. Also, OpenVPN support is more reliable under Lucid. Using Gnome network manager with Kubuntu Karmic, the OpenVPN service would periodically fail to start. Editing VPN preferences and then hitting OK sometimes resolved it, but at other times it was an annoying and random dance to make it work. This seems to be resolved under Lucid.</p>
<p><strong>OpenOffice/KDE integration</strong> is improved since Karmic, but still has drawing bugs. In particular, the zoom slider in the lower right often disappears. It&#8217;s still there, and clicking in the area makes it reappear and zooms. I prefer the &#8220;100% / 75% / &#8230;&#8221; pull-down of the stock OpenOffice theme, however. This is a vast improvement over the Karmic integration, where simply dragging a spreadsheet tab in Calc crashed OpenOffice, but I&#8217;d like to see more development here.</p>
<p>Otherwise, <a href="/2009/11/01/upgrading-from-kubuntu-9-04-to-9-10/">my comments</a> regarding Karmic still hold. Google Earth and Kwin play nicely, qtcurve (KDE/GTK integration) is awesome and no longer has the font bug, and Plasma and Kwin are faster and more stable. Lucid is no great leap forward and Kubuntu is still not an innovator among KDE distributions like Ubuntu is to Gnome. But it is an incremental improvement worth using if you prefer KDE.</p>
<p>I have had a Lucid <a href="/apt-repository/">repository</a> since upgrading my media PC and servers. It now includes dfreer&#8217;s znes32 for AMD64 (still working on Lucid) and kregexpeditor (you can have it when you pry it from my cold, dead hands).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/08/04/upgrading-from-kubuntu-9-10-to-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Sun Java on Ubuntu Lucid</title>
		<link>http://www.tolaris.com/2010/06/10/installing-sun-java-on-ubuntu-lucid/</link>
		<comments>http://www.tolaris.com/2010/06/10/installing-sun-java-on-ubuntu-lucid/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 22:41:57 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=917</guid>
		<description><![CDATA[As of Ubuntu Lucid, the Sun Java JRE has been replaced with OpenJDK. Unfortunately, OpenJDK still isn&#8217;t a complete drop-in replacement for Sun Java. For instance, the Facebook &#8220;Upload Photos&#8221; applet doesn&#8217;t work correctly; the photos don&#8217;t have thumbnails and can&#8217;t be rotated before upload. The solution is to install the Sun Java JRE. Add [...]]]></description>
			<content:encoded><![CDATA[<p>As of Ubuntu Lucid, the Sun Java JRE has been <a href="http://www.ubuntugeek.com/sun-java-moved-to-the-partner-repository-in-ubuntu-10-04-lucid.html">replaced with OpenJDK</a>. Unfortunately, OpenJDK still isn&#8217;t a complete drop-in replacement for Sun Java. For instance, the Facebook &#8220;Upload Photos&#8221; applet doesn&#8217;t work correctly; the photos don&#8217;t have thumbnails and can&#8217;t be rotated before upload. The solution is to install the Sun Java JRE.</p>
<p><span id="more-917"></span>
<ol>
<li>Add the Canonical partner repository.<br />
<code>sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"</code></li>
<li>Install Sun Java JRE.<br />
<code>sudo apt-get update<br />
sudo apt-get install sun-java6-jre sun-java6-fonts sun-java6-plugin</code></li>
<li>Update system defaults to prefer Sun Java over OpenJDK.<br />
<code>sudo update-alternatives --set java /usr/lib/jvm/java-6-sun/jre/bin/java<br />
sudo update-alternatives --set javaws /usr/lib/jvm/java-6-sun/jre/bin/javaws<br />
sudo update-alternatives --set mozilla-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/*/libnpjp2.so</code></li>
<li>If that fails, manually choose them from a list. Always choose the option containing &#8220;java-6-sun&#8221;.<br />
<code>sudo update-alternatives --config java<br />
sudo update-alternatives --config javaws<br />
sudo update-alternatives --config mozilla-javaplugin.so</code></li>
<li>Restart Firefox.</li>
</ol>
<p>Oh, happy coffee-cup-clock progress bar, how I missed you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/06/10/installing-sun-java-on-ubuntu-lucid/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>AC3 audio with pulseaudio in Ubuntu Lucid</title>
		<link>http://www.tolaris.com/2010/05/09/ac3-audio-with-pulseaudio-in-ubuntu-lucid/</link>
		<comments>http://www.tolaris.com/2010/05/09/ac3-audio-with-pulseaudio-in-ubuntu-lucid/#comments</comments>
		<pubDate>Sun, 09 May 2010 12:58:17 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=901</guid>
		<description><![CDATA[Since upgrading my media PC to Ubuntu 10.04 &#8220;Lucid Lynx&#8221;, pulseaudio can&#8217;t play files with AC3 audio. Unfortunately this includes all of my ripped DVDs, which were encoded with AC3 pass-through audio. If I play such a file in Miro, the video hangs after a few seconds. If I play it in Totem, the same [...]]]></description>
			<content:encoded><![CDATA[<p>Since upgrading my media PC to Ubuntu 10.04 &#8220;Lucid Lynx&#8221;, pulseaudio <a href="http://www.mail-archive.com/pulseaudio-tickets@mail.0pointer.de/msg03472.html">can&#8217;t play files with AC3 audio</a>. Unfortunately this includes all of my ripped DVDs, which were encoded with AC3 pass-through audio. If I play such a file in Miro, the video hangs after a few seconds. If I play it in Totem, the same happens but a pop-up is also displayed: &#8220;pa_stream_writable_size() failed: Connection terminated&#8221;.</p>
<p>I fixed it by downgrading Pulseaudio to the karmic version.  Here is how.</p>
<p><span id="more-901"></span>First, add the karmic repositories to your sources list. Create a file, /etc/apt/sources.list.d/ubuntu-karmic.list, containing:</p>
<pre>deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-security main restricted universe multiverse</pre>
<p>Now downgrade pulseaudio to the specific version in karmic:</p>
<p><code>sudo apt-get update<br />
sudo apt-get install pulseaudio=1:0.9.19-0ubuntu4.1 libpulse0=1:0.9.19-0ubuntu4.1 pulseaudio-module-x11=1:0.9.19-0ubuntu4.1 pulseaudio-esound-compat=1:0.9.19-0ubuntu4.1 pulseaudio-module-bluetooth=1:0.9.19-0ubuntu4.1 pulseaudio-module-gconf=1:0.9.19-0ubuntu4.1 libpulse-mainloop-glib0=1:0.9.19-0ubuntu4.1 libpulse-browse0=1:0.9.19-0ubuntu4.1 pulseaudio-utils=1:0.9.19-0ubuntu4.1</code></p>
<p>You may remove ubuntu-karmic.list after this, or disable it by renaming it to something not ending in &#8220;.list&#8221;.</p>
<p>Finally, tell dpkg not to upgrade again:</p>
<p><code>sudo dpkg --set-selections</code></p>
<p>Paste the following, followed by &#8220;Enter&#8221; and &#8220;Control-D&#8221;:</p>
<pre>libpulse-browse0 hold
libpulse-mainloop-glib0 hold
libpulse0 hold
pulseaudio hold
pulseaudio-esound-compat hold
pulseaudio-module-bluetooth hold
pulseaudio-module-gconf hold
pulseaudio-module-udev hold
pulseaudio-module-x11 hold
pulseaudio-utils hold</pre>
<p>I haven&#8217;t get discovered if the Gnome package updater in lucid will honour the holds. Synaptic and apt-get will, but when I last tested (with jaunty), the Gnome updater blindly upgrades without regards to dpkg preferences. Lets hope some sanity has set in since then.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/05/09/ac3-audio-with-pulseaudio-in-ubuntu-lucid/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iptables firewall templates</title>
		<link>http://www.tolaris.com/2010/03/29/iptables-firewall-templates/</link>
		<comments>http://www.tolaris.com/2010/03/29/iptables-firewall-templates/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 18:39:28 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=741</guid>
		<description><![CDATA[I use iptables firewalls on every server I administer, including all of our core routers (which run Linux too). There are lots of tools to easily configure a firewall. For simple tasks, Ubuntu now installs ufw by default, which has both command-line and GUI tools. For servers, consider Webmin. If you want to do something [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.netfilter.org/">iptables</a> firewalls on every server I administer, including all of our core routers (which run Linux too). There are lots of tools to easily configure a firewall. For simple tasks, Ubuntu now installs <a href="http://en.wikipedia.org/wiki/Uncomplicated_Firewall">ufw</a> by default, which has both command-line and GUI tools. For servers, consider <a href="http://www.webmin.com">Webmin</a>.</p>
<p>If you want to do something more complicated, or prefer editing iptables rules yourself, you&#8217;ll have to do it by hand.  When I first started doing this I found a template online and edited it to suit my need.  Over time I&#8217;ve learned a lot more about iptables, and my templates have evolved.</p>
<p><span id="more-741"></span>Here is a simple basic firewall.  The outline is taken from the output of <code>iptables-save</code>, and then hand-edited.  I&#8217;ve left comments in to explain what each section does.</p>
<pre>*filter
:FORWARD ACCEPT [0:0]
:INPUT DROP [0:0]
:OUTPUT ACCEPT [0:0]
# Accept all loopback traffic
-A INPUT -i lo -j ACCEPT
# Drop invalid/unknown/spoofed TCP sessions
-A INPUT -p tcp ! --syn -m state --state NEW -j DROP
# Accept new sessions
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Accept important ICMP types
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 12 -j ACCEPT
# Accept known services
-A INPUT -p tcp -m tcp -m multiport --dports 22,25,80,443,465,587,993,995 -j ACCEPT
-A INPUT -p udp -m udp -m multiport --dports 53,5353 -j ACCEPT
COMMIT
</pre>
<p>Edit the last two lines for your specific services, and then save the file as /etc/iptables.up.rules and restore it:</p>
<p><code>iptables-restore < /etc/iptables.up.rules</code></p>
<p>The above is a default-deny firewall which allows all outgoing and loopback traffic, but filters incoming connections.  This means that anything not specifically allowed will be dropped without notice.</p>
<p>Suppose you want to do this at your router to protect all your servers.  Assuming:</p>
<ol>
<li>The router is the default gateway for both servers</li>
<li>server1 at 192.168.0.100 is a mail server offering SMTP, POP, POP-SSL, IMAP, and IMAP-SSL</li>
<li>server2 at 192.168.0.101 is a web server offering HTTP, HTTPS, and DNS</li>
<li>all servers offer SSH, including the router</li>
</ol>
<p>For routed (forwarded) traffic, you must use the FORWARD chain. In addition to ACCEPT and DROP, chains can call other named chains. I recommend creating a chain for each server you want to protect.</p>
<pre>*filter
:FORWARD DROP [0:0]
:INPUT DROP [0:0]
:OUTPUT ACCEPT [0:0]
:server1 - [0:0]
:server2 - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp ! --syn -m state --state NEW -j DROP
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 12 -j ACCEPT
# if just a single port, you can avoid the multiport match extension and use dport
-A INPUT -p tcp -m tcp --dport 22  -j ACCEPT
# put common rules first
-A FORWARD -p tcp ! --syn -m state --state NEW -j DROP
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 12 -j ACCEPT
# all servers offer SSH
-A FORWARD -p tcp -m tcp --dport 22  -j ACCEPT
# send specific traffic to custom rules
-A FORWARD -d 192.168.0.100 -j server1
-A FORWARD -d 192.168.0.101 -j server2
-A server1 -p tcp -m tcp -m multiport --dports 25,110,143,993,995 -j ACCEPT
-A server2 -p tcp -m tcp -m multiport --dports 80,443 -j ACCEPT
-A server2 -p udp -m udp --dport 53 -j ACCEPT
COMMIT
</pre>
<p>It's possible to reduce complexity by putting the common rules in another chain and calling it from both INPUT and FORWARD:</p>
<pre>*filter
:FORWARD DROP [0:0]
:INPUT DROP [0:0]
:OUTPUT ACCEPT [0:0]
:common_fw - [0:0]
:server1 - [0:0]
:server2 - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -j common_fw
-A FORWARD -j common_fw
-A FORWARD -d 192.168.0.100 -j server1
-A FORWARD -d 192.168.0.101 -j server2
-A common_fw -p tcp ! --syn -m state --state NEW -j DROP
-A common_fw -m state --state ESTABLISHED,RELATED -j ACCEPT
-A common_fw -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A common_fw -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A common_fw -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A common_fw -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A common_fw -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A common_fw -p icmp -m icmp --icmp-type 12 -j ACCEPT
-A common_fw -p tcp -m tcp --dport 22  -j ACCEPT
-A server1 -p tcp -m tcp -m multiport --dports 25,110,143,993,995 -j ACCEPT
-A server2 -p tcp -m tcp -m multiport --dports 80,443 -j ACCEPT
-A server2 -p udp -m udp --dport 53 -j ACCEPT
COMMIT
</pre>
<p>Where to save and how to load your rules depends on the distribution.  Ubuntu and Debian don't have a standard way to load an iptables ruleset on boot.  So I borrowed Webmin's practice of putting a line in /etc/network/interfaces:</p>
<pre># The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        gateway 192.168.0.1
        post-up iptables-restore < /etc/iptables.up.rules</pre>
<p>Users of RPM-based systems like Fedora, RHEL, and CentOS have it easier. Save your rules in /etc/sysconfig/iptables, and they'll be loaded at boot or whenever you restart networking. However, Red Hat systems come with a simple firewall manager named lokkit, which creates its own unusual chains like "RH-Firewall-1-INPUT". Here is an example from a CentOS 4 server I administer:</p>
<pre>*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited</pre>
<p>You should never expect your hand-edited files to work with a firewall management tool like ufw or lokkit.  However, if you are careful to obey the expected format these tools use, you can make small edits by hand while still using the tool.  For instance, all of my templates are compatible with Webmin's firewall editor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/03/29/iptables-firewall-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VLANs, bridges, and virtual machines</title>
		<link>http://www.tolaris.com/2010/02/20/vlans-bridges-and-virtual-machines/</link>
		<comments>http://www.tolaris.com/2010/02/20/vlans-bridges-and-virtual-machines/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 12:44:38 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=686</guid>
		<description><![CDATA[We run several virtual machine host servers on a network with multiple VLANs. The virtual machines are members of different VLANs, but are not themselves aware of the VLAN. This is how we did it. We use KVM for virtualisation, but I&#8217;m not going to discuss the details here. Like any virtualisation solution, KVM starts [...]]]></description>
			<content:encoded><![CDATA[<p>We run several virtual machine host servers on a network with multiple VLANs.  The virtual machines are members of different VLANs, but are not themselves aware of the VLAN.  This is how we did it.</p>
<p><span id="more-686"></span>We use <a href="http://www.linux-kvm.org">KVM</a> for virtualisation, but I&#8217;m not going to discuss the details here.  Like any virtualisation solution, KVM starts a virtual machine and attaches its virtual network hardware to a network interface on the host OS.  What I want to discuss is how to implement the networking layer.</p>
<p>I <a href="http://www.tolaris.com/2009/03/05/using-host-networking-and-nat-with-virtualbox/">previously wrote</a> about creating a network bridge for Virtualbox virtual machines, and we&#8217;re going to do something similar here.  However, we want to implement VLAN support and native 802.1q VLAN tagging at the same time.</p>
<p>The design:</p>
<ul>
<li>The physical server is connected to the Ethernet switch via a 802.1q VLAN tagged trunk port</li>
<li>The host OS is aware of the trunk port, and implements several virtual network interfaces.  Each virtual  interface is associated with one VLAN.  Any traffic on that virtual interface exits the physical network interface as tagged VLAN packets.</li>
<li>The host OS provides a network bridge for each VLAN, and adds the virtual VLAN interface to the bridge.</li>
<li>The guest OSes (virtual machines) are not VLAN-aware.  They have a normal ethernet interface which requires no special configuration.</li>
<li>The virtualisation software (KVM, in this case) attaches the network interface of the guest OS to the VLAN-specific network bridge.</li>
</ul>
<p>Warning: changing the Ethernet setup to your server can cause you to lose access to it.  At all times during this process, ensure you have console access to the server, and network or console access to the switch.</p>
<p>That said, we&#8217;ll try to time the network interruption such that we don&#8217;t lose access.  First, configure your server for VLAN networking.  This guide assumes the server runs Ubuntu 8.04 &#8220;Hardy Heron&#8221;, but the steps are similar for any recent Ubuntu release.  I have no idea how Red Hat handles VLANs and bridging, but I invite you to provide the steps in comments.</p>
<p>This guide also assumes the server is connected to a VLAN unaware (access) port, on VLAN 100, with an existing /etc/network/interfaces like so:</p>
<pre># The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	gateway 192.168.0.1</pre>
<p>Finally, we assume that virtual machines will be attached to either VLAN 100 (the same as the host OS&#8217;s own traffic) or VLAN 200.  So we&#8217;ll prepare support for both.</p>
<p>Install vlan and bridge support.<br />
<code>apt-get install vlan bridge-utils</code></p>
<p>Then edit /etc/network/interfaces.  Modify the existing network setup to be aware of VLAN 100, and to create a bridge on it.</p>
<pre>
# The loopback network interface
auto lo
iface lo inet loopback          

# LAN uses VLAN trunking, so set any IP addresses on appropriate bridge
auto eth0
iface eth0 inet manual
	up ifconfig eth0 up

# VLAN 100
auto eth0.100
iface eth0.100 inet manual
	up ifconfig eth0.100 up

# KVM bridge, VLAN 100, via eth0
auto br100
iface br100 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	gateway 192.168.0.1
	bridge_ports eth0.100
	bridge_maxwait 5
	bridge_fd 1
	bridge_stp on</pre>
<p>We must bring eth0 up before we can create eth0.100, and we must bring eth0.100 up before we can attach it to the bridge interface.  Finally, we must configure the host OS&#8217;s IP address on the bridge.  If you don&#8217;t want to attach virtual machines to VLAN 100, you could configure the IP directly on eth0.100 and leave out the stanza for br100.</p>
<p>Now, apply changes.  Because we&#8217;re going to move the existing IP from eth0 to br100, the easiest way is to reboot.  Alternatively, you may try <code>/etc/init.d/networking restart</code>, but make sure you run this from console so you can fix any problems.</p>
<p>Network interruption begins as soon as you run the above command, or reboot.  To restore access to the host OS, we must now configure the Ethernet port on the switch.  For Cisco, this is easy.  Assuming the server is connected to gigabit Ethernet port 1, run:</p>
<pre>configure terminal
interface GigabitEthernet0/1
 switchport mode trunk</pre>
<p>You should now be able to ping your server.  Once you verify that works, add the configuration for VLAN 200 to /etc/network/interfaces.</p>
<pre># VLAN 200
auto eth0.200
iface eth0.200 inet manual
	up ifconfig eth0.200 up

# KVM bridge, VLAN 200, via eth0
auto br200
iface br200 inet manual
	bridge_ports eth0.200
	bridge_maxwait 5
	bridge_fd 1
	bridge_stp on</pre>
<p>VLAN 200 doesn&#8217;t need an IP on the host OS, so it lacks the static IP configuration.  Configure any additional VLANs the same way.</p>
<p>Now we are ready to attach virtual machines to the new bridges.  For KVM, use virt-install to create a machine with 20 GB hard disk, 1 GB of RAM, booting the hardy iso, and attached to VLAN 100.</p>
<p><code>virt-install --connect qemu:///system -n guestname -r 1024 -f /path/to/virtual/disks/guestname.qcow2 -s 20 -c /path/to/isos/ubuntu-8.04.3-server-i386.iso --vnc --os-type linux --os-variant ubuntuHardy --accelerate --network=bridge:br100</code></p>
<p>Now use virt-manager to connect to the guest and configure it.</p>
<p>The last step can be replaced with any other virtualisation solution.  For instance, with Virtualbox, you can create a VM and then attach it to the bridged interface br100.</p>
<p><a href="http://www.tolaris.com/blog/wp-content/uploads/2010/02/virtualbox-br100.png"><img src="http://www.tolaris.com/blog/wp-content/uploads/2010/02/virtualbox-br100.png" alt="" title="virtualbox-br100" width="672" height="506" class="alignnone size-full wp-image-703" /></a></p>
<p>Unlike the Virtualbox <a href="http://www.tolaris.com/2009/03/05/using-host-networking-and-nat-with-virtualbox/">NAT/routing setup</a>, we don&#8217;t need to enable IP forwarding (<code>sysctl -w net.ipv4.ip_forward=1</code>).  This method uses layer 2 switching only.  However, if you use an iptables firewall, make sure the FORWARD chain of the filter table defaults to &#8220;ACCEPT&#8221;, or use an equivalent rule matching traffic to/from the virtual bridges.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/02/20/vlans-bridges-and-virtual-machines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>virt-manager now in repo</title>
		<link>http://www.tolaris.com/2009/12/08/virt-manager-now-in-repo/</link>
		<comments>http://www.tolaris.com/2009/12/08/virt-manager-now-in-repo/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 17:23:46 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[repo]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=665</guid>
		<description><![CDATA[The latest virt-manager package in Ubuntu karmic is broken. We use virt-manager to manage KVM/QEMU virtual machines over an ssh tunnel. This worked fine in hardy and jaunty. But it is partially broken in karmic. The bug appears as: Start virt-manager. Connect to a KVM host server using connection &#8220;Remote tunnel over SSH&#8221; with hypervisor [...]]]></description>
			<content:encoded><![CDATA[<p>The latest virt-manager package in Ubuntu karmic is broken.  We use virt-manager to manage <a href="http://www.linux-kvm.org">KVM</a>/QEMU virtual machines over an ssh tunnel.  This worked fine in hardy and jaunty.  But it is partially broken in karmic.</p>
<p><span id="more-665"></span>The bug appears as:</p>
<ol>
<li>Start virt-manager.</li>
<li>Connect to a KVM host server using connection &#8220;Remote tunnel over SSH&#8221; with hypervisor &#8220;QEMU/KVM&#8221;.</li>
<li>Double-click on a VM to open a VNC connection to console.</li>
<li>The error message &#8220;Error bringing up domain details: invalid argument in virDomainGetXMLDesc&#8221; appears, and no VNC session opens.</li>
</ol>
<p>The problem is with the latest version of virt-manager, 0.7.0.  To work around it I&#8217;ve repackaged virt-manager 0.6.1 from jaunty with the fake version &#8220;0.7.1~really0.6.1-1ubuntu4&#8243;.  Packages for i386 and amd64 are now in my <a href="/apt-repository/">APT repository</a>.</p>
<p>Also, KPackageKit ignores my &#8220;<code>dpkg --set-selections</code>&#8220;, forcing me to do this.  Thanks, KPackageKit, for ignoring the standard!  Otherwise I could install the jaunty package and mark it on hold.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2009/12/08/virt-manager-now-in-repo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Securing laptops with ecryptfs, cryptsetup, and tmpfs</title>
		<link>http://www.tolaris.com/2009/11/14/securing-laptops-with-ecryptfs-cryptsetup-and-tmpfs/</link>
		<comments>http://www.tolaris.com/2009/11/14/securing-laptops-with-ecryptfs-cryptsetup-and-tmpfs/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 00:17:03 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=618</guid>
		<description><![CDATA[One of the awesome features of the last several Ubuntu releases is support for ecryptfs, an encrypted filesystem. At Talia we depend heavily on GPG, OTR, SSH keys and other forms of encryption and secure identification. Loss of those keys and other confidential data to laptop theft, corporate espionage, or the US Customs Service is [...]]]></description>
			<content:encoded><![CDATA[<p>One of the awesome features of the last several Ubuntu releases is support for <a href="http://www.linuxjournal.com/article/9400">ecryptfs</a>, an <a href="http://ecryptfs.sourceforge.net/ecryptfs-faq.html">encrypted</a> filesystem.  At Talia we depend heavily on GPG, OTR, SSH keys and other forms of encryption and secure identification.  Loss of those keys and other confidential data to laptop theft, corporate espionage, or the <a href="http://www.boingboing.net/2008/02/07/tsa-confiscating-lap.html">US Customs Service</a> is a big concern for us.  This week I secured my laptop, as a prototype of our new corporate laptop setup.  Here is how I did it.</p>
<p><span id="more-618"></span>Nothing in this process is specific to KDE, so Ubuntu or Xubuntu users can use this as well.  Steps:</p>
<ol>
<li>Choose a strong password</li>
<li>Create an encrypted ~/Private directory</li>
<li>Copy home directory files into ~/Private</li>
<li>Move ~/Private to $HOME</li>
<li>Encrypt swap</li>
<li>Make /tmp a tmpfs</li>
</ol>
<p>Caveat emptor: If you encrypt your home directory, then later forget your password and fail to write down the mount passphrase, you are screwed.  There is no practical chance that you will recover your files.  As always, make a backup.</p>
<p><strong>Step 1: Choose a strong password</strong></p>
<p>If you aren&#8217;t already doing this, you&#8217;re not likely to use this guide.  Security is a mindset, not a tool.  Get used to keeping strong passwords in your head.  Ubuntu makes using encryption <em>really</em> easy, but it is only as effective as the strength of the password you choose.</p>
<p>My recommendation is to use <a href="http://sourceforge.net/projects/pwgen/">pwgen</a> with -B or even -By:</p>
<p><code>pwgen -By</code></p>
<pre>
Ohz:ah7s aiT7gex% AhNae)Z3 Ohph*i9e va9eZuo[ Mei7ieZ~ Ohb7Za]o Piek+ai3
fa!m3Sho ua~ch7Wa tom?oh9U do{i4Aep tuF4oof} Na#a4eiH epe\G3oh aR3ahp^i
...
Aip$aim9 Eph%a3pu gae7aY`a Ie^cah4t sha+uY3v ove3aeZ= Wie4yei| Oc\aeb9e
</pre>
<p>The -B option tends to generate passwords that are balanced between hands and at least partly pronouncible, so this isn&#8217;t as hard as you think.  If you do use -y (special characters like +), consider the keyboards you might have to use.  If you use both British and American keyboards, don&#8217;t use £, @, &#8220;, `, #, ~, \, or |, as all of these are in different locations.</p>
<p>Pick one and and make a mnemonic to help you remember it.  Write it on a piece of paper, put it in your wallet, and burn it once you memorise it.  Write it on your belly with a sharpie; whatever it takes.  Change your password now:</p>
<p><code>passwd</code></p>
<p>Your password will later become the passphrase that protects the encryption keys to your home directory.  ecryptfs includes excellent PAM support, so if you change your password later it will update the key too.</p>
<p><strong>Step 2: Create an encrypted ~/Private directory</strong></p>
<p>Since I upgraded from an earlier install without an encrypted home or ~/Private directory, I had to create one.  If you are about to install 9.10 from a CD, the installer has an option to encrypt your home directory.  Just use that.  Or create a new user:</p>
<p><code>adduser --encrypt-home username</code></p>
<p>If you&#8217;ve already got an encrypted home, congratulations!  The hardest part is done.  Skip to step 5.</p>
<p>If not, let&#8217;s get started.  Linux Mag&#8217;s Dustin Kirkland has written an <a href="http://www.linux-mag.com/id/7568/2/">excellent guide</a> to this process.  Much of my process is based on his, but I include a few corrections.  For most of this you can remain logged in to your Desktop, but the process is simpler from the Linux console.  The initial copy process will make you want to get up and do something else while it finishes anyway.</p>
<p>Logout from the Desktop, which should return you to the login screen.  If your login screen is configured to log you in automatically, cancel it.  Then press Ctrl+Alt+F1 to go to the first Linux virtual console.</p>
<p>Login at the prompt, and create an encrypted $HOME/Private directory:</p>
<p><code>ecryptfs-setup-private</code></p>
<pre>Enter your login passphrase:
Enter your mount passphrase [leave blank to generate one]:</pre>
<p>At the first prompt enter your user password.  At the second, press Enter.  Now record the mount passphrase which was just generated:</p>
<p><code>ecryptfs-unwrap-passphrase $HOME/.ecryptfs/wrapped-passphrase</code></p>
<p>Print it out and put it with your birth certificate in your fire-proof document safe.  You do have one, right?  If something goes wrong you will need this later.</p>
<p>Log out, and log in again.</p>
<p><strong>Step 3: Copy home directory files into ~/Private</strong></p>
<p>Make sure you have at least 50% free on /home, or this may fail.</p>
<p><code>rsync -aP --exclude=.Private --exclude=Private --exclude=.ecryptfs $HOME/ $HOME/Private/</code></p>
<p>If you don&#8217;t have 50% free, first move some files from $HOME to $HOME/Private, and rsync the rest.</p>
<p><code>cd<br />
mv -v Videos Music Pictures DirectoryOfBigFiles $HOME/Private/<br />
rsync -aP --exclude=.Private --exclude=Private --exclude=.ecryptfs $HOME/ $HOME/Private/</code></p>
<p>This will take a long time to complete.  Every file is being encrypted as it is copied or moved.  If you have a lot of files and an under-powered CPU (such as on a netbook), it will take even longer.  I moved 178 GB of data on my Dell Vostro 1500 (Intel Core2 Duo 2 GHz, 4GB RAM) in about 5 hours.  Get a coffee, walk the plants, shave the cat, come back later.</p>
<p>When done, logout to sync any remaining changes to disk.</p>
<p><strong>Step 4: Move ~/Private to $HOME</strong></p>
<p>Now we need to do some things with sudo.    Still on console, login again.   Unmount $HOME/Private:</p>
<p><code>ecryptfs-umount-private<br />
cd /<br />
sudo mkdir -p /home/.ecryptfs/$USER<br />
sudo chown $USER:$USER /home/.ecryptfs/$USER<br />
sudo mv $HOME/.ecryptfs /home/.ecryptfs/$USER/</code></p>
<p>Create a new home and populate it with the ecryptfs files:</p>
<p><code>sudo mkdir -p -m 700 /home/$USER.new<br />
sudo chown $USER:$USER /home/$USER.new<br />
sudo mv $HOME/.Private /home/.ecryptfs/$USER/<br />
sudo ln -s /home/.ecryptfs/$USER/.ecryptfs /home/$USER.new/.ecryptfs<br />
sudo ln -s /home/.ecryptfs/$USER/.Private /home/$USER.new/.Private<br />
sudo ln -s /usr/share/ecryptfs-utils/ecryptfs-mount-private.txt /home/$USER.new/README.txt<br />
</code></p>
<p>Switch to the new home, tell ecryptfs that we&#8217;ll mount it at login, and make it read-only (until it is mounted):</p>
<p><code>sudo mv $HOME $HOME.old<br />
sudo mv $HOME.new $HOME<br />
echo $HOME > $HOME/.ecryptfs/Private.mnt<br />
sudo chmod 500 $HOME</code></p>
<p>Now for the moment of truth.  Still on console, logout, and login again.  Your home directory should mount:</p>
<p><code>mount | grep ecryptfs</code></p>
<pre>/home/username/.Private on /home/username type ecryptfs (ecryptfs_sig=9cec4d81c9bcb6e0,ecryptfs_fnek_sig=c735e6facb299611,ecryptfs_cipher=aes,ecryptfs_key_bytes=16)</pre>
<p>Create some convenient links:</p>
<p><code>ln -s /home/.ecryptfs/$USER/.ecryptfs $HOME/.ecryptfs<br />
ln -s /home/.ecryptfs/$USER/.Private $HOME/.Private</code></p>
<p>Once you verify that all your user data is there, securely wipe any files that have important data, and then remove the old home.</p>
<p><code>cd $HOME.old<br />
find .kde .gnupg .ssh PathsToDirectoriesOfImportantFiles -print -exec shred -u {} \;<br />
rm -rf $HOME.old</code></p>
<p><strong>Step 5: Encrypt swap</strong></p>
<p>Your home directory isn&#8217;t the only place your private data may be written to disk.  When your computer doesn&#8217;t have enough RAM for everything it wants to have open, it swaps.  This means some RAM is written to disk to be read back later.  Thus, swap can contain anything you have ever have open.  Swap does not need normally to survive reboots *, so we&#8217;ll encrypt this with a random key every time we boot up.</p>
<p>* The one exception to this is hibernate mode (suspend to disk).  If you want to use hibernate, don&#8217;t encrypt swap, or use a (less secure) <a href="http://sysphere.org/~anrxc/j/articles/ecryptfs/index.html#top-5">static key</a>.  Encrypting swap has no impact on sleep mode (suspend to RAM).  I never use hibernate.</p>
<p>Thankfully, this is a very easy process with Ubuntu.  Despite the misleading name, this uses cryptsetup, not ecryptfs:</p>
<p><code>sudo apt-get install cryptsetup<br />
sudo ecryptfs-setup-swap</code></p>
<p><strong>Step 6: Make /tmp a tmpfs</strong></p>
<p>The last place your private data is commonly written is the temp directory, /tmp.  The contents of this directory don&#8217;t need to survive reboot either, and are commonly cleared at bootup.  It is possible to encrypt it using cryptsetup just as with swap, but we don&#8217;t need to.  Instead we&#8217;ll make this a <a href="http://en.wikipedia.org/wiki/Tmpfs">tmpfs</a>.  This means /tmp will be an auto-resizing virtual RAM disk.  By default it is allowed to grow to up to 50% of RAM.</p>
<p>Don&#8217;t worry about this consuming your RAM.  If the contents of RAM is swapped to disk, static content like /tmp will be the first to go.  And it isn&#8217;t much data anyway; my /tmp <a href="http://osdir.com/ml/kde-bugs-dist/2009-09/msg15164.html">rarely</a> grows beyond 200 MB.  Plus, using a tmpfs will save power when in battery mode.</p>
<p>Add one line to your /etc/fstab:</p>
<p><code>echo "tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0" >> /etc/fstab</code></p>
<p>If you are logged in to the desktop, log out completely.  Then login on console one last time, and run:</p>
<p><code>sudo rm -rf /tmp/*<br />
reboot</code></p>
<p>That&#8217;s it!  You are now running a cryptographically secure laptop, protected against all but the <a href="http://xkcd.com/538/">rubber-hose attack</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2009/11/14/securing-laptops-with-ecryptfs-cryptsetup-and-tmpfs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Enabling the Sleep button on a Dell laptop in Kubuntu Karmic</title>
		<link>http://www.tolaris.com/2009/11/10/enabling-the-sleep-button-on-a-dell-laptop-in-kubuntu-karmic/</link>
		<comments>http://www.tolaris.com/2009/11/10/enabling-the-sleep-button-on-a-dell-laptop-in-kubuntu-karmic/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 19:35:40 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=609</guid>
		<description><![CDATA[Update 2010-05-02: See this comment. I read an article in the Dec 2009 issue of Linux Magazine, one of several Linux-focused magazines we get at the office. I&#8217;d like to link directly to it, but it the magazine&#8217;s own website doesn&#8217;t offer the article or even a reliable permanent link to the issue number. Hint: [...]]]></description>
			<content:encoded><![CDATA[<p><em>Update 2010-05-02: See <a href="http://www.tolaris.com/2009/11/10/enabling-the-sleep-button-on-a-dell-laptop-in-kubuntu-karmic/comment-page-1/#comment-179">this comment</a>.</em></p>
<p>I read an article in the Dec 2009 issue of <a href="http://www.linux-magazine.com">Linux Magazine</a>, one of several Linux-focused magazines we get at the office.  I&#8217;d like to link directly to it, but it the magazine&#8217;s own website doesn&#8217;t offer the article or even a reliable permanent link to the issue number.  Hint: hey guys, sort that out.</p>
<p>The article was about configuring ACPI hotkeys to support your specific laptop.  IE, the buttons for &#8220;sleep&#8221;, &#8220;brightness up&#8221;, etc.  For most laptops this already works on Ubuntu.  On my Dell Vostro 1500, every button except for &#8220;sleep&#8221; worked right after install.  This is Linux, so there is always some way to fix that.</p>
<p><span id="more-609"></span>Unfortunately, ACPI cannot even detect my keypress.  The instructions in the article suggest starting acpid with -d for debug mode, which will print any keypresses that reach it.  Pressing Fn+F1, the sleep button, prints nothing.  So we&#8217;re going to use KDE&#8217;s hotkey support instead.  Gnome users can use a similar method; only the menu instructions differ.</p>
<p>First, create a script somewhere your user can run.  I have $HOME/bin in my $PATH, so I created a file there:</p>
<p><code>touch ~/bin/sleep-kde-screen<br />
chmod 755 ~/bin/sleep-kde-screen</code></p>
<p>Then I edited it to contain the following:</p>
<pre>#!/bin/sh
qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock
sudo /usr/sbin/pm-suspend</pre>
<p>This calls DBUS to lock the screensaver, then asks power-manager to suspend.  This way you will be prompted for your password when you resume from suspend.  If you prefer to hibernate, change &#8220;pm-suspend&#8221; to &#8220;pm-hibernate&#8221;.</p>
<p>Second, you need to tell sudo to allow your user to run this /usr/bin/pm-suspend without prompting for a password.  Run <code>sudo visudo</code> to edit /etc/sudoers, and add this line at the bottom:</p>
<pre>%admin ALL=NOPASSWD: /usr/sbin/pm-suspend</pre>
<p>Finally, add this script to your K menu with a hotkey.  Right-click on the K menu and select &#8220;Menu Editor&#8221;.  Add a new item to the &#8220;System&#8221; menu, give it a name (I like &#8220;Sleep!&#8221; *), and tell it to call sleep-kde-screen (wherever you&#8217;ve put it).  On the Advanced tab, select &#8220;Current shortcut key&#8221; and press the sleep button.  Now save and close the menu editor.</p>
<p><small>*  I imagine saying &#8220;Sleeeeeep!&#8221; like a hypnotist bad guy from an old movie on <a href="http://en.wikipedia.org/wiki/Mystery_Science_Theater_3000">MST3K</a>.</small></p>
<p>Press the sleep button, and you&#8217;ll suspend!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2009/11/10/enabling-the-sleep-button-on-a-dell-laptop-in-kubuntu-karmic/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Poor VirtualBox guest performance with Intel VT-X on Ubuntu 9.10</title>
		<link>http://www.tolaris.com/2009/11/04/poor-virtualbox-guest-performance-with-intel-vt-x/</link>
		<comments>http://www.tolaris.com/2009/11/04/poor-virtualbox-guest-performance-with-intel-vt-x/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 21:36:42 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=590</guid>
		<description><![CDATA[Since upgrading to Ubuntu 9.10 I&#8217;ve noticed poor performance of VirtualBox guests with Intel VT-X hardware virtualisation enabled. This has been noted in a few places, but I didn&#8217;t enable VT-x until recently so I can&#8217;t be sure that the problem began with Karmic. I can be sure that it is happening to me now. [...]]]></description>
			<content:encoded><![CDATA[<p>Since upgrading to Ubuntu 9.10 I&#8217;ve noticed poor performance of VirtualBox guests with Intel VT-X hardware virtualisation enabled.  This has been noted in a <a href="http://ubuntuforums.org/showthread.php?t=1294826">few</a> <a href="http://www.mail-archive.com/universe-bugs@lists.ubuntu.com/msg144983.html">places</a>, but I didn&#8217;t enable VT-x until recently so I can&#8217;t be sure that the problem began with Karmic.  I can be sure that it is happening to me now.</p>
<p><span id="more-590"></span>At the time of this writing, my host OS is Ubuntu 9.10 Karmic 64-bit (actually an Intel Core 2 Duo 2.0 MHZ), with <a href="http://www.virtualbox.org/">VirtualBox</a> 3.0.10 <a href="http://www.virtualbox.org/wiki/Editions">PUEL</a> edition.  I run several 32-bit clients: Ubuntu 6.06 LTS (just in case, we still encounter them at some customer sites), Ubuntu 8.04 LTS, Xubuntu 9.10, and Windows XP SP3 (my actual legal copy that came with the laptop).</p>
<p>I left the Windows XP VM running but idle, and noticed that my keyboard and mouse occasionally skipped, and my CPU worked harder than expected.  So I ran a few tests with top in batch mode:</p>
<p><code>top -b -d 10 -n 10</code></p>
<p>I then redirected that to a file, waited the 10*10 seconds to finish, and grepped the results.  This is with VT-x enabled, and shows only the relevant VM (not the GUI or other VMs):</p>
<pre>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
30763 tyler     20   0 1020m 609m  73m S   10 15.4   0:28.05 VirtualBox
30763 tyler     20   0 1020m 609m  73m S    9 15.4   0:28.98 VirtualBox
30763 tyler     20   0 1020m 609m  73m S    5 15.4   0:29.52 VirtualBox
30763 tyler     20   0 1020m 609m  73m S    6 15.4   0:30.10 VirtualBox
30763 tyler     20   0 1020m 609m  73m S   20 15.4   0:32.06 VirtualBox
30763 tyler     20   0 1020m 609m  73m S    6 15.4   0:32.63 VirtualBox
30763 tyler     20   0 1020m 609m  73m S   10 15.4   0:33.60 VirtualBox
30763 tyler     20   0 1020m 609m  73m S   16 15.4   0:35.18 VirtualBox
30763 tyler     20   0 1020m 609m  73m S    6 15.4   0:35.78 VirtualBox
30763 tyler     20   0 1020m 609m  73m S    4 15.4   0:36.20 VirtualBox</pre>
<p>Here is the same data, after rebooting the guest and disabling VT-x:</p>
<pre>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
30217 tyler     20   0 1027m 625m  73m S    4 15.8   2:21.32 VirtualBox
30217 tyler     20   0 1027m 625m  73m R    5 15.8   2:21.79 VirtualBox
30217 tyler     20   0 1027m 625m  73m S    1 15.8   2:21.89 VirtualBox
30217 tyler     20   0 1027m 625m  73m S   11 15.8   2:23.04 VirtualBox
30217 tyler     20   0 1027m 625m  73m S   11 15.8   2:24.17 VirtualBox
30217 tyler     20   0 1027m 625m  73m S    5 15.8   2:24.69 VirtualBox
30217 tyler     20   0 1027m 625m  73m S    2 15.8   2:24.94 VirtualBox
30217 tyler     20   0 1027m 625m  73m S   10 15.8   2:25.94 VirtualBox
30217 tyler     20   0 1027m 625m  73m S    5 15.8   2:26.44 VirtualBox
30217 tyler     20   0 1027m 625m  73m S   13 15.8   2:27.72 VirtualBox</pre>
<p>Two conclusions:</p>
<ol>
<li>Software virtualisation uses more RAM.  The guest is configured with 1 GB of RAM.  With VT-x, this uses 1020 M.  Without, it uses 1027 M.  Whether that represents a memory overhead of 7M per VM or 0.7% of total RAM per VM, I don&#8217;t care.  It&#8217;s small enough.</li>
<li>Software virtualisation, under these conditions, is more efficient than using VT-x.  The average CPU usage with VT-x was 9.2%.  Without, it was 6.7%.</li>
</ol>
<p>Engineering and science students will recall that all experimenters must note potential flaws and sources of error.</p>
<ol>
<li>This tests only a guest which is completely idle.  However, my general impression when doing actual work in the guest VM supports the idle observation.</li>
<li>top isn&#8217;t the best measure of performance, but it is indicative.</li>
<li>I only tested a 64-bit Intel host with a 32-bit Windows guest.  As always, more data is better.</li>
</ol>
<p>I also note that my keyboard and mouse no longer skip when the guest OS is busy.  Clearly something is up with VT-x and Ubuntu 9.10 hosts.  The right thing to do is to perform more tests confirm the initial observations, but I&#8217;m not going to spend any more time on this.  Software virtualisation, so far, has been plenty fast for me.  I&#8217;ll just disable VT-x on all guests, and test again after the next upgrade for VirtualBox or the host kernel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2009/11/04/poor-virtualbox-guest-performance-with-intel-vt-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: www.tolaris.com @ 2010-09-10 10:45:27 -->