<?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</title>
	<atom:link href="http://www.tolaris.com/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>Thu, 02 Sep 2010 20:13:02 +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>Upgrading to OpenWRT 10.03.1-rc3</title>
		<link>http://www.tolaris.com/2010/09/02/upgrading-to-openwrt-10-03-1-rc3/</link>
		<comments>http://www.tolaris.com/2010/09/02/upgrading-to-openwrt-10-03-1-rc3/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 20:05:04 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1085</guid>
		<description><![CDATA[I&#8217;ve run OpenWRT on my Buffalo WZR-HP-G300NH home router for a week now. So far there has been only one problem: wireless performance. The ath9k driver in OpenWRT Backfire 10.03 has a number of bugs, from poor latency jitter to occasionally dropping the connection. I&#8217;ve upgraded the router twice, first to 10.03.1-rc2 and then to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve run <a href="http://www.tolaris.com/tag/openwrt/">OpenWRT</a> on my Buffalo WZR-HP-G300NH home router for a week now. So far there has been only one problem: wireless performance. The ath9k driver in OpenWRT Backfire 10.03 has a number of bugs, from poor latency jitter to occasionally dropping the connection. I&#8217;ve upgraded the router twice, first to 10.03.1-rc2 and then to 10.03.1-rc3. It appears that 10.03.1 final is only a few weeks away.</p>
<p><span id="more-1085"></span><strong>Upgrading</strong></p>
<p>The upgrade process is amazingly simple:</p>
<ol>
<li>Download the new firmware image to your PC</li>
<li>Use Luci, the OpenWRT web interface, to upload the image</li>
<li>Reinstall any additional packages you previously had installed</li>
</ol>
<p>The Luci upgrade process will preserve your configuration across upgrades, but you should always back up your configuration first. Luci makes this easy, via &#8220;System -> Backup/Restore&#8221;. The result is a tar.gz of various files, mostly in /etc. You can add custom entries to this list from &#8220;Administration&#8221;, then &#8220;Overview -> User Interface&#8221;.</p>
<p>However, the upgrade process doesn&#8217;t preserve installed packages or make a list of them. I suggest you keep a list of packages you want to install, or generate a list before upgrading:</p>
<pre>opkg list-installed | cut -f 1 -d ' '</pre>
<p>For the latest upgrade, I downloaded <a href="http://downloads.openwrt.org/backfire/10.03.1-rc3/ar71xx/openwrt-ar71xx-wzr-hp-g300nh-squashfs-sysupgrade.bin">openwrt-ar71xx-wzr-hp-g300nh-squashfs-sysupgrade.bin</a> from the <a href="http://downloads.openwrt.org/backfire/10.03.1-rc3/ar71xx/">10.03.1-rc3/ar71xx section</a> of the <a href="http://downloads.openwrt.org/backfire/">Backfire repository</a>.</p>
<p>To use Luci to flash the new firmware, go to &#8220;Administration&#8221;, then &#8220;System -> Firmware&#8221;. Select &#8220;Browse&#8221; and select the firmware image you downloaded, then check &#8220;Keep configuration files&#8221;. Then select &#8220;Upload image&#8221;. After uploading, Luci will display the md5sum and size of the new firmware. Verify it, and then select &#8220;Proceed&#8221;.</p>
<p>The upgrade process goes through several steps, flashing the new firmware and importing the old configurations, and finally rebooting. This takes 5-10 minutes. I recommend doing this over wired Ethernet, although wireless works fine. New firmware images may not include the wireless driver for your hardware, so you may need to use Ethernet after the upgrade to install the needed packages.</p>
<p>After rebooting, edit the package list to point to the new repository and install the missing software. You can do this from the command line or with Luci.</p>
<p>If using the terminal, edit /etc/opkg.conf. If Luci, go to &#8220;Administration&#8221;, then &#8220;System -> Software&#8221;, and wait for the page to fully load. Then select &#8220;Edit package lists and installation targets&#8221;. Change the first line to point to the new repository:</p>
<pre>src/gz packages http://downloads.openwrt.org/backfire/10.03.1-rc3/ar71xx/packages</pre>
<p>I suspect this would not be necessary if the backup settings excluded /etc/opkg.conf, but it&#8217;s easy to work around.</p>
<p>Once that&#8217;s done, reload the package list and reinstall any software packages you had previously installed. See the <a href="http://www.tolaris.com/2010/09/01/openwrt-10-03-on-buffalo-wzr-hp-g300nh/#commandsummary">package list in my last post</a> for a handy summary to paste into the terminal.</p>
<p>Finally, enable the services you just installed. In Luci, use &#8220;Administration&#8221;, then &#8220;Services -> Initscripts&#8221;. I believe you could avoid this by adding /etc/rc.d to the backup settings before upgrading, but again, it&#8217;s easy to work around.</p>
<p>Finally, reboot. All services should start as normal, and everything should work as it did before the upgrade.</p>
<p><strong>Issues with 10.03.1-rc3</strong></p>
<p>As with 10.03, the ath9k driver still cannot support multiple wireless networks with different encryption settings. There are also known issues using PPPoE on the WAN link, but my Internet provider (Virgin Media cable) presents as regular Ethernet so this is not a problem for me.</p>
<p>The nmap package is missing libnl as a dependency.</p>
<pre>root@gw-belafonte:~# nmap
nmap: can't load library 'libnl.so.1'</pre>
<p>Correct it with <code>opkg install libnl</code>. It is nice to see that OpenWRT has nmap version 5.35DC1, which is newer than the latest Debian/Ubuntu packages.</p>
<p><strong>Comparison of wireless performance among 10.03 images</strong></p>
<p>Each release in the 10.03 series has included a bugfix or improvement to the ath9k wireless driver. To compare them, I re-ran the same <a href="http://www.tolaris.com/2010/09/01/openwrt-10-03-on-buffalo-wzr-hp-g300nh/#iperf">iperf/bwm-ng tests from my last post</a>. There appears to have been a small drop in maximum throughput from 10.03 to the 10.03.1 release candidates:</p>
<p>32.5 mbit &#8211; Buffalo WZR-HP-G300NH running OpenWRT 10.03<br />
27.8 mbit &#8211; Buffalo WZR-HP-G300NH running OpenWRT 10.03.1-rc2<br />
27.2 mbit &#8211; Buffalo WZR-HP-G300NH running OpenWRT 10.03.1-rc3</p>
<p>However, there were also major improvements in wireless stability, latency and jitter between 10.03 and 10.03.1-rc2. Using <code>fping -l</code> from my laptop (on 802.11g wireless) to gozer (on gigabit Ethernet) and frances (another laptop on 802.11g wireless) produced:</p>
<pre># 10.03
gozer   : xmt/rcv/%loss = 297/245/18%, min/avg/max = 0.71/182.2/987
frances : xmt/rcv/%loss = 297/239/20%, min/avg/max = 1.60/195.3/979

# 10.03.1-rc2
gozer   : xmt/rcv/%loss = 2799/2775/0%, min/avg/max = 0.71/3.11/196
frances : xmt/rcv/%loss = 2798/2770/1%, min/avg/max = 1.60/5.96/206

# 10.03.1-rc3
gozer   : xmt/rcv/%loss = 372/369/0%, min/avg/max = 0.58/4.77/150
frances : xmt/rcv/%loss = 372/366/1%, min/avg/max = 1.64/9.73/267</pre>
<p>Under both 10.03 and 10.03.1-rc2, I have experienced several drops in the wireless connection to two laptops. This usually happens overnight when our laptops are idle, and is accompanied by syslog errors on the router:</p>
<pre>Sep  1 01:51:32 gw-belafonte daemon.info hostapd: wlan0: STA 00:1c:bf:00:00:01 IEEE 802.11: disassociated
Sep  1 01:51:32 gw-belafonte daemon.info hostapd: wlan0: STA 00:1c:bf:00:00:01 IEEE 802.11: deauthenticated due to inactivity
Sep  1 01:51:32 gw-belafonte daemon.info hostapd: wlan0: STA 00:1c:bf:00:00:01 IEEE 802.11: authenticated</pre>
<p>I haven&#8217;t seen this happen since upgrading to 10.03.1-rc3, but I won&#8217;t be surprised if it does.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/09/02/upgrading-to-openwrt-10-03-1-rc3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenWRT 10.03 on Buffalo WZR-HP-G300NH</title>
		<link>http://www.tolaris.com/2010/09/01/openwrt-10-03-on-buffalo-wzr-hp-g300nh/</link>
		<comments>http://www.tolaris.com/2010/09/01/openwrt-10-03-on-buffalo-wzr-hp-g300nh/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 22:11:54 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ddwrt]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1055</guid>
		<description><![CDATA[I&#8217;ve been using a Linksys WRT54GL router running DD-WRT for several years now. It runs OpenVPN and fits a surprisingly large number of features into 4 MB of flash and 16 MB of RAM. It has been stable and reliable, but it&#8217;s a very under-powered device by modern standards. I haven&#8217;t been happy with the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using a <a href="http://en.wikipedia.org/wiki/Linksys_WRT54G_series">Linksys WRT54GL</a> router running <a href="http://www.dd-wrt.com">DD-WRT</a> for several years now. It runs OpenVPN and fits a surprisingly large number of features into 4 MB of flash and 16 MB of RAM. It has been stable and reliable, but it&#8217;s a very under-powered device by modern standards. I haven&#8217;t been happy with the pace of DD-WRT development, which takes a very long time to release large, monolithic updates. First I tried to upgrade it to <a href="http://openwrt.org/">OpenWRT</a>, but the latest release is too large to incorporate OpenVPN in 4 MB of flash. So I replaced it with a <a href="http://www.buffalo-technology.com/products/wireless/wireless-n-nfiniti/wzr-hp-g300nh-airstation-nfiniti-wireless-n-high-power-router/">Buffalo WZR-HP-G300NH</a> running OpenWRT Backfire 10.03.</p>
<p><span id="more-1055"></span>Full disclosure: before replacing the WRT54GL router, I tried to downgrade it to an older release of OpenWRT (Kamikaze 8.09.2). I uploaded the wrong firmware and bricked it. Oops. I had already decided to replace it, but this added some urgency.</p>
<p>My reasons for upgrading are mostly technical. I want to install other software packages on the router, such as mtr and tcpdump. This makes debugging infinitely faster and easier. When the going gets tough, the tough sniff packets. The Buffalo also represents a hardware upgrade in virtually every way &#8211; flash storage, RAM, CPU, wireless speed, Ethernet speed, and USB support.</p>
<p>However, there are also a bit of politics involved. DD-WRT&#8217;s development model is much more &#8220;closed&#8221; than OpenWRT, and is heavily centralised. OpenWRT is more of a community project and supports external packages in parallel development. Further, DD-WRT tries to store everything in the device NVRAM (non-volatile RAM), while OpenWRT creates a JFFS2 filesystem much more like a typical Linux system. I&#8217;d rather use and support OpenWRT as a project, and I think their way is the way forward.</p>
<p><strong>Installation</strong></p>
<p>The OpenWRT page for the <a href="http://wiki.openwrt.org/inbox/buffalo/wzr-hp-g300h">WZR-HP-G300NH</a> gives step-by-step instructions on how to install OpenWRT. These steps worked perfectly, so I won&#8217;t reproduce them here. I installed the <a href="http://downloads.openwrt.org/backfire/10.03/ar71xx/openwrt-ar71xx-wzr-hp-g300nh-squashfs-tftp.bin">Squashfs image</a> via the TFTP method. After installation, I logged in via telnet and changed the root password.</p>
<p>There is a known issue where SSH doesn&#8217;t start for 2-3 minutes after you change the root password. This happened to me but was just a matter of waiting until SSH started.</p>
<p>The hardware takes about 20 seconds to boot up, then waits for firmware by TFTP for 4 seconds, then loads OpenWRT. In total, boot time is about 45 seconds. This is just longer than my Ubuntu 10.04 media PC waits for an address by DHCP, so whenever I reboot the router I have to manually reconnect to the network. Ironically, the PC boots faster than the router. I hope makers of embedded systems follow Ubuntu&#8217;s example of speeding up boot times, because the difference is pretty glaring.</p>
<p><strong>Package Management</strong></p>
<p>Packages can be installed from the command-line or from Luci, the web interface. Before you can do so, you must download a package list from OpenWRT using the package manager, opkg. This tool is similar to dpkg or apt-get from Debian. The package list is kept in a RAM disk, so it does not persist across reboots. Before installing, either run <code>opkg update</code> or login to Luci and click &#8220;Administration&#8221;, then &#8220;System -> Software&#8221;, and finally &#8220;update package list&#8221;.</p>
<p>Install packages with <code>opkg install packagename</code>. Some packages, such as dropbear and openssh-client may overwrite the same files, so you must use the <code>--force-overwrite</code> switch if you see something like this:</p>
<pre>root@gw-belafonte:/# opkg install openssh-client
Installing openssh-client (5.4p1-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03/ar71xx/packages/openssh-client_5.4p1-1_ar71xx.ipk.
Collected errors:
 * check_data_file_clashes: Package openssh-client wants to install file /usr/bin/scp
        But that file is already provided by package  * check_data_file_clashes: dropbear
 * check_data_file_clashes: Package openssh-client wants to install file /usr/bin/ssh
        But that file is already provided by package  * check_data_file_clashes: dropbear
 * opkg_install_cmd: Cannot install package openssh-client.</pre>
<p>Solution:</p>
<pre>opkg --force-overwrite install openssh-client</pre>
<p>Most packages are configured by the <code>uci</code> command or Luci, and store their preferences in /etc/config.</p>
<p>Remove packages with <code>opkg remove packagename</code>. This does not leave configuration files behind, except for those in /etc/config.</p>
<p>I must say I&#8217;m pretty impressed with opkg; it&#8217;s an excellent implementation of principles from apt-get and it works very well on such a small platform. It&#8217;s certainly much easier to use than DD-WRT, which doesn&#8217;t have packages at all. You must select what features you want when you install the firmware, and the choices are slim &#8211; standard, micro (small flash), and openvpn are about the only useful choices. It is possible to install OpenWRT packages on DD-WRT devices with sufficient flash, but then why not just use OpenWRT?</p>
<p>Daemons like OpenVPN do not start when they are installed, and they are not configured to start on boot. To start them, either use a command like <code>/etc/init.d/openvpn start</code> or use Luci (&#8220;Administration&#8221;, then &#8220;Services -> Initscripts&#8221;).</p>
<p><strong>Wireless</strong></p>
<p>Wireless doesn&#8217;t work out of the box, but it is easy to install. If you want to use WEP or WPA, install &#8220;wpad-mini&#8221;. If you want a more advanced mechanism like RADIUS or EAP, install the full &#8220;wpad&#8221; package. I preferred to install &#8220;wpad&#8221; rather than &#8220;wpad-mini&#8221;, so I could support other WPA authentication mechanisms. We&#8217;re always talking about replacing pre-shared keys with RADIUS at work, and the difference in package size is minimal, so I installed the full package.</p>
<pre>opkg update
opkg install kmod-ath9k wpad
rm -f /etc/config/wireless
wifi detect &gt; /etc/config/wireless</pre>
<p>After that I was able to configure wifi using Luci. You can configure multiple wifi networks but I found the ath9k driver (or chipset) didn&#8217;t support different encryption settings. For instance, you can have these:</p>
<ol>
<li>One network with WPA encryption</li>
<li>One network with WPA and one network with no encryption</li>
</ol>
<p>But you cannot have these:</p>
<ol>
<li>One network with WPA and one network with WEP</li>
<li>Two WPA networks with different keys</li>
</ol>
<p>I&#8217;ve read that it is possible to do this with software encryption, but it wasn&#8217;t sufficiently important to me to continue. If I really want to use my Nintendo DS, I&#8217;ll just crack a nearby WEP network or set up a temporary AP on spare hardware I have lying around.</p>
<p>I didn&#8217;t test 802.11n wireless, as I have no other hardware which supports it.</p>
<p><strong>USB</strong></p>
<p>The instructions for enabling USB support said to only install the packages you really need. However, the WZR-HP-G300NH has plenty of flash, and I found my FAT32 USB stick wouldn&#8217;t mount with just the UTF8 character set installed. So I installed support for all languages and filesystems.</p>
<pre>opkg install kmod-fs-btrfs kmod-fs-ext2 kmod-fs-ext3 kmod-fs-ext4 kmod-fs-isofs kmod-fs-reiserfs kmod-fs-vfat kmod-fs-xfs
opkg install kmod-nls-cp1250 kmod-nls-cp1251 kmod-nls-cp437 kmod-nls-cp775 kmod-nls-cp850 kmod-nls-cp852 kmod-nls-cp866 kmod-nls-iso8859-1 kmod-nls-iso8859-13 kmod-nls-iso8859-15 kmod-nls-iso8859-2 kmod-nls-koi8r kmod-nls-utf8
opkg install kmod-usb2 kmod-usb-storage kmod-usb-storage-extras block-hotplug block-mount hotplug2</pre>
<p>I then configured the USB drive to mount automatically.</p>
<pre>mkdir /mnt/usbstorage -p
uci set fstab.@mount[0].target=/mnt/usbstorage
uci set fstab.@mount[0].device=/dev/sda1
uci set fstab.@mount[0].fstype=auto
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit fstab
/etc/init.d/fstab enable
/etc/init.d/fstab restart</pre>
<p>I didn&#8217;t install Samba support. SSH/SCP/SSHFS works fine for me.</p>
<p><strong>HTTPS</strong></p>
<p>The default installation supports SSH but not HTTPS. This strikes me as a strange choice, but it&#8217;s easy to resolve:</p>
<pre>opkg install luci-ssl</pre>
<p>Luci didn&#8217;t answer HTTPS until I rebooted the router.</p>
<p><strong>SNMP</strong></p>
<p>I like Cacti, and I like graphing my router&#8217;s IP throughput. OpenWRT has two SNMP daemons: mini_snmpd and snmpd. Don&#8217;t use mini_snmpd. It only supports SNMP 1/2, and it doesn&#8217;t care about SNMP community &#8211; it gives SNMP data to anybody who asks for it. It also only runs if you install IPv6 support (package kmod-ipv6).</p>
<pre>opkg install snmpd</pre>
<p>SNMPd doesn&#8217;t have a Luci interface, but it is easy to configure from SSH. Login, and edit <code>/etc/config/snmpd</code>. Change the public and private communities to something less obvious, such as a random password generated by <a href="http://sourceforge.net/projects/pwgen/">pwgen</a> (also installable with opkg).</p>
<pre>config com2sec public
        option secname ro
        option source default
        option community aikeev4H

config com2sec private
        option secname rw
        option source localhost
        option community Heev7nai9aeg4foo3uN7otaing</pre>
<p>The private (write) community cannot do much to this device, but I prefer to set it to something very long and then forget about it. Then commit the change and start snmpd (either at command line or Luci&#8217;s Initscripts interface).</p>
<pre>uci commit snmpd
/etc/init.d/snmpd enable
/etc/init.d/snmpd start</pre>
<p><strong>UPNP, Avahi, and NTP Client</strong></p>
<p>I also installed UPNP, Avahi (MDNS), and NTP client support. UPNP and the NTP client can be configured through Luci, but Avahi doesn&#8217;t really have anything to configure. OpenVPN supports rdate out of the box, but I use NTP everywhere else, so why not here?</p>
<pre>opkg install avahi-daemon luci-app-ntpc luci-app-upnp miniupnpd ntpclient</pre>
<p>Enable them using the Luci Initscripts interface.</p>
<p><strong>Utilities</strong></p>
<p>Then I installed all the useful command-line apps that I like to use on routers.</p>
<pre>opkg install --force-overwrite bwm fdisk fping iftop ip iptables-utils lft lsof mtr net-tools-hostname ngrep nmap openssh-client rsync screen snmpd sshfs tcpdump</pre>
<p>openssh-client is necessary for SSH agent support, which Dropbear&#8217;s own SSH client doesn&#8217;t offer. I use this with SSHFS to mount my harddrive and dump tcpdump files over the network. This is dangerous, since tcpdump might sniff the SSHFS traffic. Always remember to exclude your own SSH traffic, or bad things will happen:</p>
<pre>tcpdump -i eth0 'not tcp port 22'</pre>
<p>iptables-utils provides iptables-save, which is a far more sane way to read iptables rules. I can&#8217;t even look at normal iptables output any more. fping is ping&#8217;s smarter, older, multi-tasking brother. In fact, just try and learn to use all of these utilities. You won&#8217;t regret it.</p>
<p><strong>OpenVPN</strong></p>
<p>OpenVPN installation is as easy as the rest:</p>
<pre>opkg install openvpn luci-app-openvpn</pre>
<p>Next, configure OpenVPN using Luci. It will appear under &#8220;Administration&#8221;, then &#8220;Services -> OpenVPN&#8221;. I have an OpenVPN server at work we wish to connect to, so I created a new configuration named &#8220;Work&#8221;, and then added entries for &#8220;Remote host&#8221; and &#8220;Type of used device&#8221; (we use tap, not tun). I then added &#8220;Certificate authority&#8221;, &#8220;Local certificate&#8221;, and &#8220;Local private key&#8221; and uploaded each of the files. I then started OpenVPN using the Initscripts interface.</p>
<p>OpenWRT uses firewall &#8220;zones&#8221; like &#8220;lan&#8221; and &#8220;wan&#8221; to distinguish between outside and inside traffic. Traffic from the &#8220;wan&#8221; zone which is unknown will be rejected, and traffic from the &#8220;lan&#8221; group will be masqueraded (NATed) and permitted to exit. This is an excellent design, but it doesn&#8217;t have an entry for &#8220;vpn&#8221;. I tried to create one using Luci (&#8220;Administration&#8221;, then &#8220;Network -&gt; Firewall&#8221;), but it doesn&#8217;t really work. This is because the firewall loads before OpenVPN. Therefore the tap/tun device does not yet exist, and no rules are added to the firewall to identify the OpenVPN traffic as part of the &#8220;vpn&#8221; zone. I tried reloading the firewall after OpenVPN, but this caused the WAN interface and VPN to drop, and never worked well no matter how I tried it.</p>
<p>I was really keen on using the Luci interface to configure the firewall, but in the end it was much easier to hack up a solution. I removed my &#8220;vpn&#8221; zone and just added some lines to /etc/firewall.user. This is a handy hook the developers added, a place to run custom commands after the firewall loads. Here is mine:</p>
<pre>root@gw-belafonte:~# cat /etc/firewall.user
# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.

# 2010-08-26 tyler - OpenVPN
iptables -I INPUT -i tap+ -j ACCEPT
iptables -I FORWARD -i tap+ -j ACCEPT
iptables -I FORWARD -o tap+ -j ACCEPT
iptables -t nat -A POSTROUTING -o tap+ -j MASQUERADE</pre>
<p>This means all traffic to/from VPN interfaces is accepted (&#8220;tap+&#8221; matches tap0, tap1, etc), and traffic to the VPN is masqueraded. A quick reboot, and the VPN started up, the firewall rules loaded correctly, and everything worked perfectly.</p>
<p><strong>LED Configuration</strong></p>
<p>This part is just plain fun. Using Luci (&#8220;Administration&#8221;, then &#8220;System -> LED Configuration&#8221;) you can control the behaviour of the LEDs on the front of the device. They can be set to stay on or off, can blink with activity, and can be tied to any network device. You can even set one to heartbeat at a rate tied to uptime load. On the WZR-HP-G300NH you can control these LEDs on the face: orange &#8220;security&#8221;, green &#8220;wireless&#8221; and &#8220;router&#8221;, red &#8220;diag&#8221;; and you can also control the blue &#8220;USB&#8221; light on the back just above the USB port. I was not able to make the USB LED turn on when a USB stick is mounted, but I was able to configure the first three lights on the face, so that I am alerted to activity on the LAN, WAN, and VPN interfaces. It&#8217;s nice to have a &#8220;lock&#8221; icon when the VPN is connected, as this is a useful external indicator of network trouble.</p>
<p><strong>Syslog</strong></p>
<p>OpenWRT supports logging to an external syslog server. Using Luci, see &#8220;Administration&#8221;, &#8220;System -> System&#8221;, and add additional field &#8220;External system log server&#8221;. Local logs are stored in a circular buffer, and are visible in Luci (&#8220;Administration&#8221;, then &#8220;Status -> System Log&#8221;) and from the command line with <code>logread -f</code>. This is very helpful for debugging OpenVPN problems like bad certificates and expired certificate due to a bad system time.</p>
<p><strong>QoS</strong></p>
<p>Quality of Service (QoS, or rate shaping) is done by the <code>qos-scripts</code> package:</p>
<pre>opkg install qos-scripts</pre>
<p>To configure it, edit /etc/config/qos and set your upload and download rates, and set rules to classify traffic. Then enable and start it using the Luci Initscripts interface. I have a fairly high-bandwidth connection at home and don&#8217;t really need QoS, so I don&#8217;t use it.</p>
<p><strong>Performance Metrics and Comparison</strong></p>
<p>Total remaining flash storage after all these packages are installed is 17.3 MB. This means the entire system plus my extras are installed in under half the available flash storage. RAM usage just after reboot, while running openvpn, miniupnp, avahi, dnsmasq, ntpclient, dropbear, uhttpd (Luci) with SSL support, and snmpd is 34 MB.</p>
<pre>root@gw-belafonte:/etc/config# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.8M      2.8M         0 100% /rom
tmpfs                    30.2M     88.0K     30.2M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock4           27.6M     10.3M     17.4M  37% /overlay
mini_fo:/overlay          2.8M      2.8M         0 100% /

root@gw-belafonte:/etc/config# free
              total         used         free       shared      buffers
  Mem:        61944        34208        27736            0         1864
 Swap:            0            0            0
Total:        61944        34208        27736</pre>
<p>So far it has handled Bittorrent without complaint. Kernel netfilter settings seem to be a fair balance of permissive and careful; TCP timeouts are one hour, UDP timeouts are 60 and 180 seconds, and conntrack can handle up to 16K connections. At 232 bytes each, netfilter connection tracking will consume just under 4 MB of RAM. This is significantly more than the Linksys could support. Edited for brevity:</p>
<pre>root@gw-belafonte:/etc/config# sysctl -a | grep tcp_timeout
net.netfilter.nf_conntrack_tcp_timeout_established = 3600

root@gw-belafonte:/etc/config# sysctl -a | grep udp_timeout
net.netfilter.nf_conntrack_udp_timeout = 60
net.netfilter.nf_conntrack_udp_timeout_stream = 180

root@gw-belafonte:/etc/config# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
16384</pre>
<p><a name="iperf" />I compared wifi throughput between a Linksys WRT54GL and the new Buffalo WZR-HP-G300NH. Thankfully I had a spare unit to replace the bricked WRT54GL. Tests were performed using iperf, transmitting UDP datagrams for 30 seconds at various speeds, and monitoring the test with bwm-ng. Data was sent between my gigabit-capable media PC on Ethernet and my laptop on 802.11g wireless. Maximum throughput on the Buffalo is nearly twice as fast as the Linksys:</p>
<p>17.5 mbit &#8211; Linksys WRT54GL running DD-WRT v24-sp1<br />
32.5 mbit &#8211; Buffalo WZR-HP-G300NH running OpenWRT 10.03</p>
<p><a name="commandsummary" /><strong>Command Summary</strong></p>
<p>For those that want to quickly install a setup similar to this, just run these commands at the terminal. This is really just for my own notes, in case I need to quickly reinstall.</p>
<pre>opkg update
opkg install kmod-ath9k wpad-mini
opkg install kmod-fs-btrfs kmod-fs-ext2 kmod-fs-ext3 kmod-fs-ext4 kmod-fs-isofs kmod-fs-reiserfs kmod-fs-vfat kmod-fs-xfs
opkg install kmod-nls-cp1250 kmod-nls-cp1251 kmod-nls-cp437 kmod-nls-cp775 kmod-nls-cp850 kmod-nls-cp852 kmod-nls-cp866 kmod-nls-iso8859-1 kmod-nls-iso8859-13 kmod-nls-iso8859-15 kmod-nls-iso8859-2 kmod-nls-koi8r kmod-nls-utf8
opkg install kmod-usb2 kmod-usb-storage kmod-usb-storage-extras block-hotplug block-mount hotplug2
opkg install --force-overwrite avahi-daemon bwm fdisk fping iftop ip iptables-utils kmod-ipv6 libnl lft lsof luci-app-ntpc luci-app-openvpn luci-app-upnp luci-ssl miniupnpd mtr net-tools-hostname ngrep nmap ntpclient openssh-client openvpn rsync screen snmpd sshfs tcpdump</pre>
<p>Warning: the ash command line is limited to 512 characters, which is a little under 7 lines at 80 characters wide. Beware of this when pasting long package lists or commands. The commands above all fit within that restriction.</p>
<p><strong>Conclusions</strong></p>
<p>The Buffalo WZR-HP-G300NH running OpenWRT 10.03 is a serious improvement over the Linksys WRT54GL with DD-WRT v24-sp1. It is capable of higher wired and wireless throughput, can support more software and more TCP/UDP sessions, and is more configurable. One drawback is that everything in DD-WRT is configurable through the web interface, whereas some settings in OpenWRT may only be configured at the command line. For example, DD-WRT offers a GUI for QoS. This is a complicated subject that benefits from a GUI, and in this area I think DD-WRT wins out. However, this is a symptom of features being introduced as packages faster than the GUI can be extended to support them. I&#8217;d rather have a feature with a text file interface than no feature at all.</p>
<p>A Buffalo WZR-HP-G300NH can be had from Amazon UK for £69, while a Linksys WRT54GL is £48. If you&#8217;re considering buying a new router, buy the Buffalo. If you are thinking about upgrading, 70 quid gets you a very capable improvement on your current router.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/09/01/openwrt-10-03-on-buffalo-wzr-hp-g300nh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Telnet URL handler, part 3</title>
		<link>http://www.tolaris.com/2010/08/27/telnet-url-handler-part-3/</link>
		<comments>http://www.tolaris.com/2010/08/27/telnet-url-handler-part-3/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:29:08 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1065</guid>
		<description><![CDATA[Philip continues to play devil&#8217;s advocate / script kiddie for my telnet URL handler. My input checker allowed host/port definitions to begin with a hyphen character. That&#8217;s an invalid domain name, so I ignored the possibility that someone might try it. Philip used it to pass a switch to the telnet/ssh command. Here is attempt [...]]]></description>
			<content:encoded><![CDATA[<p>Philip <a href="http://www.tolaris.com/2010/08/24/a-better-telnet-url-handler/comment-page-1/#comment-233">continues to play devil&#8217;s advocate / script kiddie</a> for my telnet URL handler. My input checker allowed host/port definitions to begin with a hyphen character. That&#8217;s an invalid domain name, so I ignored the possibility that someone might try it. Philip used it to pass a switch to the telnet/ssh command.</p>
<p><span id="more-1065"></span>Here is attempt number 3, now with more complicated regular expressions:</p>
<pre>#!/usr/bin/perl
# parse URL
($protocol,$host) = split /:\/\//, $ARGV[0];
($host,$port) = split /:/, $host;

# validate input
if ( $protocol !~ /^(telnet|ssh)$/ ||
   $host !~ /^[a-zA-Z0-9][a-zA-Z0-9.-]*$/ ||
   $port !~ /(^[a-zA-Z0-9][a-zA-Z0-9_-]*$|^$)/ ) {
        warn "Invalid URL";
        exit 1;
}

# if SSH, add -p argument
if ( $protocol eq "ssh" &#038;&#038; $port != '' ) { $port = "-p $port" ; }

# call terminal emulator
exec("konsole --hold -e $protocol $host $port");
exit;</pre>
<p>Your move, <em>sir</em>.</p>
<p>You can download an updated url-terminal script <a href='http://www.tolaris.com/blog/wp-content/uploads/2010/08/url-terminal1.gz'>here</a>. You can read the post that started this <a href="/2010/08/23/enabling-telnet-and-ssh-urls-in-firefox-for-linux/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/08/27/telnet-url-handler-part-3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A better telnet URL handler</title>
		<link>http://www.tolaris.com/2010/08/24/a-better-telnet-url-handler/</link>
		<comments>http://www.tolaris.com/2010/08/24/a-better-telnet-url-handler/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 21:48:40 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1044</guid>
		<description><![CDATA[After I wrote yesterday&#8217;s post, Philip reminded me of the dangers of not validating your inputs. Here is a better telnet/ssh handler which checks the URL passed to it. Update 2010-08-27: don’t use this script either! See my next post for a better one. #!/usr/bin/perl # parse URL ($protocol,$host) = split /:\/\//, $ARGV[0]; ($host,$port) = [...]]]></description>
			<content:encoded><![CDATA[<p>After I wrote yesterday&#8217;s post, <a href="http://www.tolaris.com/2010/08/23/enabling-telnet-and-ssh-urls-in-firefox-for-linux/comment-page-1/#comment-230">Philip reminded me</a> of the dangers of not validating your inputs. Here is a better telnet/ssh handler which checks the URL passed to it.</p>
<p><span id="more-1044"></span><em>Update 2010-08-27</em>: don’t use this script either! See my <a href="http://www.tolaris.com/2010/08/27/telnet-url-handler-part-3/">next post</a> for a better one.</p>
<pre>#!/usr/bin/perl
# parse URL
($protocol,$host) = split /:\/\//, $ARGV[0];
($host,$port) = split /:/, $host;

# validate input
if ( $protocol !~ /^(telnet|ssh)$/ || $host !~ /^[a-zA-Z0-9.-]+$/ || $port !~ /(^[a-zA-Z0-9_-]+$|^$)/ ) {
        warn "Invalid URL";
        exit 1;
}

# if SSH, add -p argument
if ( $protocol eq "ssh" &#038;&#038; $port != '' ) { $port = "-p $port" ; }

# call terminal emulator
exec("konsole --hold -e $protocol $host $port");
exit;</pre>
<p>This script only accepts <code>telnet://</code> and <code>ssh://</code> URLs, where the host is a valid domain name and the port is a valid port (including text aliases like &#8220;smtp&#8221; from <code>/etc/services</code>). It passes SSH port arguments correctly and tells Konsole to stay open after the session terminates.</p>
<p>You can download a more advanced form of this script <a href='http://www.tolaris.com/blog/wp-content/uploads/2010/08/url-terminal.gz'>here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/08/24/a-better-telnet-url-handler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Enabling telnet:// and ssh:// URLs in Firefox for Linux</title>
		<link>http://www.tolaris.com/2010/08/23/enabling-telnet-and-ssh-urls-in-firefox-for-linux/</link>
		<comments>http://www.tolaris.com/2010/08/23/enabling-telnet-and-ssh-urls-in-firefox-for-linux/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:45:22 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=1020</guid>
		<description><![CDATA[Firefox&#8217;s telnet protocol handler in Linux stopped working some time after version 3.0. I manage a network of switches, routers, and other devices with command-line interfaces. Wouldn&#8217;t it be nice to be able to click on telnet:// or ssh:// URLs again? As with most tinkering in firefox, start by typing &#8220;about:config&#8221; in the location bar. [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox&#8217;s telnet protocol handler in Linux stopped working some time after version 3.0. I manage a network of switches, routers, and other devices with command-line interfaces. Wouldn&#8217;t it be nice to be able to click on <code>telnet://</code> or <code>ssh://</code> URLs again?</p>
<p><span id="more-1020"></span>As with most tinkering in firefox, start by typing &#8220;about:config&#8221; in the location bar. Right click and select &#8220;New&#8221;, then &#8220;Boolean&#8221;. Create two entries:</p>
<pre>network.protocol-handler.expose.telnet = false
network.protocol-handler.expose.ssh = false</pre>
<p>Now, click on a <a href="telnet://nethack.alt.org">telnet</a> or <a href="ssh://localhost">SSH</a> URL, and Firefox will prompt you for the application to use. This application must handle the full URL as an argument. On Linux, the easiest solution is to choose <code>/usr/bin/xdg-open</code>. This will open the user&#8217;s preferred terminal, whether that is gnome-terminal, konsole, or xterm. You can use xdg-open to open almost any type of file or URL.</p>
<p>Alternatively, choose <code>/usr/bin/putty</code>, or use a simple script as follows. Edit the last line to call whatever application you prefer.</p>
<p><em>Update 2010-08-25:</em> don&#8217;t use this script. See my <a href="/2010/08/24/a-better-telnet-url-handler/">next post</a> for a better one.</p>
<pre>#!/usr/bin/perl
# take URL of form telnet://target:port and call konsole

# get protocol and host
($proto,$addr) = split /:\/\//, $ARGV[0];

# convert "host:port" to "host port" (port is optional)
$addr =~ s/\:/\ /g;

`konsole -e $proto $addr\n`;</pre>
<p>A bit of history, for the curious. You may find instructions online stating to create values like these:</p>
<pre>network.protocol-handler.app.telnet = "/usr/bin/putty"
network.protocol-handler.warn-external.telnet = false</pre>
<p>This is the old method, used in releases prior to Firefox 3.5. These settings are now ignored.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/08/23/enabling-telnet-and-ssh-urls-in-firefox-for-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>Saving passwords for multiple Skype accounts</title>
		<link>http://www.tolaris.com/2010/08/12/saving-passwords-for-multiple-skype-accounts/</link>
		<comments>http://www.tolaris.com/2010/08/12/saving-passwords-for-multiple-skype-accounts/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 21:20:23 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[skype]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=984</guid>
		<description><![CDATA[I have two Skype accounts; one for work, and one for personal use. Unfortunately, the Skype client for Linux is somewhat limited. It can store two usernames, but it saves only the last password entered. Tonight, I hacked up a solution. I ran the Skype binary from the command line, and saw this: tyler@baal:~$ skype [...]]]></description>
			<content:encoded><![CDATA[<p>I have two Skype accounts; one for work, and one for personal use. Unfortunately, the Skype client for Linux is somewhat limited. It can store two usernames, but it saves only the last password entered. Tonight, I hacked up a solution.</p>
<p><span id="more-984"></span>I ran the Skype binary from the command line, and saw this:</p>
<pre>tyler@baal:~$ skype --help
Skype 2.1.0.81

Usage: skype [options]
Options:
  --dbpath=
<path>       Specify an alternative path to store Skype data files.
                        Default: ~/.Skype
  --resources=
<path>    Specify a path where Skype can find its resource files.
                        Default: /usr/share/skype
  --disable-api         Disable Skype Public API.
  --pipelogin           Command line login. "echo username password | skype --pipelogin"
...</pre>
<p>This immediately suggested two possibilities.</p>
<ol>
<li>Create a script that reads usernames and passwords from a file, then calls <code>echo username password | skype --pipelogin</code>. Obviously the file is a security risk, but don&#8217;t fool yourself. The obfuscated password in the Skype configuration file is no safer.</li>
<li>Create a ~/.Skype-name directory for each account, and call <code>skype --dbpath ~/.Skype-name</code>. This has the advantage of letting Skype store the password, but means any configuration changes to Skype have to be made twice.</li>
</ol>
<p>I opted for the former, because I like writing bash scripts that call <a href="http://freshmeat.net/projects/zenity">zenity</a> or <a href="http://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs">kdialog</a>. First I created a file:</p>
<p><code>cat > ~/.Skype/passwords</code></p>
<pre>workuser1 password1
homeuser2 password2</pre>
<p><code>^Ctrl-D<br />
chmod 600 ~/.Skype/passwords</code></p>
<p>Then I wrote a simple script to do the following:</p>
<ol>
<li>Read the password file</li>
<li>Display a zenity dialog with a list of usernames</li>
<li>Find the password of the selected user</li>
<li>Call Skype</li>
</ol>
<p>Here it is: <a href='http://www.tolaris.com/blog/wp-content/uploads/2010/08/skype-fe.gz'>skype-fe</a>. It worked on the first try. It&#8217;s a total hack, and I love it. It is based on previous zenity scripts I&#8217;ve written, so it&#8217;s not quite as simple as I let on. It won&#8217;t shred your hard drive, I promise.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/08/12/saving-passwords-for-multiple-skype-accounts/feed/</wfw:commentRss>
		<slash:comments>0</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>Fixing BackupPC&#8217;s &#8220;Download Zip archive&#8221; restore option in Ubuntu Lucid</title>
		<link>http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/</link>
		<comments>http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 19:39:47 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backuppc]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[repo]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=949</guid>
		<description><![CDATA[We recently upgraded our BackupPC servers to Ubuntu 10.04 Lucid Lynx. It&#8217;s working almost perfectly. However, the &#8220;Download ZIP archive&#8221; restore option no longer works. This is due to a bug in recent version of the Archive::Zip Perl module which generates corrupt ZIP archives. Note to developers: when releasing new versions of your library, try [...]]]></description>
			<content:encoded><![CDATA[<p>We recently upgraded our BackupPC servers to Ubuntu 10.04 Lucid Lynx. It&#8217;s working almost perfectly. However, the &#8220;Download ZIP archive&#8221; restore option <a href="http://sourceforge.net/mailarchive/message.php?msg_name=4BE98532.4070001%40mail.ru">no longer works</a>. This is due to a bug in recent version of the Archive::Zip Perl module which generates corrupt ZIP archives.</p>
<p><span id="more-949"></span>Note to developers: when releasing new versions of your library, try to avoid breaking its <em>core functionality</em>.</p>
<p>If you try decompressing a corrupted file, you&#8217;ll see a message like this:</p>
<pre>tyler@laptop:~$ unzip restore.zip
Archive:  restore.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of restore.zip or
        restore.zip.zip, and cannot find restore.zip.ZIP, period.</pre>
<p>I posted a solution on the mailing list. I&#8217;ve since uploaded an older version (1.18-1) of this package to <a href="http://www.tolaris.com/apt-repository">my repository</a>, so the process is even more streamlined.</p>
<p>If you are using my repo:<br />
<code>apt-get install libarchive-zip-perl=1.18-1<br />
echo "libarchive-zip-perl hold" | dpkg --set-selections</code></p>
<p>If you aren&#8217;t using my repo but want a quick fix:<br />
<code>wget http://www.tolaris.com/apt/pool/main/liba/libarchive-zip-perl/libarchive-zip-perl_1.18-1_all.deb<br />
dpkg -i libarchive-zip-perl_1.18-1_all.deb<br />
echo "libarchive-zip-perl hold" | dpkg --set-selections</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/07/21/fixing-backuppcs-download-zip-archive-restore-option-in-ubuntu-lucid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox extension: New MitM Me</title>
		<link>http://www.tolaris.com/2010/07/16/firefox-extension-new-mitm-me/</link>
		<comments>http://www.tolaris.com/2010/07/16/firefox-extension-new-mitm-me/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 19:45:17 +0000</pubDate>
		<dc:creator>Tyler Wagner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=941</guid>
		<description><![CDATA[I&#8217;m an engineer. I understand SSL, public-key encryption, man-in-the-middle (MitM) attacks, and certificate chains-of-trust. I look carefully at the URL bar before entering login or personal data, I don&#8217;t allow javascript to change the status bar, and I mouse over a URL and read it before I click. I&#8217;m paranoid as all hell, and I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m an engineer. I understand SSL, public-key encryption, man-in-the-middle (MitM) attacks, and certificate chains-of-trust. I look carefully at the URL bar before entering login or personal data, I don&#8217;t allow javascript to change the status bar, and I mouse over a URL and read it before I click. I&#8217;m paranoid as all hell, and I do not fall for stupid fraud schemes.</p>
<p><span id="more-941"></span>I regularly interact with hundreds of SSL-enabled devices as part of my job. I don&#8217;t allow HTTP or telnet interfaces to devices that support HTTPS or SSH. These devices usually have self-signed certificates, and it is not always convenient (or possible, with some devices) to replace them with certs signed by the company&#8217;s root <a href="http://en.wikipedia.org/wiki/Certificate_authority">CA</a>. This wasn&#8217;t a problem when all I had to do was bypass one error dialog. But then Firefox replaced this dialog with an extremely annoying 5-step dance. I&#8217;m tired of it.</p>
<p>Enter <a href="https://addons.mozilla.org/en-GB/firefox/addon/79787/">New MitM Me</a>, a Firefox plugin to restore the old SSL error behaviour. Now Firefox still displays the &#8220;This Connection is Untrusted&#8221; page. But when you click the &#8220;Add Exception&#8230;&#8221; button, that&#8217;s it, <em>you&#8217;re done</em>.</p>
<p>I do not recommend that the average user install this plugin. For a casual user, this increases the chance of being defrauded. But if you are like me, if you truly know what you are doing and want to save some time, install it.</p>
<p>Has anyone hacked this plugin to restrict its behaviour to specific IP ranges, or to allow me to choose temporary or permanent with just one click?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2010/07/16/firefox-extension-new-mitm-me/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
