<?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>Aaron Toponce</title>
	<atom:link href="http://pthree.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://pthree.org</link>
	<description>Linux.  GNU.  Freedom.</description>
	<lastBuildDate>Sat, 13 Mar 2010 14:44:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>Irssi Handling JOINS/PARTS/QUITS</title>
		<link>http://pthree.org/2010/03/12/irssi-handling-joinspartsquits/</link>
		<comments>http://pthree.org/2010/03/12/irssi-handling-joinspartsquits/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 04:46:09 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1326</guid>
		<description><![CDATA[Irssi, as blogged extensively throughout this site, is one solid client. The flexibility never ceases to amaze me, and tonight was one of those times.
Hanging out in the amount of channels I do, I see a lot of activity in my statusbar for all of my joined channels. This can be overwhelming for some, but [...]]]></description>
			<content:encoded><![CDATA[<p>Irssi, as blogged extensively throughout this site, is one solid client. The flexibility never ceases to amaze me, and tonight was one of those times.</p>
<p>Hanging out in the amount of channels I do, I see a lot of activity in my statusbar for all of my joined channels. This can be overwhelming for some, but I don&#8217;t mind it. What I do mind, however, is when I check in on a specific channel, and see pages and pages of scrollback that is nothing more than people joining and leaving the channel. I&#8217;ve tried blatantly ignoring JOINS, PARTS and QUITS, as they&#8217;re called, but I always disable it, because I usually want to be kept abreast of when someone leaves a channel that I&#8217;m having a conversation with. I don&#8217;t want to look silly continuing to chat to someone, long after they&#8217;ve left. So, I need a way to keep on top of when people are joining and leaving the channel, but not have that information in the channel itself. Thankfully, Irssi meets this need.</p>
<p>The concept is simple. A JOIN, PART or QUIT is what is referred to as a &#8220;level&#8221;. There are a number of different levels that Irssi supports, all of which can be found with &#8220;/help levels&#8221; in Irssi. With Irssi, it is possible to ignore, or even redirect, levels. In my case, I want to redirect these three levels to another window, if possible. So, digging through the settings in Irssi, I found &#8220;window_check_level_first&#8221;. By default, this setting is &#8220;OFF&#8221;, which means that Irssi has a global setting for levels, and how they&#8217;re handled. Enabling this setting, means to follow the levels that have been assigned to their respective channels. However, if you turn this on first, without doing some initial setup before hand, you&#8217;ll notice everything going to your status window by default, including chat. This isn&#8217;t what we want, so let&#8217;s get setup.</p>
<p>The first thing we need to do is set our levels for all of our currently open windows, as well as any future windows that we open. We can accomplish this with two commands in Irssi:</p>
<pre>/foreach window /window level ALL -JOINS -PARTS -QUITS
/set window_default ALL -JOINS -PARTS -QUITS</pre>
<p>Now, the next thing to do is to create a new hidden window that will be the new home for all your JOINS, PARTS and QUITS. So, from Irssi:</p>
<pre>/window new HIDDEN</pre>
<p>Navigate to that window, wherever it is placed, and give it a name. For me, I called it &#8220;junk&#8221;. Of course, this isn&#8217;t necessary, just optional, but I prefer that each of my windows have a name:</p>
<pre>/window name junk</pre>
<p>It will have picked up the -JOINS -PARTS -QUITS from our default setting we just applied, so we&#8217;ll need to reverse that. Easiest way is to just apply the converse of what you did earlier:</p>
<pre>/window level -ALL JOINS PARTS QUITS</pre>
<p>Sweet. Our window is finished. Now, we can turn on the setting that will tell Irssi to look for each individual window level setting:</p>
<pre>/set window_check_level_first ON</pre>
<p>Wait a bit, and you should see all the JOINS, PARTS and QUITS going to your new hidden window, rather than each respective channel. You&#8217;ll also notice that it doesn&#8217;t print the channel where these are originating. I don&#8217;t know of an easy way to set that without a script, so if you know of such a script that exists, or want to write one yourself, sharing that would be appreciated. In the meantime, this is better than nothing.</p>
<p>Don&#8217;t forget to save:</p>
<pre>/save</pre>
<p>Also, you may not want to make your &#8220;junk&#8221; window hidden, but rather make it sticky, and split Irssi, putting the junk window on the top. I&#8217;ve done this with my highlight window, so it would make sense here. In that case, just:</p>
<pre>/window stick on
/window show (number|name)</pre>
<p>You can then size the window as needed if you decide you split your Irssi.</p>
<p>And, there you have it. Now, when people are joining and quitting, rather than filling your scrollback where precious chat exists, it&#8217;s all being forwarded to a window of your choice. If eventually, you like this setup, and you find that you&#8217;re not checking your junk window for joins and quits, then you may be able to get away with just ignoring JOINS, PARTS and QUITS altogether Irssi-wide. Which means, if for any reason you want to reverse this setup, it&#8217;s rather trivial:</p>
<pre>/set window_check_level_first OFF
/foreach window /window level ALL
/set window_default ALL
/window close
/save</pre>
<p>And that would back you out of this configuration, and get you back to default.</p>
<p>I should mention that I&#8217;ve heard that WeeChat has a feature that only people you&#8217;ve recently chatted with will show when they quit, or there is a setting for setting this. I personally think WeeChat is a solid client. However, in this case, I don&#8217;t want to see any quits, even with those I&#8217;m chatting with, in that buffer. However, I would like to see it in another buffer, and Irssi makes this painless. So, while I&#8217;m sure WeeChat can also meet similar needs, Irssi meets my needs best.</p>
<p>As with my other Irssi tutorials, I hope this one was helpful. I find that I personally benefit from my own writing, and that&#8217;s the major reason why I blog. I have searched for doing solving problems in the past, only to stumble upon my own blog post, outlining the very issue I&#8217;m faced with again. So, if it won&#8217;t benefit you, at least it will benefit myself.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/03/12/irssi-handling-joinspartsquits/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing Debian via USB</title>
		<link>http://pthree.org/2010/02/21/installing-debian-via-usb/</link>
		<comments>http://pthree.org/2010/02/21/installing-debian-via-usb/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 15:50:27 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1314</guid>
		<description><![CDATA[Last night, I wanted to see if I could get Debian Squeeze loaded on my HP Mini 110, so I set out to accomplish the task, and accomplish it I did. As with most netboks, this HP doesn&#8217;t ship with a CDROM. So, the only way to get an operating system on this guy is [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I wanted to see if I could get Debian Squeeze loaded on my HP Mini 110, so I set out to accomplish the task, and accomplish it I did. As with most netboks, this HP doesn&#8217;t ship with a CDROM. So, the only way to get an operating system on this guy is either with PXE, or USB (actually, I don&#8217;t even know if PXE-booting works). So, I grabbed an unused USB thumb drive, and set to work.</p>
<p>Before beginning any installation, you should be very familiar with your hardware, so you know what sort of drivers you&#8217;ll need for the installation, and if there will be any compatibility issues. Attempting to put Debian on this machine in the past has failed, due to the network driver not shipping with the Lenny kernel. If you have this netbook, the NIC is an Attansic Technology Atheros AR8132/L1c gigabit ethernet adapter. The driver is open source, however, the hardware is so new, that at the time I had purchased the Mini, the driver hadn&#8217;t been included in the mainline kernel. The wireless is a Broadcom BCM4132, which means the firmware is not open source, and as a result, not included with the Debian installer. So, at the time, there was no way to get this netbook online with Debian. However, with the release of the 2.6.29 kernel, the Aetheros driver needed was included, and the development snapshot of the installer now ships that kernel, so we&#8217;re good to go with a network installation, and getting the computer online.</p>
<p>All the other hardware that I&#8217;ve tested, I have tested before with different hardware other than the Mini, and worked out of the box. So, the installation should be rather straightforward, and booting in the new system should be on par with a working system.</p>
<p>So, in order to perform a Debian GNU/Linux installation via USB, you need only a few things. First, you must grab a boot.img.gz file from the development snapshot of the installer for your hardware. Because the HP Mini is x86 32-bit, <a href="http://mirrors.kernel.org/debian/dists/sid/main/installer-i386/current/images/hd-media/">I grabbed mine here</a>. Now, you also need a CD image file (ISO format) which will contain the necessary software and installation procedures for the install. I prefer to do network installs, so <a href="http://mirrors.kernel.org/debian-cd/5.0.4/i386/iso-cd/">I grabbed a netinst ISO here</a>.</p>
<p>The boot.img.gz file will contain a bootable syslinux kernel and initial ramdisk, which means it will have the drivers necessary for your hardware. Of course, I got mine from a development snapshot, so I could get the Atheros NIC driver from the latest kernel, but if you have older hardware, maybe the stable version of the boot.img.gz would work better for you. You just need to get it from any hd-media directory appropriate for your architecture. The ISO on the other hand contains the base software for installing to disk, the partitioner and other parts of the installer necessary for performing the installation. The boot.img.gz just gets you started.</p>
<p>Now that you have both files, you&#8217;ll need a USB thumb drive that is at least 256MB in size, which shouldn&#8217;t be a problem these days. Insert the USB drive into a  computer with a working Linux operating system, and determine the appropriate device assigned to your newly inserted drive. You can get this information a number of ways. Probably the best way, is to run the following command before you insert the USB drive:</p>
<pre># tail -f -n 0 /var/log/messages</pre>
<p>Then, insert the drive. You&#8217;ll see output from the kernel as it discovers the hardware and assigns a device to the drive. For me, my output was this:</p>
<pre>Feb 21 08:22:28 hermes kernel: [46103.644130] usb 1-7: new high speed USB device using ehci_hcd and address 7
Feb 21 08:22:28 hermes kernel: [46103.789569] usb 1-7: New USB device found, idVendor=13fe, idProduct=1e00
Feb 21 08:22:28 hermes kernel: [46103.789586] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 21 08:22:28 hermes kernel: [46103.789599] usb 1-7: Product: USB DISK 2.0
Feb 21 08:22:28 hermes kernel: [46103.789609] usb 1-7: Manufacturer:
Feb 21 08:22:28 hermes kernel: [46103.789618] usb 1-7: SerialNumber: 077904015F40
Feb 21 08:22:28 hermes kernel: [46103.789974] usb 1-7: configuration #1 chosen from 1 choice
Feb 21 08:22:28 hermes kernel: [46103.790939] scsi5 : SCSI emulation for USB Mass Storage devices
Feb 21 08:22:33 hermes kernel: [46108.838495] scsi 5:0:0:0: Direct-Access              USB DISK 2.0     PMAP PQ: 0 ANSI: 0 CCS
Feb 21 08:22:33 hermes kernel: [46109.101380] sd 5:0:0:0: [sdb] 4030464 512-byte logical blocks: (2.06 GB/1.92 GiB)
Feb 21 08:22:33 hermes kernel: [46109.101984] sd 5:0:0:0: [sdb] Write Protect is off
Feb 21 08:22:33 hermes kernel: [46109.107382]  sdb:
Feb 21 08:22:33 hermes kernel: [46109.174851] sd 5:0:0:0: [sdb] Attached SCSI removable disk</pre>
<p>So, in my case, the newly inserted drive is /dev/sdb. So, armed with this information, I can now prepare the USB drive. This next step should be handled with caution. If you type in, whether intentionally or accidentally the wrong device, disasterous consequences may abound. As a friend once told me: &#8220;read twice, type once&#8221;. Think what you&#8217;re doing before you do it. So, at this point, I just need to send the contents of the boot.img.gz file to the new disk. I would not recommend doing it to a partition, but instead doing it to the whole drive. If you inserted your thumb drive, and you noticed in the output that you have a /dev/sdb and /dev/sdb1, then this means you have a partition table outlining a single partition on the drive /dev/sdb. Ignore the partition, work with the drive itself.</p>
<p>Make sure your USB drive is NOT mounted, then type in the following (this next step will remove any existing partitions and data on the drive):</p>
<pre># umount /dev/sdb*
# zcat boot.img.gz > /dev/sdb</pre>
<p>This should only take a couple of seconds to finish. At this point, you&#8217;ll have a FAT16 formatted USB drive with a syslinux install on the drive. You will now need to mount the drive and copy the ISO image to the mount point.</p>
<pre># mount /dev/sdb /mnt
# cp debian-504-i386-netinst.iso /mnt
# sync
# umount /dev/sdb</pre>
<p>At this point, you have a fully prepared USB thumb drive with all the necessary bits in place to perform a USB installation on your netbook, or other hardware. When you boot from the USB stick, you&#8217;ll have the familiar Debian installer interface- automated installation, beginner and expert modes and a rescue environment. Because of this, I would recommend keeping the USB stick close at hand, should you need to troubleshoot your installation any time soon.</p>
<p>When you initialize the installation, the installer will look for an ISO file that contains the Debian software. It will start with /dev/sda, and work it&#8217;s way device-by-device and partition-by-partition in order, until it finds the ISO file. Because my drive is also recognized as /dev/sdb on my netbook, it only take a couple seconds. After it has found the ISO image, you&#8217;re ready to install, just like you would if you had booted off a CD.</p>
<p>That&#8217;s it! Rather straightforward, I think. You only need four times really to complete the job:</p>
<ul>
<li>You computer</li>
<li>A USB disk</li>
<li>A boot.img.gz file</li>
<li>An ISO containing the Debian software</li>
</ul>
<p>Good luck on your USB installs!</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/21/installing-debian-via-usb/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Facebook Chat In Bitlbee</title>
		<link>http://pthree.org/2010/02/13/facebook-chat-in-bitlbee/</link>
		<comments>http://pthree.org/2010/02/13/facebook-chat-in-bitlbee/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 08:22:24 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1306</guid>
		<description><![CDATA[It&#8217;s no surprise that Bitlbee is my chat client of choice. After all, I&#8217;ve blogged about it before. So, when I heard rumors that Facebook would be releasing their chat to outside clients over XMPP, I was excited to see the day when I could add it to my running Bitlbee instance. Lo and behold, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s no surprise that Bitlbee is my chat client of choice. After all, I&#8217;ve blogged about it before. So, when I heard rumors that Facebook would be releasing their chat to outside clients over XMPP, I was excited to see the day when I could add it to my running Bitlbee instance. <a href="http://www.facebook.com/sitetour/chat.php">Lo and behold, that day has come</a>.</p>
<p>Adding your Facebook account to Bitlbee is rather painless, as it is with any other account. The only catch, is you have to have a <a href="http://www.facebook.com/username/">Facebook username</a> set before you can continue. Once that is set, in Bitlbee, from your &#8220;&#038;btilbee&#8221; status window, you can add the account:</p>
<pre>account add jabber &lt;username&gt;@chat.facebook.com &lt;password&gt;
save
account on</pre>
<p>That&#8217;s it! You should be up and running with a new XMPP connection to the Facebook chat. However, rather quickly, you&#8217;ll notice that the usernames in your &#8220;blist&#8221; roster are their user identification number on Facebook, rather than their name. Something like &#8220;u123456789&#8243;. Who is that you wonder? Well, in your &#8220;&#038;bitlbee&#8221; window, you could run:</p>
<pre>info u123456789</pre>
<p>Then, using that information, you could rename them one-by-one as they login. However, this is a pain. Fortunately, if you&#8217;re running Bitlbee with Irssi, then there is an Irssi Perl script for renaming these automatically for you, as they login. <a href="http://browsingtheinternet.com/temp/bitlbee_rename.txt">You can find that script here</a>. Save it as &#8220;bitlbee_rename.pl&#8221; in your &#8220;~/.irssi/scripts directory, create a symlink in the autorun directory, load it, and you&#8217;re set. Here&#8217;s what you would do behind the command line:</p>
<pre>wget -O ~/.irssi/scripts/bitlbee_rename.pl http://browsingtheinternet.com/temp/bitlbee_rename.txt
ln -s ~/.irssi/scripts/bitlbee_rename.pl ~/.irssi/scripts/autorun/bitlbee_rename.pl</pre>
<p>Now in Irssi, load it:</p>
<pre>/RUN bitlbee_rename.pl</pre>
<p>Now, each of your Facebook buddies will have their user ID number renamed to &#8220;FirstnameLastname&#8221; format. The script only works for Facebook chat, so no worries about it mucking up other XMPP connections, and it only renames buddies that haven&#8217;t already been renamed. It also saves it to your Bitlbee config (which is /var/lib/bitlbee/username.xml) every time it renames a buddy.</p>
<p>So, there you go. Bitlbee, XMPP and now Facebook, married together. What a beautiful relationship.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/13/facebook-chat-in-bitlbee/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Irssi&#8217;s /channel, /network, /server and /connect &#8211; What It Means</title>
		<link>http://pthree.org/2010/02/02/irssis-channel-network-server-and-connect-what-it-means/</link>
		<comments>http://pthree.org/2010/02/02/irssis-channel-network-server-and-connect-what-it-means/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 14:30:14 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1278</guid>
		<description><![CDATA[I have found, that since using Irssi, many people like to edit the config directly. This is a natural instinct that we have as hackers in general. Because configs are stored in plain text, such as our shell RC files, Apache configs and many more, we just intuitively reach for our editor, and start hacking [...]]]></description>
			<content:encoded><![CDATA[<p>I have found, that since using <a href="http://irssi.org">Irssi</a>, many people like to edit the config directly. This is a natural instinct that we have as hackers in general. Because configs are stored in plain text, such as our shell RC files, Apache configs and many more, we just intuitively reach for our editor, and start hacking away. Unfortunately, the Irssi config is anything but clean. It uses a noisy syntax that makes it easy to make mistakes, and as a result, lose settings in Irssi, or have a broken Irssi entirely.</p>
<p>When I used to teach system administrators for a living, I gave them the mantra that if you have a tool that can modify a config file, use the tool. The tool has most likely been tested for bugs, and will generate syntactically correct configs. Humans are error-prone, so editing a config by hand means setting yourself up for error and pain. For Irssi, the developers have put in rather extensive commands that can modify everything in the config directly, and there&#8217;s even an exhaustive documentation support structure behind those commands. So, there should be no reason to edit the Irssi config by hand.</p>
<p>To show this, in irssi, go to the status window, and type &#8220;/help&#8221;:</p>
<pre>/help
05:29 Irssi commands:
05:29 accept     disconnect  lastlog  op        script     unquery
05:29 action     echo        layout   oper      scrollback unsilence
05:29 admin      eval        links    otr       server     upgrade
05:29 alias      exec        list     part      servlist   uping
05:29 away       flushbuffer load     ping      set        uptime
05:29 ban        foreach     log      query     sethost    userhost
05:29 beep       format      lusers   quit      silence    ver
05:29 bind       hash        map      quote     squery     version
05:29 cat        help        me       rawlog    squit      voice
05:29 cd         hilight     mircdcc  recode    stats      wait
05:29 channel    ignore      mode     reconnect statusbar  wall
05:29 clear      info        motd     redraw    time       wallops
05:29 completion invite      msg      rehash    toggle     who
05:29 connect    ircnet      names    reload    topic      whois
05:29 ctcp       ison        nctcp    resize    trace      whowas
05:29 cycle      join        netsplit restart   ts         window
05:29 dcc        kick        network  rmreconns unalias
05:29 dehilight  kickban     nick     rmrejoins unban
05:29 deop       kill        note     rping     unignore
05:29 devoice    knock       notice   save      unload
05:29 die        knockout    notify   sconnect  unnotify   </pre>
<p>So, long story short, don&#8217;t edit the config. Use the commands, and learn the help system. With that out of the way, let&#8217;s begin.</p>
<p>I&#8217;ve encountered many who are using Irssi that don&#8217;t understand how a few key commands relate with each other and how to tie them in. So, I would like to cover those commands here, namely: /channel, /network, /server and /connect. Hopefully, by the end of this post, not only will you be comfortable enough with the commands I&#8217;ve taught you about, but you&#8217;ll be comfortable enough to use the built-in documentation should you be stuck.</p>
<p><strong>/network</strong><br />
The first command to learn is /network, because all the rest of the commands take advantage of it. So, we&#8217;ll start there. /network is used for defining some client-specific settings you want to apply when connecting to a server. These settings can include username, real name, nickname, usermodes and other goodies. Running &#8220;/help network&#8221; can show you everything it supports:</p>
<pre>05:32 NETWORK ADD [-nick &lt;nick&gt;] [-user &lt;user&gt;] [-realname &lt;name&gt;] [-host &lt;host&gt;] [-autosendcmd &lt;cmd&gt;] [-querychans &lt;count&gt;] [-whois &lt;count&gt;] [-msgs &lt;count&gt;] [-kicks &lt;count&gt;] [-modes &lt;count&gt;] [-cmdspeed &lt;ms&gt;] [-cmdmax &lt;count&gt;] &lt;name&gt;
05:32 NETWORK REMOVE &lt;network&gt;
05:32
05:32      -kicks: Maximum number of nicks in one /KICK command
05:32      -msgs: Maximum number of nicks in one /MSG command
05:32      -modes: Maximum number of mode changes in one /MODE command
05:32      -whois: Maximum number of nicks in one /WHOIS command
05:32      -cmdspeed: Same as /SET cmd_queue_speed, see section 3.1
05:32      -cmdmax: Same as /SET cmds_max_at_once, see section 3.1
05:32      -nick, -user, -realname: Specify what nick/user/name to use
05:32      -host: Specify what host name to use, if you have multiple
05:32      -usermode: Specify what usermode to use on this network
05:32      -autosendcmd: Command to send after connecting to a server
05:32
05:32 With -autosendcmd argument you can automatically run any commands after connecting to network. This is useful for automatically identifying yourself to NickServ, for example
05:32
05:32 Shows and changes the settings of defined IRC networks.
05:32
05:32 See also: CONNECT
05:32
05:32 Irssi commands:
05:32 network add network list network remove </pre>
<p>So, let&#8217;s go ahead an define some networks. I personally connect to several networks simultaneously, all of which have different usermodes, and some which I need to provide authentication to when connecting. So, let&#8217;s say I wish to define client-specific connections to Freenode, OFTC and bitlbee. Let&#8217;s look at what to add. Oh, by the way, every command and option provided by Irssi can be tab-completed. Worth knowing to save some typing.</p>
<pre>/network add -user 88 -realname eightyeight -nick eightyeight -usermode +iw freenode
/network add -user 88 -realname eightyeight -nick eightyeight -usermode +w oftc
/network add -user aaron -realname "Aaron Toponce" -nick aaron -autosendcmd "say identify password" bitlbee</pre>
<p>As you can see, each network line is different. I&#8217;m using the same username, real name and nick for &#8220;freenode&#8221; and &#8220;oftc&#8221;, but different ones for &#8220;bitlbee&#8221;. I&#8217;ve specified different user modes with &#8220;freenode&#8221; and &#8220;oftc&#8221; where I haven&#8217;t provided any with &#8220;bitlbee&#8221;. Further, with &#8220;bitlbee&#8221;, I&#8217;m sending an identify command to the server when I connect. As you can probably imagine, this gives me great flexibility on how I want my client to interact with different servers.</p>
<p>Running &#8220;/network list&#8221; should show you the three servers you just added:</p>
<pre>/network list
05:48 Networks:
05:48 freenode: nick: eightyeight, username: 88, realname: eightyeight, usermode: +iw
05:48 bitlbee: nick: aaron, username: 88, realname: Aaron Toponce, autosendcmd: say identify password
05:48 oftc: nick: eightyeight, username: 88, realname: eightyeight, usermode: +w</pre>
<p>If you&#8217;ve just installed Irssi, you will likely find many networks already defined, including OFTC. If this is the case, and you want to make some adjustments to the OFTC definition, go ahead and provide those in the &#8220;/network add&#8221; command, and those options will be appended, provided the network name is the same. If you wish to remove any of the networks, then as you learned in the help doc, &#8220;/network remove name&#8221; is the syntax for that.</p>
<p>It&#8217;s important to note that at this stage of the game, any of the commands you enter in Irssi are only used for the current running session. If you wish to keep the settings persistent, then you will need to save it to disk (your config). You can do this with the &#8220;/save&#8221; command. I would recommend saving often when manipulating Irssi. Further, if for some reason you make a mistake in the command you&#8217;re typing, and you wish to revert back to the previous &#8220;/save&#8221; command, then you can use &#8220;/reload&#8221; for this purpsoe. &#8220;/reload&#8221; will read the config, and load the settings it finds there, ignoring any previous settings you&#8217;ve defined without saving.</p>
<p><strong>/channel</strong><br />
Now with our networks defined for our client settings, let&#8217;s define some channels to visit when we connect to these networks. So, in the status window, what does &#8220;/help channel&#8221; show?</p>
<pre>05:56 CHANNEL LIST
05:56 CHANNEL ADD [-auto | -noauto] [-bots &lt;masks&gt;] [-botcmd &lt;command&gt;] &lt;channel&gt; &lt;network&gt; [&lt;password&gt;]
05:56 CHANNEL REMOVE &lt;channel&gt; &lt;network&gt;
05:56
05:56 Irssi can automatically join to specified channels in specified IRC networks. It can also automatically send the password when manually joining to channel without specifying the password.
05:56
05:56 /CHANNEL ADD [-auto | -noauto] [-bots &lt;masks&gt;] [-botcmd &lt;command&gt;]
05:56              &lt;channel&gt; &lt;network&gt; [&lt;password&gt;]
05:56
05:56 With -bots and -botcmd arguments you can automatically send commands to someone in channel. This is useful for automatically getting ops for channels, for example
05:56
05:56 /CHANNEL ADD -auto -bots "*!bot@bothost.org bot*!*@host2.org"
05:56              -botcmd "msg $0 op mypass" #channel ircnet
05:56
05:56 You can also use the -botcmd without -bots argument. The command is then sent whenever you join the channel.
05:56
05:56 If you want to remove some settings from existing channel record, for example bots, just give the -bots "" parameters to it. Password can be removed by setting it to - (or actually, "" works too).
05:56
05:56 You can remove the channels with /CHANNEL REMOVE &lt;channel&gt; &lt;network&gt;
05:56
05:56 /CHANNEL LIST displays list of channels with settings.
05:56
05:56 /CHANNEL without any arguments displays list of channels you have joined. You can also use /CHANNEL to join to channels just as with /JOIN, like /CHANNEL #a.
05:56
05:56 See also: TS, JOIN
05:56
05:56 Irssi commands:
05:56 channel add channel list channel remove </pre>
<p>As you can clearly see with &#8220;/channel&#8221;, we can define what channels to join, and if any, what bot commands to send to the channel when we join. Each channel we join will be based on the network that we&#8217;ve previously defined. So, I could join #ubuntu whenever I connect to the Freenode network and #debian whenever I connect to the OFTC network. As with &#8220;/network&#8221;, on a fresh install of Irssi, there may already be a couple channels defined. Feel free to keep them in play when using Irssi, or remove them with &#8220;/channel remove&#8221; as per the syntax in the help doc.</p>
<p>So, let&#8217;s define some channels:</p>
<pre>/channel add -auto #ubuntu freenode
/channel add -auto #freenode freenode
/channel add -auto #debian oftc
/channel add -auto #bitlbee oftc</pre>
<p>Pretty straight forward, right? I&#8217;ve added four channels, two on the &#8220;freenode&#8221; network and two on the &#8220;oftc&#8221; network. Because Bitlbee doesn&#8217;t handle &#8220;channels&#8221; necessarily the same way IRC servers do, I haven&#8217;t defined any channels to join when I connect to Bitlbee. Notice I&#8217;m passing the &#8220;-auto&#8221; switch, so when I join that network, I&#8217;ll automatically join those channels. This is entirely optional, and &#8220;-noauto&#8221; is default if &#8220;-auto&#8221; isn&#8217;t passed.</p>
<p>As with &#8220;/network&#8221;, you can append settings to each channel listing as needed, as long as the channel name and network name are the same. If you wish to remove some settings, then you&#8217;ll need to &#8220;/channel remove&#8221; and &#8220;/channel add&#8221; as appropriate. Running &#8220;/channel list&#8221; should show our progress thus far:</p>
<pre>/channel list
06:05 Channel         Network    Password   Settings
06:05 #ubuntu         freenode              autojoin
06:05 #freenode       freenode              autojoin
06:05 #debian         oftc                  autojoin
06:05 #bitlbee        oftc                  autojoin</pre>
<p>Again, you should run &#8220;/save&#8221; when you&#8217;ve defined your channels, so next time you start Irssi, your settings won&#8217;t be lost.</p>
<p>One last related note about your channels. For me, I get very used to the location, or layout, of my channels. When I lose my running Irssi connection, for whatever reason, nothing is more frustrating than the channels being in a different order than previous. Fortunately, I&#8217;m not the only one that this annoys, so the developers have provided &#8220;/layout save&#8221; as a way to keep my sanity. &#8220;/layout save&#8221; will save the location order of your channel windows, so should you join a channel again, it will go to the same location as it was in previously. However, as with every other command in Irssi, this will only save it to your currently running session in RAM. If you wish to keep it persistent, you must issue &#8220;/save&#8221; for the next time you start Irssi.</p>
<p><strong>/server</strong><br />
At this point, we&#8217;re ready to connect. We have all the details out of the way, and we could easily just connect to Freenode or OFTC. However, we may want to pass some server-side options to the networks, such as connecting via SSL. So, before covering &#8220;/connect&#8221;, let&#8217;s get &#8220;/server&#8221; out of the way, as it&#8217;s the last command in this post that does any saving to disk, then we&#8217;ll play with &#8220;/connect&#8221;. As is verbatim in this post, let us pull up the help doc:</p>
<pre>06:24 SERVER [-4 | -6] [-ssl] [-ssl_cert &lt;cert&gt;] [-ssl_pkey &lt;pkey&gt;] [-ssl_verify] [-ssl_cafile &lt;cafile&gt;] [-ssl_capath &lt;capath&gt;] [-noproxy] [-network &lt;network&gt;] [-host &lt;hostname&gt;] [-rawlog &lt;file&gt;] [+]&lt;address&gt;|&lt;chatnet&gt; [&lt;port&gt; [&lt;password&gt;
             [&lt;nick&gt;]]]
06:24 SERVER PURGE [&lt;target&gt;]
06:24 SERVER REMOVE &lt;address&gt; [&lt;port&gt;]
06:24 SERVER ADD [-4 | -6] [-ssl] [-ssl_cert &lt;cert&gt;] [-ssl_pkey &lt;pkey&gt;] [-ssl_verify] [-ssl_cafile &lt;cafile&gt;] [-ssl_capath &lt;capath&gt;] [-auto | -noauto] [-network &lt;network&gt;] [-host &lt;hostname&gt;] [-cmdspeed &lt;ms&gt;] [-cmdmax &lt;count&gt;] [-port
                 &lt;port&gt;] &lt;address&gt; [&lt;port&gt; [&lt;password&gt;]]
06:24 SERVER LIST
06:24
06:24      -4, -6: specify explicitly whether to use IPv4 or IPv6 address
06:24      -ssl: use SSL when connecting
06:24      -ssl_cert: The SSL client certificate file (implies -ssl)
06:24      -ssl_pkey: The SSL client private key (if not included in the certificate file)
06:24      -ssl_verify: Verify servers SSL certificate
06:24      -ssl_cafile: File with list of CA certificates (implies -ssl_verify)
06:24      -ssl_capath: Directory with CA certificates (implies -ssl_verify)
06:24      -noproxy: Ignore the global proxy configuration for this server
06:24      -auto: Automatically connect to server at startup
06:24      -noauto: Don't connect to server at startup (default)
06:24      -network: Specify what IRC network this server belongs to
06:24      -ircnet: Same as -network. Deprecated. Do not use
06:24      -host: Specify what host name to use, if you have multiple
06:24      -!: don't autojoin channels
06:24      -cmdspeed: Same as /SET cmd_queue_speed, see section 3.1
06:24      -cmdmax: Same as /SET cmds_max_at_once, see section 3.1
06:24      -port: Use this only to edit the port number of an existing server,
06:24             for new servers use the &lt;port&gt; argument
06:24
06:24 /SERVER disconnects the server in active window and connects to the new one. It will take the same arguments as /CONNECT. If you prefix the address with the + character, Irssi won't disconnect the active server, and it will create a
      new window where the server is connected (ie. /window new hide; /connect address)
06:24
06:24 /SERVER without any arguments displays the list of connected
06:24         servers.
06:24
06:24 /SERVER REMOVE &lt;address&gt; [&lt;port&gt;]
06:24
06:24 /SERVER LIST
06:24
06:24 /SERVER PURGE [&lt;target&gt;]
06:24
06:24 Clears the server send queue. Useful if, for example, you accidentally paste lots of text to a channel.
06:24
06:24 See also: CONNECT, DISCONNECT, RECONNECT, RMRECONNS
06:24
06:24 Irssi commands:
06:24 server add server connect server list server purge server remove </pre>
<p>As should be obvious, this help doc is rather verbose. There are a lot of options that you can send server-side, such as using IPV4 or IPV6, connecting via SSL, changing the connecting port, and a myriad of other options. Let&#8217;s pick on just a few, and I&#8217;ll let you examine the rest.</p>
<p>Just the other day, I posted on <a href="http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/">how to connect to Freenode using SSL</a>, and yesterday <a href="http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/">I covered connecting to OFTC</a> in a similar manner. Let&#8217;s take those &#8220;/server&#8221; strings, along with one for Bitlbee to define how I wish to connect to these servers. As with the previous commands, the syntax is &#8220;/server add&#8221;, as the help doc mentions:</p>
<pre>/server add -auto -ssl -ssl_verify -ssl_capath /etc/ssl/certs -network freenode irc.freenode.net 7000
/server add -auto -ssl -ssl_cert ~/.irssi/certs/nick.pem -ssl_verify -ssl_cafile /etc/ssl/certs/spi-cacert-2008.pem -network oftc irc.oftc.net 6697
/server add -auto -network bitlbee localhost</pre>
<p>As you can see, I&#8217;m using SSL for the Freenode and OFTC connections, but not for bitlbee. Further, I&#8217;m specifying &#8220;-ssl_cert&#8221; with OFTC to present my self-signed certificate to NickServ, which I&#8217;m not doing to the others and I&#8217;m using a specific CA certificate to verify the OFTC SSL cert, whereas with Freenode, I&#8217;m specifying a whole CA path, and letting it choose the appropriate CA certificate for verification. Lastly, with all three connections, I&#8217;m automatically connecting to the networks, so when I launch up Irssi, it begins connecting right away. Because there are channels with &#8220;-auto&#8221; added to them, when the server connection is successful, I&#8217;ll join those channels right away, and my session will be ready to go without any interaction from me.</p>
<p>If I wish to see the listing of servers I just added &#8220;/server list&#8221;, as per the documentation, will show me that list. Again, on a fresh install, there may be more servers than what we have added here, and you can keep them in play, or remove them as needed. If OFTC is already defined in the server list, then you can make changes to the listing as long as the port number, network name, and server url are the same. If there are settings you wish to remove, then you&#8217;ll need to &#8220;/server remove&#8221; and re-add as appropriate.</p>
<p>So, what does our listing show us:</p>
<pre>/server list
06:50 Server               Port  Network    Settings
06:50 irc.freenode.net     7000  freenode   autoconnect, ssl, ssl_verify, ssl_capath: /etc/ssl/certs
06:50 irc.oftc.net         6697  oftc       autoconnect, ssl, ssl_cert: ~/.irssi/certs/nick.pem, ssl_verify, ssl_cafile: /etc/ssl/certs/spi-cacert-2008.pem
06:50 localhost            6667  bitlbee    autoconnect</pre>
<p>As you can quickly see, where we specified ports for Freenode and OFTC, we didn&#8217;t for Bitlbee, so the default IRC port 6667 was added. Of course, don&#8217;t forget to &#8220;/save&#8221;, so you don&#8217;t lose your work up to this point.</p>
<p>A cautious word about &#8220;/server&#8221;. &#8220;/server&#8221; is used for defining server connections, not for connecting to servers themselves. However, it can connect you to a server should you say something of the effect to &#8220;/server irc.mozilla.org&#8221;. If you did this, it will disconnect you from your current connections, and ONLY connect to you irc.mozilla.org. This is an unfortunate side-effect that many first time Irssi users discover. The proper method for connecting to irc.mozilla.org is to use &#8220;/connect irc.mozilla.org&#8221;, as we&#8217;ll discuss below.</p>
<p><strong>/connect</strong><br />
Our last command that I plan on covering in this post. With our networks defined and our servers and channels configured, we could easily at this point connect to Freenode, and all of our settings that we&#8217;ve set at this point would be applied, which means it will save us SERIOUS amounts of typing in the future, provided you don&#8217;t keep setting up Irssi over and over. Let&#8217;s first look at the help doc, as we did with the other commands, then we&#8217;ll see how simple our life is from here on out.</p>
<pre>/help connect
06:58 CONNECT [-4 | -6] [-ssl] [-ssl_cert &lt;cert&gt;] [-ssl_pkey &lt;pkey&gt;] [-ssl_verify] [-ssl_cafile &lt;cafile&gt;] [-ssl_capath &lt;capath&gt;] [-noproxy] [-network &lt;network&gt;] [-host &lt;hostname&gt;] [-rawlog &lt;file&gt;] &lt;address&gt;|&lt;chatnet&gt; [&lt;port&gt; [&lt;password&gt;
              [&lt;nick&gt;]]]
06:58
06:58      -4, -6: specify explicitly whether to use IPv4 or IPv6 address
06:58      -ssl: use SSL when connecting
06:58      -ssl_cert: The SSL client certificate file (implies -ssl)
06:58      -ssl_pkey: The SSL client private key (if not included in the certificate file)
06:58      -ssl_verify: Verify servers SSL certificate
06:58      -ssl_cafile: File with list of CA certificates (implies -ssl_verify)
06:58      -ssl_capath: Directory with CA certificates (implies -ssl_verify)
06:58      -network: the network this connection belongs to
06:58      -ircnet: Same as -network. Deprecated. Do not use.
06:58      -host: the host
06:58      -!: don't autojoin channels
06:58      -rawlog: immediately open rawlog after connected
06:58
06:58 This command makes irssi to connect to specified server. Current connections are kept and a new one is created.
06:58
06:58 See also: SERVER, DISCONNECT, RMRECONNS, SCONNECT</pre>
<p>Obviously, &#8220;/connect&#8221; is verbose, but not as verbose as &#8220;/server&#8221;. Further, the first thing to note about &#8220;/connect&#8221; is there is nothing to save. This command just takes the settings you&#8217;ve already defined for your networks, and applies them in to the connection string. However, should you not have a defined network or server to connect to, such as maybe connecting to irc.mozilla.org, you can use many of the settings in &#8220;/server&#8221; here, such as IPV4, IPV6, SSL and so on. So, say I&#8217;m wishing to test an IPV6 connection to irc.mozilla.org, I could issue something like the following:</p>
<pre>/connect -6 irc.mozilla.org</pre>
<p>That&#8217;s it! If it succeeds, then maybe I can add it to my server list with &#8220;/server add&#8221;, as discussed above and &#8220;/save&#8221; to the config. Maybe I want to test SSL over IPV6 on that network on a specific port. I could do this. Further, because I&#8217;ve already defined my networks, I can say something like:</p>
<pre>/connect freenode</pre>
<p>In this case, I&#8217;ll apply all the network settings AND server settings for the &#8220;freenode&#8221; connection. This keeps me from typing it over and over every time I wish to connect. Further, the network names themselves can be tab completed! Oh, how this makes life much more enjoyable!</p>
<p>At the end of the help document, you&#8217;ll notice a couple of additional commands. Namely &#8220;/disconnect&#8221; and &#8220;/rmreconns&#8221;. If you&#8217;re finished with a network, and wish to disconnect, then &#8220;/disconnect&#8221; would be what you want. For example, maybe you&#8217;re satisfied with your testing of IPV6 over SSL on irc.mozilla.org. Then, from your status window, you will need to tell Irssi that this is the connection you wish to disconnect. To do this, &#8220;^x&#8221; (control-x) will switch you servers until you reach the right one. Then, when you&#8217;ve switched to the right server you could issue:</p>
<pre>/disconnect</pre>
<p>Further, maybe a &#8220;/connect&#8221; isn&#8217;t working. Maybe you&#8217;re trying to reach a host that is currently down, it&#8217;s timing out, or the server on a different port than what you specified. As a result, Irssi won&#8217;t be able to connect to your preferred server, but it will keep trying. Eventually, maybe the host will become responsive, and a connection can be made. Maybe not. Regardless, Irssi will keep trying your &#8220;/connect&#8221; one way or the other. This might be undesirable, so running &#8220;/rmreconns&#8221; will remove any reconnections that Irssi is attempting to make. As with every other Irssi command, &#8220;/disconnect&#8221; and &#8220;/rmreconns&#8221; have a help doc.</p>
<p><strong>Conclusion</strong><br />
So, that&#8217;s it. I hope this was helpful. If it was just noise, or much of it was confusing, I hope you walk away from this tutorial with at least two things:</p>
<ol>
<li>/help</li>
<li>/save</li>
</ol>
<p>If you can get those two commands deeply cemented in your brain, then you&#8217;ll be okay navigating Irssi and learning its ins and outs. Further, while there might be nothing technically wrong with editing the config by hand, Irssi provides powerful, powerful tools that can do it for you keeping the errors out, and the documentation for those tools, while not perfect, is vast and very complete. But, hopefully, you see now the relationship between &#8220;/network&#8221;, &#8220;/server&#8221;, &#8220;/connect&#8221; and &#8220;/channel&#8221;, and how you can tap into that power to make your Irssi experience more pleasurable.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/02/irssis-channel-network-server-and-connect-what-it-means/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Number Eightyeight</title>
		<link>http://pthree.org/2010/02/01/the-number-eightyeight/</link>
		<comments>http://pthree.org/2010/02/01/the-number-eightyeight/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 03:23:44 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1292</guid>
		<description><![CDATA[For those who know me, know I use the nickname or alias &#8220;eightyeight&#8221;. I use it on IRC as my main nick I chat with, I use it on the microblogging service Identi.ca, and I use it elsewhere here and there. There are several reasons why I use this nickname, and I&#8217;ll cover those here, [...]]]></description>
			<content:encoded><![CDATA[<p>For those who know me, know I use the nickname or alias &#8220;eightyeight&#8221;. I use it on IRC as my main nick I chat with, I use it on the microblogging service <a href="http://identi.ca/eightyeight">Identi.ca</a>, and I use it elsewhere here and there. There are several reasons why I use this nickname, and I&#8217;ll cover those here, but there is one reason that I do NOT support, yet people think that is my reason for picking it. So, finally getting really fed up with people accusing me of views I don&#8217;t support, I&#8217;m putting up this post. I&#8217;ll be pasting it to anyone who asks, provokes or is otherwise curious about my choosing &#8220;eightyeight&#8221; for my online alias. Don&#8217;t take offense. I&#8217;m using this as a teaching moment. If you want to learn more than what I post here, there&#8217;s a great <a href="http://en.wikipedia.org/wiki/88_%28number%29">Wikipedia article on the number 88.</a></p>
<p>First, the reason <i><u>I do NOT endorse</u></i>.</p>
<p><strong>Hitler and Nazism</strong><br />
The letter &#8220;H&#8221; is the eighth letter of the alphabet in many languages, including German. So, substituting the number 8 directly to a letter of the alphabet results in H. 88 substituted results in &#8220;HH&#8221;. Apparently, &#8220;HH&#8221; is short for &#8220;Heil Hitler!&#8221; in German. So, people who use the number 88 are associating themselves with the Nazi regime and the cause of Hitler, showing their support. I am NOT one of these people! I do not support Hitler, Nazism, antisemitism or anything related to WWII, the Third Reich, etc. I am not a skinhead, I don&#8217;t own a Broken Cross, I don&#8217;t persecute anyone for their religious beliefs, I don&#8217;t hang out in gangs, and I don&#8217;t believe the Caucasian &#8220;race&#8221; is superior to any other. I have nothing to do with this movement, old or new, and people who know me personally, know this is the case. I value life, religious tolerance and racial and social equality. As far as I&#8217;m concerned, Adolf Hitler was one of the most, if not the most, immoral and unethical people in the 20th century.</p>
<p>So, if you take one thing out of this, take this: <u>I don&#8217;t support Hitler, his regime, his values, nor his sadistic, screwed up way of viewing politics</u>.</p>
<p>Now, the main reason why I chose this nickname.</p>
<p><strong>The Piano</strong><br />
For the uninitiated, there are eightyeight keys on a standard piano, and guess what? I play the piano. I formally started at 6 years old, and had formal and informal training on and off from that point to today. During my early teen years, I found a passion for competing in local, regional and statewide competitions, and participated in them frequently. Not only this, but I played the piano for choir as an accompanist, I played the piano for school musicals, I played the piano in band and orchestra when appropriate, and I play the organ now for my church. I have taught lessons, and still play quite frequently, despite my very busy schedule. When I reached about 16 years old, kids in school started calling me &#8220;88&#8243; or &#8220;88 keys&#8221;. I think this was the result of the Warren Beatty film Dick Tracy that debuted about the same time, and kids who had seen it thought it was an appropriate nickname for me.</p>
<p>Now, not all pianos or keyboards for that matter have eightyeight keys. The Bosendorfer Imperial Grand, a piano that I have yet to play on, has a full 13 octaves, from low C to the high C- an astonishing 97 keys. Organs, while not pianos, have many manuals that can total far more or far less that eightyeight keys. However, it&#8217;s generally understood that a standard piano has eightyeight keys, starting from the low A and reaching the high C.</p>
<p>There are other reasons why I like this number.</p>
<p><strong>Asian culture</strong><br />
The word eight implies wealth in Mandarin Chinese, and as a result, symbolizes good luck and fortune. This is quite the drastic difference from neo-nazi culture. In fact, the Asian culture have deep roots in the luck and wealth that the number 8 brings. Many prices in markets, stores and other places will be littered with eights. A price of fruit, for example, might be $1.88 or 88 cents. Further, the Beijing Olympics started on August 8, 2008 (8/8/08) at 8:00pm. Coincidence? I can say as well that 8 has been a lucky number for me, although not necessarily 88.</p>
<p>Aside from playing the piano, I&#8217;m also a Mathematician and Computer Scientist. There are some interesting qualities of the number 88 in mathematics. Some of which are listed below:</p>
<p><strong>Palindromic</strong><br />
I have always enjoyed palindromes. I don&#8217;t know why, but when I first learned about them in elementary school, I would sit at my desk, and think up as many palindromes as I could. &#8220;NOON&#8221;, &#8220;MOM&#8221;, &#8220;DAD&#8221;, and &#8220;TENET&#8221; were some of the words I came up with at that age. Then, of course, I would do the same with palindromic numbers as well. 88 was especially cool, because I could write in in the fancy &#8220;S&#8221; where you drew two rows of three lines, and connected them with diagonals. Remember that? Of course you do. You thought it was cool then too.</p>
<p><strong>Primitive Semiperfect</strong><br />
A semiperfect number in mathematics is where all or some of the factors of the number sum up to the number itself. For example, the factors of the number 6 are 1, 2, 3 and 6. Adding those factors results in 6. Another semiperfect number is 20, where its factors are 1, 2, 4, 5, 10 and 20. 10+5+4+1=20. 88 is semiperfect. Its factors are 1, 2, 4, 8, 11, 22, 44 and 88. 44+22+11+8+2+1=88.</p>
<p>So, what is a primitive semiperfect number? This is a number where it is not divisible by any other smaller semiperfect number. Knowing the factors of 88, you can see this is the case, as the smaller semiperfect numbers in sequential order are: 6, 12, 18, 20, 24, 28, 30, 36, 40, 42, 48, 54, 56, 60, 66, 72, 78, 80 and 84, none of which are a factor of 88. As a result, 88 is primitive semiperfect.</p>
<p><strong>Refactorable</strong><br />
A refactorable number is an integer where the count of its factors is divisible by that integer. For example, 9 is refactorable. It&#8217;s factors are 1,3 and 9. There are three factors, and three itself is a factor of 9. Another refactorable number is 40. Its factors are 1, 2, 4, 5, 8, 10, 20 and 40. There are 8 factors of 40, including 40 itself, and 8 is a factor of 40. There are also 8 factors of 88, and guess what? 8 is a factor of 88. 88 is refactorable.</p>
<p><strong>Untouchable</strong><br />
An untouchable number is a positive number that cannot be written as the sum of all the divisors of any other number excluding its greatest factor. For example, the number 4 is not untouchable, because the factors of 9 are 1 and 3 (excluding 9 itself), which sum to 4. 5 however is untouchable, as there is no number where all of the factors add strictly to 5.  88 falls in this category. </p>
<p><strong>Hexadecagonal</strong><br />
Many numbers can be thought of shapes using dots or pebbles arranged in the shape of a polygon. For example, the number 6 is triangular, as six pebbles can be arranged to form an equilateral triangle. 10 is the next triangular number. 9 on the other hand is rectangular, arranging the pebbles in a square. What is hexadecagon? It&#8217;s a 16-sided polygon with 16 vertices. So, this means 88 pebbles can be arranged into an equilateral hexadecagon.</p>
<p><strong>Conclusion</strong><br />
I hope you can see that there are many interesting facts about the number 88, including Nazism. 88 has cultural significance in many cultures, of which I only mention two. It has many interesting mathematical properties, and even has astronomical significance. For example, it takes eightyeight days for Mercury to complete its orbit around the Sun. So, now that you&#8217;ve read this post, I hope you walk away a bit more informed, a bit more knowledgeable, and less judgmental. 88 is a great number, and I can recognize it for its unique and interesting qualities. Can you?</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/01/the-number-eightyeight/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>OFTC, SSL, NickServ and Irssi</title>
		<link>http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/</link>
		<comments>http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 12:30:10 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1267</guid>
		<description><![CDATA[I&#8217;m on a bit of an IRC kick with the blogging lately, mainly because it seems I&#8217;m usually fine tuning my settings, and I like to share what I find. Hopefully, someone finds these posts useful. For today&#8217;s post, I&#8217;ve picked setting up an SSL connection on OFTC and securely identifying to NickServ when connecting. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on a bit of an IRC kick with the blogging lately, mainly because it seems I&#8217;m usually fine tuning my settings, and I like to share what I find. Hopefully, someone finds these posts useful. For today&#8217;s post, I&#8217;ve picked setting up an SSL connection on <a href="http://oftc.net">OFTC</a> and securely identifying to NickServ when connecting. with <a href="http://irssi.org">Irssi</a>. Before beginning, it should be noted that the instructions for this tutorial <a href="http://www.oftc.net/oftc/NickServ/CertFP">can also be found on the OFTC site</a>. I&#8217;m merely taking that tutorial, and posting only the Irssi instructions here, more or less. However, if you use another client, you should read over that tutorial instead.</p>
<p><strong>Generating an OpenSSL Certificate</strong><br />
OFTC runs a forked version of hyperion-ircd that they call oftc-hybrid. It&#8217;s a patched version of hyperion that Freenode was running on their servers before the switch to ircd-seven. It supports IPV6, SSL, and CertFP with NickServ, that I&#8217;ll cover later in this post.</p>
<p>Before connecting to OFTC, we want to generate an OpenSSL certificate. This certificate will be used for authenticating to NickServ, and really isn&#8217;t related to setting up an SSL connection to OFTC. However, when you connect, you will be presenting OFTC with the generated certificate, and at that point, you will be able to add it to NickServ, because it&#8217;s been presented. If you already have your own personal certificate you want to use, then you can skip this step, and move on to connecting with SSL.</p>
<p>I&#8217;m going to assume you have OpenSSL installed. If you&#8217;re running any modern Unix-like operating system, such as GNU/Linux or one of the BSDs, chances are very high that it&#8217;s been installed by default. If not, install it, and continue with the rest of the post.</p>
<p>In this step, we&#8217;re going to generate our own self-signed personal OpenSSL certificate. So, fire up a terminal, type in the command below, and follow the on-screen instructions. The values you put here do not matter to OFTC in the least, so fill them in any way you wish. In my case, I&#8217;ll fill in the data for my personal certificate, but you fill in the values as you see fit. Replace &#8220;nick.key&#8221; and &#8220;nick.crt&#8221; with your IRC nick that you use for this connection.</p>
<pre>cd ~/.irssi
mkdir certs
cd certs
openssl req -nodes -newkey rsa:2048 -keyout nick.key -x509 -days 365 -out nick.crt
Generating a 2048 bit RSA private key
writing new private key to 'nick.key'
-----
Country Name (2 letter code) [US]:US
State or Province Name (full name) [Texas]:Utah
Locality Name (eg, city) [San Antonio]:Ogden
Organization Name (eg, company) [Stealth3]:eightyeight
Organizational Unit Name (eg, section) [ISP]:OFTC
Common Name (eg, YOUR name) []:Aaron Toponce
Email Address []:&#97;&#97;&#114;&#111;&#110;&#46;&#116;&#111;&#112;&#111;&#110;&#99;&#101;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;</pre>
<p>Now, if you look, you&#8217;ll have two newly generated files: &#8220;nick.key&#8221;, which is your private key and &#8220;nick.crt&#8221; which is your public self-signed certificate. Because &#8220;nick.key&#8221; is your private key, you want to guard it appropriately. Its permissions should be modified to only be readable (and maybe even writable) by you, and you alone. Also, because we have both the private and public key set, let&#8217;s go ahead and combine the files into one PEM file that we&#8217;ll present to NickServ when connecting:</p>
<pre>cat nick.crt nick.key > nick.pem
chmod 0400 nick.key nick.pem</pre>
<p><strong>Connecting with SSL</strong><br />
At this point, we are ready to connect to OFTC, and present our certificate to the server. So, fire up Irssi if you haven&#8217;t already:</p>
<pre>irssi -!</pre>
<p>Now that we&#8217;re in Irssi, we want to setup our SSL connections to OFTC. You should have ~/.irssi/certs/nick.pem available to send.</p>
<p>We will need to retrieve the CA certificate for verifying the server certificate. I personally like to put all my CA certificates in my certificates store, and this is where I deviate a little from the tutorial on the OFTC site. OFTC has their certificate signed by <a href="http://spi-inc.org">Software in the Public Interest</a>, so we&#8217;ll need their CA certificate. Fortunately, Debian, Ubuntu, and many other GNU/Linux operating systems provide this certificate for us, so we just need to identify the location of the certificate, and plug that into Irssi. If you don&#8217;t have that certificate, refer to the tutorial on the OFTC site for obtaining it and installing it on your system.</p>
<p>So, with Irssi waiting for our command, let&#8217;s tell it out to connect to OFTC:</p>
<pre>/network add oftc
/server add -auto -ssl -ssl_cert ~/.irssi/certs/nick.pem -ssl_verify -ssl_cafile /etc/ssl/certs/spi-cacert-2008.pem -network oftc irc.oftc.net 6697
/save
/connect oftc</pre>
<p>When we successfully connect, we should see that OFTC has accepted our self-signed certificate in the MOTD, and it should also show that we are connected securely to the network with SSL:</p>
<pre>16:20 [oftc] Irssi: Looking up irc.oftc.net
16:20 [oftc] Irssi: Connecting to irc.oftc.net [64.62.190.36] port 6697
16:20 [oftc] Irssi: Connection to irc.oftc.net established
16:20 [oftc] [charm.oftc.net]: *** Looking up your hostname...
16:20 [oftc] [charm.oftc.net]: *** Checking Ident
16:20 [oftc] [charm.oftc.net]: *** Found your hostname
16:20 [oftc] [charm.oftc.net]: *** No Ident response
16:20 [oftc] [charm.oftc.net]: *** Connected securely via TLSv1 AES256-SHA-256
16:20 [oftc] [charm.oftc.net]: *** Your client certificate fingerprint is 4A5463CE416649F72818B22945681D28250C1ACA
16:20 [oftc] >>> Welcome to the OFTC Internet Relay Chat Network eightyeight</pre>
<p>Sweet! We&#8217;re connected securely, and OFTC accepted my client certificate by printing the fingerprint for me. If the fingerprint is not displayed, then OFTC has not accepted my certificate, and I need to review the steps outlined above, or on their site.</p>
<p><strong>Authenticating to NickServ with SSL</strong><br />
From here on out, our connection is secured, and we can enjoy the safety that is encrypted packets. So, at this point, we need to register our nick with NickServ, if we haven&#8217;t already. It should be pointed out that Services has a complete help document provided. Messaging &#8220;help&#8221; to any of the Services bots will give you a break down of the available commands and their syntax. I would highly recommend becoming familiar with how to use the provided documentation.</p>
<pre>/msg NickServ help
04:22 [notice(NickServ!services@services.oftc.net)] *** NickServ Help ***
04:22 [notice(NickServ!services@services.oftc.net)] ACCESS: Maintains the nickname ACCESS list.
04:22 [notice(NickServ!services@services.oftc.net)] CERT: Maintains the nickname client certificate list.
04:22 [notice(NickServ!services@services.oftc.net)] DROP: Releases your nickname for use.
04:22 [notice(NickServ!services@services.oftc.net)] ENSLAVE: Enslave a nickname to this master nickname.
04:22 [notice(NickServ!services@services.oftc.net)] HELP: Shows this help.
04:22 [notice(NickServ!services@services.oftc.net)] IDENTIFY: Identify your nickname.
04:22 [notice(NickServ!services@services.oftc.net)] INFO: Get information on a nickname.
04:22 [notice(NickServ!services@services.oftc.net)] LINK: Link this nickname to a master nickname.
04:22 [notice(NickServ!services@services.oftc.net)] LIST: Shows a list of nicknames matching a specified pattern.
04:22 [notice(NickServ!services@services.oftc.net)] RECLAIM: Release your nickname for you to use.
04:22 [notice(NickServ!services@services.oftc.net)] REGAIN: Release your nickname for you to use.
04:22 [notice(NickServ!services@services.oftc.net)] REGISTER: Registers a nickname for your usage.
04:22 [notice(NickServ!services@services.oftc.net)] SENDPASS: Send a password reset request.
04:22 [notice(NickServ!services@services.oftc.net)] SET: Set nickname properties.
04:22 [notice(NickServ!services@services.oftc.net)] STATUS: Shows the identified status of a nickname
04:22 [notice(NickServ!services@services.oftc.net)] UNLINK: Unlink this nickname from a master nickname.
04:22 [notice(NickServ!services@services.oftc.net)] *** End of NickServ Help ***</pre>
<p>In this case, we&#8217;re interested in registering and then identifying. The syntax for registering is providing your password and email as arguments. Providing the correct email is key, so should you lose your password and you can no longer authenticate with SSL, you can have NickServ email you your password. So, I would recommend putting in a valid email here, and not some throw away string:</p>
<pre>/msg nickserv register password username@example.com
/msg nickserv identify password</pre>
<p>At this point, our nick is registered and we are identified to NickServ. If the nick you&#8217;re wishing to register is already registered, then you&#8217;ll either need to pick a different nick, or join #oftc on the network, and see if staff can assign that nick to you. At any event, you must be identified with a valid nick before you can proceed with the next steps.</p>
<p>Now that we are identified to NickServ, we need to add our hostmask to the access list. This is beneficial, so we won&#8217;t be asked to identify when we connect, which is what we want. So, we need to find our hostmask. This is simple enough by running a /WHOIS on yourself, and identifying your host string. So, it might be something like this:</p>
<pre>/WHOIS eightyeight
04:29 [oftc]      nick  | eightyeight
04:29 [oftc]      host  | ~88@c-12-130-240-233.hsd1.mn.comcast.net
04:29 [oftc]     gecos  | eightyeight
04:29 [oftc]    server  | charm.oftc.net [Freemont, CA, USA]
04:29 [oftc]      info  | user has identified to services
04:29 [oftc]  hostname  | 12.130.240.233
04:29 [oftc]      info  | is connected via SSL (secure link)
04:29 [oftc]      idle  | 0d 0h 1m 48s [signon: Sat Jan 30 16:20:12 2010]</pre>
<p>In this case, my host is &#8220;~88@c-12-130-240-233.hsd1.mn.comcast.net&#8221;. This is what I want to provide to NickServ:</p>
<pre>/msg nickserv access add *@c-12-130-240-233.hsd1.mn.comcast.net</pre>
<p>Good. Now we&#8217;re ready to add our self-signed certificate. Remember, when you connected, in the beginning of the MOTD, your certificate fingerprint was displayed. You will want to copy this output and paste it here. You can also use the &#8220;openssl&#8221; command to get the fingerprint of your cert, you will just need to remove the colons out of the string when providing it to NickServ. In my case, my fingerprint was 4A5463CE416649F72818B22945681D28250C1ACA, so I&#8217;m going to add that. Change the string for your fingerprint:</p>
<pre>/msg nickserv cert add 4A5463CE416649F72818B22945681D28250C1ACA</pre>
<p>That&#8217;s it! At this point, if you were to connect again (you must /disconnect and then /connect. /reconnect doesn&#8217;t apply the SSL settings, apparently (BUG?)), you will find that you will automatically identify to NickServ with your cert, and without a password. As you can imagine, this is highly secure. If you are not taking advantage of SSL, then your password can be sniffed on the wire, and your account could be compromised. In this case, we&#8217;re neglecting the password, and using public key cryptography instead to authenticate. I don&#8217;t know at this point if a MITM attack would be successful. So, bonus.</p>
<p>To see that it has succeeded, when you connect you should see the following at the end of the MOTD:</p>
<pre>05:14 [oftc2] >>> You have set user mode +i
05:14 [oftc2] >>> You have set user mode +R
05:14 [oftc2] [notice(NickServ!services@services.oftc.net)] You are connected using SSL and have provided a matching client certificate
05:14 [oftc2] [notice(NickServ!services@services.oftc.net)] for nickname eightyeight. You have been automatically identified.</pre>
<p><strong>Wrap-up</strong><br />
Congratulations! You are now connected securely to OFTC via SSL and you have identified to NickServ successfully with your self-signed certificate. The major benefits of this method, is you can ditch any client-side identification scripts, which is always a bonus. Further, your packets are now encrypted between you and the OFTC servers. OFTC also utilizes server-to-server encryption, so if you&#8217;re physically connected to a server in the United States, and someone you&#8217;re in private message with is physically connected to a server in Europe, not a single plaintext packet is sent on the wire between your client and his (assuming he&#8217;s connected via SSL as well).</p>
<p>A final not on SSL connections, is your computer clock that you are running Irssi on needs to be accurate. It would be recommended to use NTP to keep your clock in sync with Internet time servers. If your clock is too far off, you won&#8217;t be able to negotiate the OpenSSL handshake, and as a result, not be able to take advantage of the encrypted traffic. Also, OpenSSL certificates need to be valid. If your certificate expires, then you will not be able to present it to the server, and as a result, not be able to authenticate to NickServ. The dates on expiration are up to you, but validity is important. You can see the dates of your certificate with the following command:</p>
<pre>openssl x509 -noout -in nick.pem -dates</pre>
<p>Enjoy the security.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freenode, SSL and SASL Authentication with Irssi</title>
		<link>http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/</link>
		<comments>http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 10:13:28 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1255</guid>
		<description><![CDATA[Last night, Freenode made the migration from hyperion-ircd to a fork of charybdis-ircd they&#8217;re calling ircd-seven. There are a few notable changes in the new ircd code that are worth mentioning here that are of benefit to end users and clients. They are the ability to use OpenSSL encryption between client and server and the [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, <a href="http://freenode.net">Freenode</a> made the migration from hyperion-ircd to a fork of charybdis-ircd they&#8217;re calling ircd-seven. There are a few notable changes in the new ircd code that are worth mentioning here that are of benefit to end users and clients. They are the ability to use OpenSSL encryption between client and server and the ability to use SASL authentication for authenticating to Services. Of course, as is standard, I&#8217;ll document this with <a href="http://irssi.org">Irssi</a>, but the general rules apply to most IRC clients.</p>
<p><strong>Connecting with SSL</strong><br />
Freenode is listening for SSL connections on ports 7000 and 7070, rather than the standard 6697. I don&#8217;t know what the logic here is for that, but does it matter? A port is a port is a port. So, for Irssi, setting this up is rather simple.</p>
<pre>/server add -auto -ssl -network freenode irc.freenode.net 7000</pre>
<p>Boom! Done.</p>
<p>Now, if you want to verify the Freenode server SSL certificate against a certificate authority (CA), then you&#8217;ll need to download the CA certificate from the authority that signed the server certificate. In this case, its <a href="http://gandi.net">Gandi.net</a>, and their CA certificate file can be found here: <a href="http://crt.gandi.net/GandiStandardSSLCA.crt">http://crt.gandi.net/GandiStandardSSLCA.crt</a>. However, using the file in its native DER format for Irssi wasn&#8217;t working for me. So, using openssl, I converted the binary DER data file to PEM format, at which the Freenode certificate would properly verify:</p>
<pre">cd /usr/share/ca-certificates
mkdir gandi.net
cd gandi.net
wget http://crt.gandi.net/GandiStandardSSLCA.crt
openssl x509 -inform der -outform pem &lt; /usr/share/ca-certificates/gandi.net/GandiStandardSSLCA.crt &gt; GandiStandardSSLCA.pem
ln -s /usr/share/ca-certificates/gandi.net/GandiStandardSSLCA.pem /etc/ssl/certs/GandiStandardSSLCA.pem</code>

With the Gandi.net CA certificate installed in the standard CA certificates store, I modified my server string in Irssi:
<pre>/server add -auto -ssl -ssl_cacert /etc/ssl/certs/GandiStandardSSLCA.pem -network freenode irc.freenode.net 7000</pre>
<p>Unfortunately, as much as I would like this to work, it doesn't. I kept ending up with this error:</p>
<pre>[freenode] Irssi: Connecting to irc.freenode.net [140.211.166.4] port 7070
Irssi: warning Could not verify SSL servers certificate:
Irssi: warning   Subject : /OU=Domain Control Validated/OU=Gandi Standard Wildcard SSL/CN=*.freenode.net
Irssi: warning   Issuer  : /C=FR/O=GANDI SAS/CN=Gandi Standard SSL CA
Irssi: warning   MD5 Fingerprint : F8:40:2C:D9:D6:46:1F:D0:38:5D:ED:21:69:8B:17:C4</pre>
<p>Digging deeper, it appears it's failing with:</p>
<pre>2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate
the issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found.</pre>
<p>After a bit of hacking, and the help with Bazerka in #irssi, we found that my specific version of OpenSSL doesn't like the certificate chain. Because Irssi is using these libraries, it took a bit of mucking about to find enough data points, that you need to be running an extremely recent SVN build of Irssi (there's a bug with some SSL certificate verifications that affect us here), also with OpenSSL version 0.9.8k or later. I am not running either on Debian stable, so am I stuck not being able to verify the certificate Freenode gives me?</p>
<p>Well, not quite. The Gandi certificate is signed by UTN-USEFirst-Hardware, which in turn is signed by AddTrust External Root (if your browser has a CA certificates store, you can visit <a href="https://irc.freenode.net:7070">https://irc.freenode.net:7070</a>, and get the details of the certificate there, or use "openssl s_client" to download it and examine the details). So, if you have the USEFirst and AddTrust CA certificates, then you can verify those instead with older versions of OpenSSL or Irssi, and you'll be golden. So, if you have a CA certificate store, as most GNU/Linux distributions do, you can set the following instead:</p>
<pre>/server add -auto -ssl -ssl_verify -ssl_capath /etc/ssl/certs -network freenode irc.freenode.net 7000</pre>
<p>This will succeed, and when connected, you'll see usermode "+Z" meaning you're using a secure connection, and you've properly verified the server certificate Freenode is handing out. Notice the difference with "-ssl_capath" here and "-ssl_cacert" from above. This is key to making this work.</p>
<p><strong>Authenticating with SASL</strong><br />
Okay, after setting up SSL with Freenode, the next task for me was using SASL authentication rather than a server password to authenticate to NickServ. It should be noted that using SASL authentication is entirely optional! You don't have to use this method if you don't want. However, using the SASL authentication script I'm going to point to in a second has one nice feature that might be of interest to you: using Blowfish encryption on your password, and sending that to NickServ, should you not be using an SSL connection at all. If you're not interested in using an SSL connection, at least you can encrypt your password on the wire when authenticating using SASL.</p>
<p>Anyway, setting this up means getting Irssi in shape for SASL. By default. Irssi doesn't support SASL authentication out of the box, so we need a Perl script to make it happen. <a href="http://freenode.net/sasl/cap_sasl.pl">You can find that Perl script here</a>. After downloading the script, put it in your ~/.irssi/scripts directory, and link against it in the autorun directory. Something like this:</p>
<pre>cd ~/.irssi/scripts/
wget http://freenode.net/sasl/cap_sasl.pl
cd autorun
ln -s ../cap_sasl.pl cap_sasl.pl</pre>
<p>Now, you just need to load it in Irssi, and setup your username and password for authentication. A word of note here: when setting up SASL authentication, you need to be using your primary nick with NickServ, not any nick that you've linked against, or it will fail. I don't know why this is, but that's the case. So, in my case, my primary nick is "atoponce" and my secondary nick is "eightyeight". I use my secondary nick for all my IRC sessions, but when using the SASL command below, you must use your primary nick. While we're at it, we'll save everything we've done up to this point in the config:</p>
<pre>/RUN cap_sasl.pl
/sasl set freenode primary-nick password DH-BLOWFISH
/sasl save
/save</pre>
<p>First, if you haven't noticed already, you need some Perl libraries in place before you can run this script, namely Blowfish, DH and BIGNUM. If you're on Debian or Ubuntu, you can install them with:</p>
<pre>aptitude install libcrypt-blowfish-perl libcrypt-dh-perl libcrypt-openssl-bignum-perl</pre>
<p>Notice, I"m using DH-BLOWFISH in my example. "PLAIN" is also completely valid there for your mechanism. Also, notice I'm using "/sasl save" to save the settings to disk. You'll want this, so should you need to restart Irssi, everything will be in place, and you won't have to go through this procedure again.</p>
<p>If you've followed this tutorial rather closely, when you connect, you should see something like the following at the beginning of the connection:</p>
<pre>16:05 [freenode] Irssi: Looking up irc.freenode.net
16:05 [freenode] Irssi: Connecting to irc.freenode.net [140.211.166.4] port 7000
16:05 [freenode] Irssi: Connection to irc.freenode.net established
16:05 [freenode] [niven.freenode.net]: *** Looking up your hostname...
16:05 [freenode] [niven.freenode.net]: *** Checking Ident
16:05 [freenode] [niven.freenode.net]: *** Found your hostname
16:05 [freenode] [niven.freenode.net]: *** No Ident response
16:05 [freenode] Irssi: CLICAP: supported by server: identify-msg multi-prefix sasl
16:05 [freenode] Irssi: CLICAP: requesting: multi-prefix sasl
16:05 [freenode] Irssi: CLICAP: now enabled: multi-prefix sasl
16:05 [freenode] >>> eightyeight!88@oalug/member/pdpc.supporter.monthlybronze.eightyeight atoponce You are now logged in as atoponce.
16:05 [freenode] Irssi: SASL authentication successful
16:05 [freenode] >>> Welcome to the freenode Internet Relay Chat Network eightyeight</pre>
<p>You want to see "SASL authentication successful" in the output. If it fails then you will still need to provide your password manually to NickServ. You will likely need to review the steps outline above finding anything you might have missed. Remember, you're authenticating with your primary NickServ nick, not any others linked to it. In the output, you can see I'm authenticating with "atoponce", but using "eightyeight" when I actually connect.</p>
<p>One last work about SASL authentication: you no longer need a server password if you're utilizing this. Before, Freenode supported a server password that you could append to the end of your "/server" string for authentication. Freenode still supports this, although in "username:password" syntax rather than just "password". But, SASL authentication overrides the need for a server password, so you can take that out of your settings. It's not hurting anything if you leave it, but it's not doing anything beneficial either.</p>
<p><strong>Miscellaneous</strong><br />
With all that out of the way, I want to point out one major change that I welcome. That is the ability to join more than 20 channels simultaneously. Previously, with hyperion-ircd, you had to get Freenode staff to grant you usermode "+u" which gave you the ability to sit in more than 20 channels with one connection. If you're an IRC addict like I am, 20 is pretty freaking limiting. However, ircd-seven now supports the ability to connect to 120 simultaneous channels. You can see this in the MOTD output when you connect (emphasis placed):</p>
<pre>16:05 [freenode] >>> CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQScgimnprstz <b>CHANLIMIT=#:120</b> PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=freenode KNOCK STATUSMSG=@+ CALLERID=g are supported by this server
16:05 [freenode] >>> SAFELIST ELIST=U CASEMAPPING=rfc1459 CHARSET=ascii NICKLEN=16 CHANNELLEN=50 TOPICLEN=390 ETRACE CPRIVMSG CNOTICE DEAF=D MONITOR=100 are supported by this server
16:05 [freenode] >>> FNC TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,arx WHOX CLIENTVER=3.0 are supported by this server</pre>
<p>Very nice!</p>
<p>So, there you have it. SSL connectivity with SASL authentication and the ability to join up to 120 channels simultaneously on the new IRCD at Freenode. I personally welcome all these changes, and it's nice to see that every IRC server I'm currently connected with provides a secure connection. Call me paranoid, but I'm enjoying SSL.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>hilight_win.pl for Irssi and Other Script Goodies</title>
		<link>http://pthree.org/2010/01/22/hilight_win-pl-for-irssi-and-other-script-goodies/</link>
		<comments>http://pthree.org/2010/01/22/hilight_win-pl-for-irssi-and-other-script-goodies/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 06:56:02 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1249</guid>
		<description><![CDATA[So, I was browsing A Guide to Effectively Using Screen and Irssi, and I came across this little gem:
Hilight Window
See the irssi screenshot above. The section labeled &#8220;1&#8243; is a split window called &#8220;hilight&#8221;. Anything that is hilighted (set using the /hilight command) will be logged to that window.
To do this, first load the script. [...]]]></description>
			<content:encoded><![CDATA[<p>So, I was browsing <a href="http://quadpoint.org/articles/irssi">A Guide to Effectively Using Screen and Irssi</a>, and I came across <a href="http://quadpoint.org/articles/irssi#hilight_window">this little gem</a>:</p>
<blockquote><p><b>Hilight Window</b></p>
<p>See the irssi screenshot above. The section labeled &#8220;1&#8243; is a split window called &#8220;hilight&#8221;. Anything that is hilighted (set using the /hilight command) will be logged to that window.</p>
<p>To do this, first load the script. The script I use is a modified version of cras&#8217;s hilightwin.pl that logs timestamps as well. It is available here: <a href="http://static.quadpoint.org/irssi/hilightwin.pl">hilightwin.pl</a></p>
<p>Put the script in ~/.irssi/scripts/autorun/ and type /run autorun/hilightwin.pl in irssi.</p>
<p>Next, create the split window. This is done with the /window command. See /help window for details on how this works.</p>
<pre>  /window new split
  /window name hilight
  /window size 6</pre>
<p>The above commands will create a new split window (as opposed to a &#8220;hidden&#8221; window, which privmsg, channel, and status windows are by default), call it hilight (so the script knows where to send the information) with a height of 6 lines.</p>
<p>Now, have someone address you in a channel using &#8220;yournick: hello&#8221;. If you did everything correctly, it should be logged to the split window. If you want to have all lines containing your nick hilighted, type /hilight yournick. See /help hilight for advanced features. Use /layout save to save your layout settings and have irssi automatically recreate the split hilight window on startup.</p></blockquote>
<p>For me, irssi is more than just an IRC client. It&#8217;s a complete messaging center. I access IRC, Jabber and push to microblogging sites, such as Facebook, Identi.ca and others. Because I&#8217;m running behind GNU screen, I want to be aware of any messages while I&#8217;m away. Of course, Irssi does this for you automatically, by putting your hilights in the status window. For me, that&#8217;s a busy window, and it&#8217;s easy to lose hilights if they sit long enough. So, I&#8217;d rather have the hilgihts go to a separate window. Enter that script listed above, along with splitting the window for immediate access.</p>
<p>Now you have a split screen window that your highlighted messages are going to. However, they&#8217;re also going to your status window when you&#8217;re away. This is known as your &#8220;awaylog&#8221;. You can change that setting if you want. By default, it logs &#8216;msgs hilight&#8217;. If you want to disable it, now that you have a new hilight window, you can set:</p>
<pre>/set awaylog ""</pre>
<p>Note, that your new hilight window will only log hilights, not msgs. For me, this is no big deal, because msgs are already in their own window by default anyway, and the point of this is to keep all the messages in one place. So, this is a win/win for me.</p>
<p>Along with this script, there is other script goodness that I take advantage of with this fabulous client. Listed below:</p>
<ul>
<li><a href="http://github.com/msparks/irssiscripts/blob/a4983a5f21d35143389ab9cb6886e92a5529a833/anames.pl">anames.pl</a>- Query the server to see who is away and who is not by running /anames. Prints out a list similar to /anames, but gives those whore are marked as away a different brightness to their nick.</li>
<li><a href="http://scripts.irssi.org/scripts/il.pl">il.pl</a>- Because I&#8217;m a microblogging nerd, I like to know in my status bar how many characters I&#8217;ve currently typed before I hit enter, to know whether or not I&#8217;m under the 140 character limit. Works like a charm, character-by-character.</li>
<li><a href="http://scripts.irssi.org/scripts/trigger.pl">trigger.pl</a>- This script rocks! Allows me to do search and replace with text in my client. I use it mainly for the Identi.ca Jabber bot. See this post for more details.</li>
<li><a href="http://scripts.irssi.org/scripts/usercount.pl">usercount.pl</a>- You can put the number of people in a channel, including the number of ops, halfops, voices, etc in your status bar.</li>
<li><a href="http://scripts.irssi.org/scripts/trackbar.pl">trackbar.pl</a>- This puts a trackbar on your window where you last were in the conversation last time you were watching it. Very useful to pick back up where you left off in a conversation when you return to that window.</li>
<li><a href="http://scripts.irssi.org/scripts/screen_away.pl">screen_away.pl</a>- Using GNU screen is solid with irssi. However, when I am away, I want to mark myself away with the server. So, all I have to do is detach screen, and this script will mark me away with my configured away message. No public announcements either.</li>
</ul>
<p>Of course, I use a few others, such as the bitlbee scripts, but these are the heavy hitters. Must-haves for any serious irssi user/hacker.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/22/hilight_win-pl-for-irssi-and-other-script-goodies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More 88 Madcows</title>
		<link>http://pthree.org/2010/01/12/more-88-madcows/</link>
		<comments>http://pthree.org/2010/01/12/more-88-madcows/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:56:03 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1245</guid>
		<description><![CDATA[I made some updates to my 88_madcows.theme file for irssi. The biggest change is the theme working with 0.8.13 and greater. Further, I added the server tag to the statusbar when in the status window, so when I need to change servers for whatever reason, it&#8217;s obvious what server I&#8217;m on before cycling through. Screenshot [...]]]></description>
			<content:encoded><![CDATA[<p>I made some updates to my <a href="http://pthree.org/2008/09/24/new-irssi-theme-88-madcows/">88_madcows.theme file for irssi</a>. The biggest change is the theme working with 0.8.13 and greater. Further, I added the server tag to the statusbar when in the status window, so when I need to change servers for whatever reason, it&#8217;s obvious what server I&#8217;m on before cycling through. <a href="http://picasaweb.google.com/lh/photo/rapJoD0SyZ7M0BRutW1rxw?feat=directlink">Screenshot here</a>, and the <a href="http://pthree.org/wp-content/uploads/2010/01/88_madcows.theme">theme file here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/12/more-88-madcows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>QR Code with MECARD and hCard</title>
		<link>http://pthree.org/2010/01/07/qr-code-with-mecard-and-hcard/</link>
		<comments>http://pthree.org/2010/01/07/qr-code-with-mecard-and-hcard/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 13:42:58 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1231</guid>
		<description><![CDATA[It&#8217;s the digital age. Computers are getting cheaper and stronger. Mobile smart phones are becoming a household fixture. Networking is more readily available than ever before and increasing its speed. Yet, many of our daily products remain locked in the past, not taking advantage of what technology has to offer. So, personally, I decided to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://pthree.org/wp-content/uploads/2010/01/aaron_qrcode_small.png" alt="" title="aaron_qrcode_small" width="275" height="275" class="alignright size-full wp-image-1232" />It&#8217;s the digital age. Computers are getting cheaper and stronger. Mobile smart phones are becoming a household fixture. Networking is more readily available than ever before and increasing its speed. Yet, many of our daily products remain locked in the past, not taking advantage of what technology has to offer. So, personally, I decided to change the way I at least interact with the digital world, and hopefully, can cause some ripples in the process.</p>
<p>First, I wanted to change my personal &#8220;business&#8221; card (referred to as a &#8220;personal card&#8221; from here on out). <a href="https://wiki.ubuntu.com/BusinessCards">My initial personal card was an Ubuntu one</a> I had printed after becoming an Ubuntu Member. I ordered 2,500 of them a couple years ago, and I&#8217;ve handed just about every one of them out. Rather than reorder a new batch, I wanted something more generic than just targeting Ubuntu. Further, I wanted to take advantage of technology.</p>
<p>When Google changed their front page logo to a bar code on October 7, 2009 to celebrate the approval of the bar code patent, I spent a great deal of time on Wikipedia learning about bar codes. I knew there was a quite a few out there, but I wasn&#8217;t aware of all the types, how the encoding was handled, and so forth. In the process, I discovered <a href="http://en.wikipedia.org/wiki/QR_Code">QR Code</a>.</p>
<p>QR Code appealed to me for a few reasons. First, although a patented technology, it&#8217;s royalty-free and the patent owner has promised to not exert patent rights on it. This is the same case as with Ogg Vorbis. So, although not truly an &#8220;open format&#8221; in the pure sense of the word, good enough for me. Further, there is a an application called &#8220;qrencode&#8221; that is Free Software and available an most GNU/Linux operating systems. So, this makes it easy to create your own QR codes. Second, the technology behind the QR code is rather slick. It contains error correction, should up to 30% of the code be damaged or unreadable. It can be scanned any direction in 360 degrees for bar code scanners. The density is high enough to store up to 7,000 characters. <a href="http://www.denso-wave.com/qrcode/qrfeature-e.html">More features can be found on the owner&#8217;s page</a>.</p>
<p>Immediately, I saw this as an opportunity to encode my contact information. This would be a great way to put your name, web site, email, address, telephone number, and other useful information in a compact space. I could see putting this up on web sites to avoid email harvesters (although it&#8217;s only a matter of time before they are smart enough to decode QR codes). Then I thought, why not put it on my personal card? The only thing that was preventing me from doing so was an efficient way for a contact who receives my card to get the data out of it.</p>
<p>At the time, the only decoder I was aware of was the <a href="http://zxing.org/w/decode.jspx">ZXING site</a>. You gave it a URL path to a QR code image, or uploaded your own, and it would decode the information. I didn&#8217;t want people scanning my personal card to an image, then uploading that image to the site. There has to be a better way. So, I started browsing the ZXING site a bit, and I learned that it&#8217;s an Open Source project for creating a bar code reader. <a href="http://code.google.com/p/zxing/">The project is hosted on Google Code</a>, and I found that there is a Blackberry, iPhone and Android app. SWEET!</p>
<p>So, now people can install the free app on their phone, scan the image, and parse out the contact information. The only problem that I saw at the time, is even though they can scan the QR code, and decode the data, the app just presents the user with the raw data, with no ability to add that information to their address book. So, my quest continued. Surely, there must be a way to get the contact information out of the QR code, and into an address book. So, back to web to found out how.</p>
<p>Needless to say, it didn&#8217;t take long at all before I learned about <a href="http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook/">MECARD</a>. You can think of MECARD as a light version of vCard. Essentially, a single line of text contains all the meta data and appropriate information for populating an address book. Info such as name, address, telephone, email, URL and more. Further, the ZXING app supports parsing MECARD data, and adding that data to your address book!</p>
<p>At this point, I was satisfied. I&#8217;m ready to build my own QR code, and put it on my personal card. Well, almost ready. I wanted one extra step before I was ready to commit my personal card to the printer. For the URL in my MECARD, I wanted it to point to additional contact information that could also be parsed using computing for adding to an address book, whether it be on a mobile phone or an email address book, such as in Mozilla Thunderbird or Outlook, or even online, like with Google Contacts. So, I spent more time searching the web, finding a way to get all this integrated.</p>
<p>It wasn&#8217;t long before I found <a href="http://microformats.org/wiki/hcard">hCard</a>. hCard is an HTML version of vCard. It&#8217;s a microformat for embedding HTML into a web site, so applications, just as JavaScript or Firefox extension, can parse the data, and populate an address book with the appropriate entries. The whole point is to keep the contact from entering in the contact information by hand. Otherwise, I just would have printed the raw ASCII on the personal card. No, I want to fully automate my contact information from head to toe taking advantage of mobile phones and other technology. So, hCard fit the bill.</p>
<p>I began populating my own hCard to put on my main site, then the URL in my MECARD would point the user that direction. However, I found that <a href="http://google.com/profiles/aaron.toponce">my Google Profile</a> already supports hCard, FOAF, XFN and other standards. So, for me, it made sense to point people that direction rather than build my own. However, after having my QR Code created with everything I wanted, and pointing them to the right URL, and getting the cards printed, I found that Google isn&#8217;t exporting email address, URL, telephone, or other information that hCard supports in the HTML. I&#8217;m a bit disappointed by this, and I wish I would have paid closer attention, but I guess it will have to work for the time being. I&#8217;m hoping that Google adds this data to the hCard export, so I don&#8217;t have to change my personal cards in the near future. <img src='http://pthree.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now, the personal cards themselves. I wanted to go hard core, relying 100% on technology to parse the data rather than a human. So, <a href="http://picasaweb.google.com/lh/photo/CrKTLcIblElN_A9d7n4KEg?feat=directlink">I put just the QR Code on the &#8220;front&#8221; of the card</a>, with no alphanumeric data anywhere to be found. <a "href="http://picasaweb.google.com/lh/photo/Apks0FQEu5ic1K6vdr3KOg?feat=directlink">On the back of the card, I put the glider image</a>, a fanboy icon for the hacker culture and ethic. That&#8217;s it. An image on one side and an image on the other. The personal card itself has no rotation and should you have a smart phone with a bar code reader, it should be trivial for you to get out the contact information, and populate your address book.</p>
<p>This is a trial run. I don&#8217;t know what will happen or what will come about as I start handing out this card to people. Time will tell. It should be interesting though, and I&#8217;m sure it will be quite the conversation starter. Here&#8217;s to risks.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/07/qr-code-with-mecard-and-hcard/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Does Debian Deviate From Standards Or Upstream?</title>
		<link>http://pthree.org/2010/01/04/does-debian-deviate-from-standards-or-upstream/</link>
		<comments>http://pthree.org/2010/01/04/does-debian-deviate-from-standards-or-upstream/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 14:06:29 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1224</guid>
		<description><![CDATA[Recently, I got into a discussion with a friend of mine that I have a great deal of respect for. After having our discussion, my respect for him has grown. The discussion was about whether or not Debian and Ubuntu have deviated from standard practice regarding Paul Vixie&#8217;s cron implementation.
The idea is simple. On Fedora [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I got into a discussion with a friend of mine that I have a great deal of respect for. After having our discussion, my respect for him has grown. The discussion was about whether or not Debian and Ubuntu have deviated from standard practice regarding Paul Vixie&#8217;s cron implementation.</p>
<p>The idea is simple. On Fedora and SUSE based operating systems, if /etc/cron.allow AND /etc/cron.deny do not exist on the system, then only the super-user can install cron jobs using the crontab command. However, on Debian and Ubuntu, both files are missing, yet everyone on the system can install a cron job. So, the question was: why does Debian and Ubuntu feel the need to be different from everyone else? Why do they need to deviate from standard practice?</p>
<p>Now, for the record, I don&#8217;t care if Debian deviates&#8230; much. Debian is an operating system. Sometimes, I think those in the Free Software and GNU/Linux world forget that. Operating systems are free to make the changes necessary for their platform as they see fit. Those changes will likely either make users happy and make the operating system popular, like Ubuntu, or they won&#8217;t be good changes, and likely will lose users, like, well, Gentoo (sorry guys, but you have seen better days). I&#8217;m all for changes that are thought out and that bring obvious or non-obvious benefits. For example, Debian Squeeze moving away from System V Init to Upstart.</p>
<p>So, the question remains: Is Debian deviating with Vixie cron from what would be considered &#8220;standard practice&#8221;? Well, to start, I pulled up the crontab(1) man page to see what it says regarding the matter. On Debian, this is what I found:</p>
<blockquote><p>If  the /etc/cron.allow file exists, then you must be listed therein in order to be allowed to use this command.  If the  /etc/cron.allow  file does  not  exist  but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use this  command. If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use  this command,  or  all  users will be able to use this command. For standard Debian systems, all users may use this command.</p></blockquote>
<p>I pulled up the same man page on Fedora, and this is what I found:</p>
<blockquote><p>If the cron.allow file exists, then you must be listed therein in order to be allowed to use this command.  If the  cron.allow  file  does  not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command.  If neither  of  these files  exists, only the super user will be allowed to use this command.</p></blockquote>
<p>Both man pages document exactly what the behavior of crontab is should both /etc/cron.allow and /etc/cron.deny be missing. Further, the crontab(1) man page mentions a site-wide configuration file for this behavior. On Debian, by default, I reached for /etc/default/cron to find this configuration. Nothing in there seemed to lead me to this behavior. Pulling up /etc/sysconfig/crond on Fedora also lacked the information I was looking for. I dug through /etc/pam.d/cron, /etc/crontab, /etc/init/cron, /etc/init.d/cron, /etc/security/access and just about any other possible configuration file that might be related, and came up empty-handed every time.</p>
<p>So, when in doubt, Use the Source Luke. So, I went to the Debian packaging site to grab the cron source. Why there rather than upstream? Because Debian ships the upstream pristine source in one tarball with the Debian-specific patches in another tarball. This way, I can see what is being patched while staring at the source directly. While I was at it, I grabbed the source RPM from Fedora as well. However, I grabbed it from Fedora 8, as it seems Red Hat has forked Vixie cron to &#8220;cronie&#8221; around Fedora 9, and I wanted to compare apples to apples.</p>
<p>Now, before I dug through the source, I found one bit of information that actually started laying to rest my suspicions. Paul Vixie developed cron for BSD 4.3. So, I would imagine that Vixie cron is still running on BSD systems, and that the default, intended behavior from Paul Vixie himself would be present on the BSDs. Curious, I fired up FreeBSD, and read the crontab(1) man page:</p>
<blockquote><p>If the allow file exists, then you must be listed therein in order to be allowed to use this command.  If the allow file does not exist but the deny file does exist, then you must not be listed in the deny file in order to use this command.  If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use this command, or all users will be able to use this command.  The format of these files is one username per line, with no leading or trailing whitespace.  Lines of other formats will be ignored, and so can be used for comments.</p></blockquote>
<p>Interesting. Even FreeBSD says that depending on site-wide configuration parameters, either only the super-user will be able to use crontab or everyone. This is the same wording in the Debian man page. Curious, I looked, and sure enough, both the allow and deny files are missing in /var/cron/, and yet everyone on the system can install cron jobs. This is telling me that Debian is not deviating from upstream, and that Red Hat is. However, I have the source, let&#8217;s see what that says.</p>
<p>First, I cracked open the Fedora patches to see if the patch was obvious. To be honest, I was a bit overwhelmed by the sheer number of patches Fedora was applying. Most were for PAM and SELinux, however. But, there was a patch for the crontab(1) man page, and there was a patch against crontab itself. After a bit of digging and parsing the C files, it seemed clear to me that Red Hat was patching crontab to only allow root to install a cron job if both the allow and deny files are missing. This patch does not exist in Debian, nor could I find it in FreeBSD.</p>
<p>So, it seemed clear. Debian was in fact not changing the default behavior of cron, but it was Red Hat who was doing the changing. Further, despite what the documentation says, I could find no site-wide configuration file to modify this behavior- even referenced in the source code. The only way to make the change was to change the code before compilation (so maybe we should submit a bug on the man page).</p>
<p>Digging deeper, I learned that there are many cron systems available for GNU/Linux. It appears Arch Linux is shipping dcron by default (Dillon&#8217;s cron), Red Hat has forked Vixie cron to cronie, and Debian and Ubuntu both utilize or will utilize Upstart, which will eventually replace cron entirely. It&#8217;s my understanding that launchd on Mac OS X has also replaced cron (although I haven&#8217;t verified).</p>
<p>Generally, when I got into discussions with various people about Debian or Ubuntu changing this, that or the other for whatever reason, nine times out of ten, it has been my experience that Debian is not the one deviating, but it is the one who is doing the accusing that is deviating. This example with cron has only been one. I&#8217;ve had discussions like this many times before. The only real solid example of Debian deviating from standard that I can come up with quickly off the top of my head, is Apache. The /etc/apache2/(sites,modules}-{available,enabled}/ directories are a break from standard. However, I have found that I prefer this configuration to upstream vanilla, as it makes administering specific modules and websites a bit easier to maintain without affecting others. This is a change that is long term beneficial to Debian.</p>
<p>In conclusion, what does this mean? Is Debian better than Fedora/RHEL/CentOS or any other operating system? While I prefer it on my systems, the answer is of course no. But, when breaking from standard practice is called into question, I&#8217;m glad Debian sticks as close to upstream as possible. I understand the need for patches where appropriate, but I would prefer as vanilla as possible so I&#8217;m not a fish out of water when I need to move to another operating system that is deploying the same technology. At least from that point I&#8217;ll be able to see the changes the new system is making. I understand Arch Linux is about as vanilla as you can get, but until they separate the non-free from the free software and GPG sign their packages, I won&#8217;t run it.</p>
<p>Debian it is for me, and I&#8217;m glad they have the philosophies they do.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/04/does-debian-deviate-from-standards-or-upstream/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>How Travelers Can Protect Their Data</title>
		<link>http://pthree.org/2010/01/03/how-travelers-can-protect-their-data/</link>
		<comments>http://pthree.org/2010/01/03/how-travelers-can-protect-their-data/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 15:56:04 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Laptops]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1217</guid>
		<description><![CDATA[I used to travel quite extensively around the country, and even had the opportunity to leave the country and go abroad. My laptop was always with me. As a result, I was very concerned for the integrity and safety of my data. As such, I took the necessary precautions that travelers can take when their [...]]]></description>
			<content:encoded><![CDATA[<p>I used to travel quite extensively around the country, and even had the opportunity to leave the country and go abroad. My laptop was always with me. As a result, I was very concerned for the integrity and safety of my data. As such, I took the necessary precautions that travelers can take when their laptops are with them. This post is hopefully informational should you decide to travel with your faithful friend (I call my laptop &#8220;Kratos&#8221;- the Greek God who always did Zeus&#8217; will and bidding).</p>
<p>First, a disclaimer. This post is not meant to be a sure method for defeating attackers. Rule number one in computer security is that if an attacker has physical access to your machine, all bets as to data integrity and physical safety are off. However, than doesn&#8217;t mean that you can make the process so tedious and time consuming for the attacker, that he will likely not bother and move to another victim. This post is about those methods. If they&#8217;re going to attack you, why not at least make it challenging for them?</p>
<p>If you have the ability, this post requires wiping your disk by starting from scratch. So, if you have data on that disk, you should probably back that up first. If it&#8217;s a new laptop, and you&#8217;re not invested into the operating system, then maybe you don&#8217;t need to worry about it. Just realize, that from this point on, if you decide to &#8220;follow along&#8221; with your own equipment, this will wipe your data, and if you didn&#8217;t back up your data first, you&#8217;re the moron, not me.</p>
<p>Okay, with that out of the way, shall we continue?</p>
<p><strong>Step One</strong>: Prepare your hard drive.<br />
The goal of this step is to install an encrypted filesystem. So, before we do that, we need to do some preparation. In order to get to that point, you will need to write random or pseudorandom data to the entire disk. This will take some time. My experience has show that laptop drives usually operate around 30MBps, so if you have a 300GB drive, this will take you just under 3 hours. The reason for doing this is to confuse the attacker just exactly where the encrypted filesystems reside. If the entire disk is underlined with random or pseudorandom data (it doesn&#8217;t necessarily need to be cryptographically secure here), then when looking at the drive level, it will be practically improbable to determine where the encrypted filesystem starts and where it ends. If you skip this step, then it&#8217;s quite obvious, and rather than wast his time on the entire disk, the attacker can focus his efforts on just the obvious encrypted portions of the disk.</p>
<p>Now, some tools for installing encrypted filesystems will already have this step built in, such as the Debian installer, but some won&#8217;t. You&#8217;ll need to discover your vendor&#8217;s documentation to see if this is the case. I would say it doesn&#8217;t hurt to be safe, and take this step anyway, but it&#8217;s up to you.</p>
<p>There are many utilities for writing random or pseudorandom data to the drive. Probably the best tool will be <a href="http://www.dban.org/">DBAN</a>, or Derik&#8217;s Boot and Nuke. This utility is generally used for destroying data, but in this case, we&#8217;ll use it for preparing data. Download the live CD, burn it, and reboot your machine. I would recommend selecting the &#8220;PRNG Stream&#8221; from the menu. This will normally write pseudorandom data to the disk 4 times. However, it shows a progress report on the number of passes, so after it completes its first pass, you can reboot. It&#8217;s important to note that selecting &#8220;Quick Erase&#8221; will do a single pass of zeros. This isn&#8217;t what we want. We&#8217;re trying to deter attackers by not giving them the boundaries of our encrypted filesystems. If you choose &#8220;Quick Erase&#8221;, then you&#8217;ll be clearly showing them where those boundaries exist. As tempting as it may be, don&#8217;t select it.</p>
<p>If you&#8217;re familiar with Linux live CDs, you can boot into a live environment, such as KNOPPIX, pull up a terminal and run the following, assuming the drive you&#8217;re preparing is &#8220;/dev/sda&#8221;:</p>
<pre>dd if=/dev/urandom of=/dev/sda</pre>
<p>The point is getting random or pseudorandom data down on the entire disk. However you accomplish that, is up to you.</p>
<p>After a few hours pass (depending on the size of your drive, and if you cancel the operation after a single pass of PRNG Stream), you are now ready to reboot into your operating system installer if it provides the ability to encrypt the filesystems, or into a separate utility for doing so.</p>
<p><strong>Step Two</strong>: Set up volumes or partitions and encrypt<br />
With the Debian installer, and most GNU/Linux installers, you can set up your partitions or logical volumes, then tell the installer to encrypt them, even with some options on the cryptography. When you&#8217;ve defined your filesystem boundaries (I&#8217;m not going to cover that here), and you&#8217;re ready to encrypt, you&#8217;ll inevitably be required to type in a username and passphrase. Some encryption utilities will use this passphrase as a seed for the encryption algorithm, so the stronger the passphrase, the stronger the seed, and this the more unlikely an attack will be successful on the filesystem. So, choose wisely and choose securely.</p>
<p><strong>Step Three</strong>: Install the operating system<br />
Whether it be Windows, Mac, Linux or whatever operating system that supports encrypted filesystems, you&#8217;re now ready to install it. Follow the operating system&#8217;s installer to the end, reebot, and make any additional final preparations to your computer before putting down the data. You should at this point be able to boot the computer, provide the necessary username and passphrase, and use your operating system as normal. If not, you&#8217;ll need to spend some time with your operating system&#8217;s documentation or encrypted filesystem documentation to get to that point. This post isn&#8217;t about that, so Google might be your friend here.</p>
<p>Okay, so now we have a usable operating system running on top of a fully encrypted drive. If we were to stop here, we wouldn&#8217;t make things very challenging for the attacker. We want to do that. So, we&#8217;re going to start adding some hurdles along the way. If the attacker has the stamina, then so be it. I&#8217;m guess that most attackers, when faced with each of these hurdles, likely won&#8217;t bother, and move to their next victim, rather than waste time trying to figure out how to get from Point A to Point B.</p>
<p><strong>Step Four</strong>: Password protect your BIOS<br />
This will vary widely on hardware, so consult your vendor&#8217;s documentation on how to boot into your laptop BIOS and set an administrator password. However, this functionality should be provided on most modern BIOSes. When found, go ahead and set the password. It can be whatever you want. I would recommend making it hard to guess, but it doesn&#8217;t really need to be on the same level as the encryption passphrase you provided earlier. Just don&#8217;t make it successful to a dictionary attack, and you should be good. Don&#8217;t reboot. Stay in your BIOS for the next step.</p>
<p><strong>Step Five</strong>: Change your boot order to boot off the hard drive first<br />
The reason for setting the administrator password in the BIOS was so we can tell the BIOS that we always want it booting from the hard drive first, rather than from the floppy, CDROM, network or USB. This step is necessary to hopefully avoid the Evil Maid attack, something <a href="http://pthree.org/2009/10/23/evil-maid/">I&#8217;ve already blogged about here</a>. In summary, the Evil Maid attack is booting your computer from a USB or CDROM, replacing your bootloader by installing a custom bootloader with a keylogger, and powering down. Then, when you boot your machine, and enter the encryption passphrase, it gets stored on disk, or sent over the network to a remote server. After you leave your laptop a second time, the attacker comes back to your computer, boots off the hard drive, provides the newly discovered encryption credentials, and steals your data.</p>
<p>So, if your laptop is BIOS password protected to only boot from the hard drive, this is a good deterrent. Why? Well, in order to remove the password off the BIOS, so the attacker can boot from some other medium, they will need to disassemble the laptop to get to the motherboard, and flash the BIOS. This is easier said than done on laptops. Have you ever taken your laptop apart? I have. I&#8217;ve take apart both my old HP Pavilion and my current ThinkPad T61. They&#8217;re a royal pain, and extremely time consuming.</p>
<p>A good attacker will be paranoid for time. They don&#8217;t want to get caught. If it means spending 3 hours disassembling a laptop just to flash the BIOS, so they can install their custom bootloader and keylogger, chances are high he&#8217;ll move on to another victim. Now, that&#8217;s not to say that every attacker can&#8217;t do this, or they know they have the time, and your data is that valuable to them. Maybe the attacker is skilled at disassembling Dell, Lenovo and HP laptops, so it&#8217;s only a 30 minute inconvenience that he knows he can make. But, maybe not. At least this is a moderately challenging task, and I&#8217;d be willing to bet most attackers won&#8217;t bother.</p>
<p><strong>Step Six</strong>: Physically lock down your laptop or take it with you<br />
Again, just another deterrent, but locking your laptop down to a secure location could provide enough of a challenge to deter physical theft, should all efforts being made at getting to your data fail. After all, there is value in the hardware itself. EBAY is probably making a killing of such scenarios without knowing specifics. This doesn&#8217;t mean the attacker isn&#8217;t skilled at lock picking or doesn&#8217;t have a strong set of bolt cutters with them. However, if the time it takes to remove the laptop from the premises is a challenging effort, the attacker likely won&#8217;t bother, and move on.</p>
<p>With that said, I had my car broken into once. They were after my stereo. Thankfully, they were caught in the act, and found guilty in court of seven counts of theft and property damage, among other things. However, in the car before mine, they couldn&#8217;t successfully remove the deck from the dash. It was bolted down. So, out of frustration, they physically destroyed the deck and the dash. Not out of failing to remove it, but out of anger for not succeeding. Your laptop may fall victim to such physical damage.</p>
<p>So, if you can carry it with you, you probably should. When I was on the road, I took my laptop with me everywhere I went for fear of physical damage or theft. I would take it with me to dinner. I would take it with me to events. I would take it with me sight seeing. I was paranoid. Sure, I run the risk of damage while traveling with it, but I know how to treat my bag carrying the laptop. At least then I&#8217;m somewhat in control. Further, an attacker can&#8217;t attack what isn&#8217;t there. But, when I couldn&#8217;t take it with me, I would lock it down securely, and hope it remained in tact when I returned.</p>
<p><strong>Step Seven</strong>: Remove the data and/or encrypt it a second time<br />
Many operating systems support encrypting directories and files on top of the filesystem itself. This means you can have an encrypted directory in your home folder, where the valuable data resides. Should the attacker successfully get access to your encrypted filesystem, if you chose a different passphrase for your encrypted directory, hopefully, they won&#8217;t get access to that.</p>
<p>But, keeping that sort of sensitive data on the drive might not be wise, even if it is encrypted. So, it would be best to have that data on an encrypted USB disk. Your only concern should be making sure you don&#8217;t lose that drive. Even if it&#8217;s not stolen data, lost data still sucks. Backups here help.</p>
<p>At my place of employment, we&#8217;re developing a virtualization solution where all the developers will have virtual desktops in our datacenter. The idea is to keep the data off of the developer&#8217;s laptop. So, when they login to their laptop, they then must login to the VPN, then use RDP or SPICE (yeah, we&#8217;re deploying RHEV) to login to their remote desktop, and work from there. At this point, the laptop becomes a mere dummy terminal, not storing a single piece of data- even email. There are concerns, like if the developer doesn&#8217;t have Internet access, or if the datacenter is compromised, but from a traveling perspective, keeping the data off of the traveling laptop is a net win. Some hotels might have crappy WIFI, but at least security has come first, and the data is safe.</p>
<p><strong>Appendix A</strong>: Learn how to remove and restore your bootloader<br />
This is a crucial skill, I think. It doesn&#8217;t really fit into the above steps per se, so I&#8217;ve added it as an appendix. The idea is simple. When traveling from another country to the United States, the Department of Homeland Security thinks it&#8217;s fun to ignore the Constitution, and seize and search your laptop without a warrant. <a href="http://www.schneier.com/blog/">Bruce Scheier has covered this extensively</a>, so I&#8217;ll let you read up on his posts about the topic. If you&#8217;re running an encrypted filesystem, they can detain you until you provide them with the passphrase, at which point they can then image your drive, keeping your data. This is wrong on so many levels, but you have a good deterrent- wipe your bootloader before landing.</p>
<p>When I traveled to Canada for training, I was already aware of the DHS doing this at customs. So, before being required to turn off my laptop during landing, I wiped the bootloader, and prepared a script in my mind should the DHS want my to power on my laptop. I was resolved that I wouldn&#8217;t lie, as that would be perjury, but I would dance around the issue as best I could. The script would go something like this:</p>
<blockquote><p>Agent: Can you power on your laptop please?<br />
Me: Sure, but while on the road, something happened, and it will no longer boot. It says it&#8217;s missing an operating system. I&#8217;m hoping to get it fixed when I get back to the office.<br />
Agent: Will you power it on anyway please?<br />
Me: Sure.<br />
(I power on the computer, at which point, it behaves exactly as described.)<br />
Agent: Okay, thank you. Carry on.</p></blockquote>
<p>When I was returning from my Canada trip, and passing through customs, the agent asked me to remove the laptop from my bag and open it. I was already prepared with a removed bootloader, and my heart was racing to go through the script. When I opened the laptop, we proceeded to swipe it looking for traces of explosives. When he was satisfied, he said thank you, I put the laptop back in my bag, and was on my way. I was a bit bummed that I didn&#8217;t get to defeat the DHS at their own game, but was relieved at the same time that I didn&#8217;t miss my flight home.</p>
<p>After I was on US soil, I boot off a rescue CD, and restored my bootloader, and was able to boot back into my Debian install without trouble. This takes some practice and know-how, but I think it&#8217;s really quite worth it should that scenario ever present itself. Of course, who knows what would happen? Maybe I would be detained until they could fix the problem with my laptop, at which point, I would still be required to turn over the passphrase, and they image the disk. Who knows? Still worth a shot, and it&#8217;s easy to do, if you know what you&#8217;re doing. Just don&#8217;t lie.</p>
<p><strong>Appendix B</strong>: Stay with your belongings through metal detectors<br />
Again, this is something that doesn&#8217;t really fit in the steps above, so it&#8217;s in the appendix as well. When you are entering an airport, and your belongings have to go through XRAY, there is an attack to steal laptops that is rather trivial and easy to setup. All it requires is three people- two attackers and the victim.</p>
<p>The attackers find a victim with a laptop (or bag obviously carrying a laptop) they want. They both position themselves immediately in front of the victim when standing in line to go through security. By the time the first attacker reaches the metal detector, the victim has likely placed their personal belongings on the belt to go through the XRAY machine. The first attacker goes through the metal detector without a problem. He waits at the end of the conveyor belt to get his belongings as well as snatch the laptop. The second attacker, however, causes problems going through. Every time he attempts to go through, something in his pockets, or otherwise, causes the detector to go off. Now, generally, it only takes 2 or 3 attempts before the agent will just get his magic want, and swipe him down from head to foot. But, two to three attempts is all the time that is needed for the victim&#8217;s bag or laptop to go through XRAY, at which point the first attacker takes the computer, and disappears into the crowd before the victim even had an opportunity to get through. It&#8217;s sneaky, it&#8217;s effective, it&#8217;s fast and it&#8217;s clean. Further, TSA isn&#8217;t keeping track of who&#8217;s belongings belong to who. For all they know, that was their laptop, not yours.</p>
<p>How do you avoid this attack? When I traveled, I stood at the XRAY machine with my hand on my laptop bin, and I sent it through the same time I went through. I never gave it a chance to get ahead of me. This would slow down the line a bit sometimes. In fact, I would let people go ahead of me while I waited. I took no chances. I&#8217;ll go through metal detection faster than my laptop will go through XRAY, so I can wait for it to come down the belt right into my own hands. It requires a bit of patience and stubbornness, but I think it&#8217;s worth it. You&#8217;ll likely not bump into the cranky people behind you again, so no biggie.</p>
<p><strong>Conclusion</strong><br />
So, there you have it. Those are the procedures and steps I would take when traveling with my laptop. I would recommend the same to you. Really, it boils down to determination, knowledge and a bit of luck. You can avoid the worst if you are sufficiently paranoid. There&#8217;s nothing wrong with taking the extra precautions to protect your data and your laptop from theft or damage. Of course, these steps aren&#8217;t bullet proof, and everything comes at a cost. There might be a slight inconvenience to the traveler to jump through some of these hoops. But, what is it worth? If the cost of the inconvenience outweighs the cost of the data, then some or all of these steps might not be necessary. If the cost of the data outweighs the cost of the inconvenience, then I would say stick to each step religiously. That&#8217;s just me.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/03/how-travelers-can-protect-their-data/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>The Meaning of &#8217;su&#8217;</title>
		<link>http://pthree.org/2009/12/31/the-meaning-of-su/</link>
		<comments>http://pthree.org/2009/12/31/the-meaning-of-su/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 15:01:25 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1213</guid>
		<description><![CDATA[When I taught for Guru Labs, part of the students training was covering different ways of becoming the root user, such as using &#8220;su&#8221;, &#8220;sudo&#8221; and taking advantage of the wheel group. Login shells versus non-login shells were also covered. The idea was to help the student understand the real nature of the shell and [...]]]></description>
			<content:encoded><![CDATA[<p>When I taught for <a href="http://gurulabs.com">Guru Labs</a>, part of the students training was covering different ways of becoming the root user, such as using &#8220;su&#8221;, &#8220;sudo&#8221; and taking advantage of the wheel group. Login shells versus non-login shells were also covered. The idea was to help the student understand the real nature of the shell and subshells, not to mention how to appropriately switch user accounts.</p>
<p>Inevitably, I would be asked what the meaning of &#8220;su&#8221; really stood for. This seems to be the Great Question in Unix (aside from the creat() command in C lacking an &#8216;e&#8217;). When I first started with Unix back in 1999, I was always under the impression that &#8220;su&#8221; meant &#8220;super user&#8221;, as the only time I ever used the command was to become root. My learning was on Solaris 7, and even my colleagues agreed that &#8220;su&#8221; meant &#8220;super user&#8221;.</p>
<p>After discovering Linux, and having it installed as a virtual machine on my own hardware (yes, VMWare existed back then), I started tinkering, and I found that you could use &#8220;su&#8221; to switch to more users than just root. This shook the very foundation that I had learned Unix on. So, what does &#8220;su&#8221; mean? After browsing the man page, and spending a great deal of time on mailing lists and web forums, I was convinced that &#8220;su&#8221; stood for &#8220;switch user&#8221; or &#8220;substitute user&#8221; rather than &#8220;super user&#8221;.</p>
<p>Further, upon learning &#8220;sudo&#8221;, it further cemented that &#8217;su&#8217; meant &#8220;switch user&#8221;, as &#8220;sudo&#8221; meant &#8220;switch user and do&#8221;. After all, &#8220;sudo&#8221; could be used to switch to any user on the system, not just root. So, as far as I was concerned, &#8220;su&#8221; meant &#8220;switch user&#8221; and &#8220;sudo&#8221; meant &#8220;switch user do&#8221;. Case closed.</p>
<p>Or was it?</p>
<p>A year or two later, I took a Unix interprocess communication course at my local university. Solaris 8 had released, and we were doing our coursework and lab work on those machines. When covering fork() and exec(), my professor taught &#8220;su&#8221; from the standpoint of it creating a subshell, and showing the parent/child process relationships. This got my mind thinking. Does &#8220;su&#8221; come from the first two letters in &#8220;subshell&#8221;? After all, you can &#8220;su&#8221; to yourself, which means you&#8217;re not really switching user accounts, and you&#8217;re not becoming root. I had to know. After class, I asked my professor what &#8220;su&#8221; meant, and sure enough, he sad &#8220;su comes from the first two letters of &#8217;subshell&#8217;&#8221;.</p>
<p>There you have it. &#8220;su&#8221; means &#8220;subshell&#8221;. So, &#8220;sudo&#8221; must mean &#8220;subshell do&#8221; for the same reasons that you can &#8220;sudo&#8221; to yourself, just as you can with &#8220;su&#8221;. To me, this was the most complete definition of the term. It couldn&#8217;t get any more complete than that, and when teaching, I taught my students that very thing, usually stating that &#8220;su&#8221; could mean &#8220;super user&#8221;, &#8220;switch user&#8221; or &#8220;subshell&#8221;, with my preference and belief on the last definition.</p>
<p>This morning, I had another foundation shaking moment with the meaning of &#8220;su&#8221;. I found some old Unix source code, <a href="http://minnie.tuhs.org/UnixTree/V5/usr/source/s2/su.c.html">where su.c was available</a>. Curious, I looked at the source. What did I find?</p>
<div class="codecolorer-container c twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">/* su -- become super-user */</span><br />
<br />
<span style="color: #993333;">char</span>&nbsp; &nbsp; password<span style="color: #009900;">&#91;</span>100<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #993333;">char</span>&nbsp; &nbsp; pwbuf<span style="color: #009900;">&#91;</span>100<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #993333;">int</span> ttybuf<span style="color: #009900;">&#91;</span>3<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #993333;">register</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>p<span style="color: #339933;">,</span> <span style="color: #339933;">*</span>q<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">extern</span> fin<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>getpw<span style="color: #009900;">&#40;</span>0<span style="color: #339933;">,</span> pwbuf<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">goto</span> badpw<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>fin<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>1<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; p <span style="color: #339933;">=</span> pwbuf<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>p <span style="color: #339933;">!=</span> <span style="color: #ff0000;">':'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>p<span style="color: #339933;">++</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">goto</span> badpw<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*++</span>p <span style="color: #339933;">==</span> <span style="color: #ff0000;">':'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">goto</span> ok<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; gtty<span style="color: #009900;">&#40;</span>0<span style="color: #339933;">,</span> ttybuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; ttybuf<span style="color: #009900;">&#91;</span>2<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&amp;</span> ~<span style="color: #208080;">010</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; stty<span style="color: #009900;">&#40;</span>0<span style="color: #339933;">,</span> ttybuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;password: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; q <span style="color: #339933;">=</span> password<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>q <span style="color: #339933;">=</span> getchar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>q<span style="color: #339933;">++</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">*</span>q <span style="color: #339933;">=</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; ttybuf<span style="color: #009900;">&#91;</span>2<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=|</span> <span style="color: #208080;">010</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; stty<span style="color: #009900;">&#40;</span>0<span style="color: #339933;">,</span> ttybuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; q <span style="color: #339933;">=</span> crypt<span style="color: #009900;">&#40;</span>password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>q<span style="color: #339933;">++</span> <span style="color: #339933;">==</span> <span style="color: #339933;">*</span>p<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*--</span>q <span style="color: #339933;">==</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">*--</span>p <span style="color: #339933;">==</span> <span style="color: #ff0000;">':'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">goto</span> ok<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span><br />
<br />
badpw<span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;bad password file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ok<span style="color: #339933;">:</span><br />
&nbsp; &nbsp; setuid<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; execl<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;/bin/sh&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;-&quot;</span><span style="color: #339933;">,</span> 0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;cannot execute shell<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
error<span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sorry<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>What is the first comment in that C file? &#8220;/* su &#8212; become super-user */&#8221;. &#8220;su&#8221; was written to <i>only</i> change to the root user on the system. It wasn&#8217;t designed to switch to any other user that has an account. <u><b><i>&#8220;su&#8221; meant &#8220;super-user&#8221;</i></b></u>. I need to sit down for a second.</p>
<p>The code above comes from the fifth edition of Unix by Dennis Ritchie and Ken Thompson. If you know your Unix history, it really wasn&#8217;t until the sixth edition that things really started taking off for the Unix world. So, it&#8217;s safe to say that most, if not all, of the code in the fifth edition and prior were written by Dennis and Ken themselves. Fifth edition Unix released in 1975, so it doesn&#8217;t get much more authoritative than that.</p>
<p>&#8220;su&#8221; can do so much more than Ken and Dennis implemented back then, as already discussed. Surely, the definition of &#8220;su&#8221; has changed, at least a little? I would hope so. The great thing with human language, is it is dynamic and flexible. We, as a society decide what meanings we put to our words, so as far as we are concerned, &#8220;su&#8221; could mean so much more than &#8220;super user&#8221;. We can define it to mean &#8220;switch user&#8221;, &#8220;substitute user&#8221; or &#8220;subshell&#8221;. Or, we can be stubborn, and hold to the old definition from 1975 that &#8220;su&#8221; means &#8220;super user&#8221;.</p>
<p>So, where does that put us today, 34 years later? Well, I wish I had an answer, but I don&#8217;t. However, knowing your Unix history (yes, there was Unix before Linux) shows maturity on your part. Knowing that initially &#8220;su&#8221; was used only for becoming the root user will show others that you are somewhat educated on the topic.</p>
<p>Really, though, the definition doesn&#8217;t matter all that much, does it? If it means &#8220;super user&#8221; or &#8220;subshell&#8221; or anything between, what matters is what you can do with it as a user or administrator. As for me, I like updating the definition to &#8220;subshell&#8221;, but at least I can discuss it at length with another because I know my history.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/12/31/the-meaning-of-su/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Keeping Time In Debian With Virtualbox</title>
		<link>http://pthree.org/2009/12/28/keeping-time-in-debian-with-virtualbox/</link>
		<comments>http://pthree.org/2009/12/28/keeping-time-in-debian-with-virtualbox/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 16:49:25 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1207</guid>
		<description><![CDATA[I&#8217;ve been encountering an interesting issue recently with Debian running as a guest in side of VirtualBox on Windows XP. When I initially installed Debian, I told it to adjust the hardware clock to UTC. Of course, this was the mistake I made. Windows operating systems want the hardware clock set to local time, then [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been encountering an interesting issue recently with Debian running as a guest in side of VirtualBox on Windows XP. When I initially installed Debian, I told it to adjust the hardware clock to UTC. Of course, this was the mistake I made. Windows operating systems want the hardware clock set to local time, then the software clock can just read the time directly without changes. Historically, Unix and Linux operating systems set the hardware clock to UTC, then offset the time based on your timezone. So, without thinking, while installing Debian, I told it to adjust the hardware clock to UTC. However, it doesn&#8217;t seem to have worked, as my hardware clock has stayed on local time.</p>
<p>Why is this a problem? Well, when booting Debian in VirtualBox, it wants to mount the volumes (just a file residing in Windows), but the last mount date timestamp shows a date in the future. This is because I&#8217;m 7 hours behind UTC. So, on every boot, I am dropped to an sulogin prompt, where I need to provide the root password to fix the system. Because the last mount date timestamp is in the future, I need to run:</p>
<pre># e2fsck -fy /dev/work/root</pre>
<p>This will update the timestamp to the current hardware clock time, at which point I can reboot, and remount the drives. However, when init is loaded, it executes /etc/init.d/hwclock.sh. This script either sets or does not set the hardware clock based on a setting in /etc/default/rcS. Pulling up the file, this is what I found:</p>
<pre>#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=yes
VERBOSE=no
FSCKFIX=no
RAMRUN=no
RAMLOCK=no</pre>
<p>Notice the setting &#8220;UTC=yes&#8221;. This means to change the hardware clock to UTC time when booting. Of course, this also means setting the timestamp on the mounted filesystems to the UTC date. Because Windows is my host operating system, I don&#8217;t want to do this. So, changing the value to &#8220;no&#8221; fixes the issue I&#8217;m having with the last mount time on my volumes being in the future. I probably should have mentioned that this init system is good old fashioned SysV Init. I haven&#8217;t upgraded to Upstart yet, although that&#8217;s on the TODO. I&#8217;m not sure how this post would change with Upstart in the picture, but when I upgrade, I&#8217;ll likely post the solution if I&#8217;m faced with the same issue again.</p>
<p>Hope this post helps someone in the future who has also had this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/12/28/keeping-time-in-debian-with-virtualbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Add Colors To Your ZSH Scripts</title>
		<link>http://pthree.org/2009/12/18/add-colors-to-your-zsh-scripts/</link>
		<comments>http://pthree.org/2009/12/18/add-colors-to-your-zsh-scripts/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 22:58:29 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1201</guid>
		<description><![CDATA[I was writing some scripts this morning to help me keep the Unix and Linux server I administer at work up to date with their NTP time synchronization. As I was going along, I thought to myself, &#8220;I&#8217;d like to see some color in the output.&#8221; Thankfully, I already had the code in my ZSH [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing some scripts this morning to help me keep the Unix and Linux server I administer at work up to date with their NTP time synchronization. As I was going along, I thought to myself, &#8220;I&#8217;d like to see some color in the output.&#8221; Thankfully, <a href="http://pthree.org/2009/10/14/more-zsh-prompt-love/">I already had the code in my ZSH prompt</a>. All I needed to do was remove some sigils, and I was up and running. If you want to add color to the output of your ZSH scripts, here&#8217;s what you need to add:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">autoload colors<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$terminfo</span>[colors]&quot;</span> <span style="color: #660033;">-gt</span> 8 <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; colors<br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">for</span> COLOR <span style="color: #000000; font-weight: bold;">in</span> RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #007800;">$COLOR</span>=<span style="color: #ff0000;">'$fg_no_bold[${(L)COLOR}]'</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">eval</span> BOLD_<span style="color: #007800;">$COLOR</span>=<span style="color: #ff0000;">'$fg_bold[${(L)COLOR}]'</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #007800;">RESET</span>=<span style="color: #ff0000;">'$reset_color'</span></div></td></tr></tbody></table></div>
<p>You now have the following variables available in the shell script namepace: RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, BLACK, WHITE, BOLD_RED, BOLD_GREEN, BOLD_YELLOW, BOLD_BLUE, BOLD_MAGENTA, BOLD_CYAN, BOLD_BLACK, BOLD_WHITE, RESET. Using these variables, you can manipulate the output from &#8220;echo&#8221; and &#8220;printf&#8221; for your script. For example, <a href="http://picasaweb.google.com/lh/photo/5dfKS0uddBu57qpaAhIhtg?feat=directlink">here&#8217;s a screenshot using &#8220;echo&#8221; to print red, green and blue text to the screen</a>. Notice that I&#8217;m using the &#8220;RESET&#8221; variable after the blue text to reset my prompt text back to normal. This may or may not be necessary, depending on how you configured your prompt, but it&#8217;s not a bad habit to get into.</p>
<p>Thought this might be helpful to the larger scripting community or for those sysadmins, such as myself, who would like a little variety added to their script output.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/12/18/add-colors-to-your-zsh-scripts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
