<?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"
	>

<channel>
	<title>Jesse</title>
	<atom:link href="http://www.jessecole.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jessecole.org</link>
	<description>A pointless blog lacking in substance.</description>
	<pubDate>Fri, 05 Sep 2008 01:29:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Software raid with linux.</title>
		<link>http://www.jessecole.org/2008/08/30/software-raid-with-linux/</link>
		<comments>http://www.jessecole.org/2008/08/30/software-raid-with-linux/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 03:30:36 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Other]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[server]]></category>

		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=72</guid>
		<description><![CDATA[Recently, i noticed my once massive 500 GB hard drive had been reduced to nothing more than 3-4 gigs of free space.  I decided i wanted more.  I also decided, i didn&#8217;t like the idea of one hard drive dying and taking every byte of data i&#8217;ve collected with it.  This meant [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, i noticed my once massive 500 GB hard drive had been reduced to nothing more than 3-4 gigs of free space.  I decided i wanted more.  I also decided, i didn&#8217;t like the idea of one hard drive dying and taking every byte of data i&#8217;ve collected with it.  This meant redundancy.  Now, there are a lot of solutions out there for making storage redundant.  But, I decided I had a price range of only $200-$300 total.  There was now only one solution.  Linux software raid.<span id="more-72"></span></p>
<p>For those who don&#8217;t know, there is information about it on <a title="Raid info on wikipedia.  " href="http://en.wikipedia.org/wiki/Redundant_array_of_independent_disks">wikipedia</a>.  Seriously, if you don&#8217;t know what raid is, you won&#8217;t be interested in this post.  Those who do know may be wondering why i went software instead of hardware.  Hardware raid is a dedicated hardware device (pci card) that implements raid on board and does all the xor&#8217;ing, etc and gives the device to the system as a single drive.  Theoretically, this is faster than software and more reliable.  And its true&#8230;at $1000 a card.   Really, anything less and you&#8217;re almost certainly doing software raid anyway with the disadvantages of hardware.  Namely, if the raid controller dies, and you don&#8217;t have the exact same model number and firmware revision, you&#8217;re screwed.  Turns out that every single card out there stores the raid metadata in a slightly different way and if you can&#8217;t find the same card, your data is gone forever.  Linux software raid doesn&#8217;t have this problem.  Just pop in a bootable cd and you have full reliable access to your data.  Move your hard drives to a new system/controller? No problem!  It all works fine.</p>
<p>The other standard argument for hardware over software is performance.  Again its true&#8230;at $1000 a card.  Its an xor operation.  Nothing more, ever.  Ok, if you&#8217;re main cpu is a pentium II underclocked to 5 mhz then yeah, software might slow things down.  At the end of this post i&#8217;ll include some info on the overhead i&#8217;ve experienced with it.</p>
<p>So, the actual process in linux of creating a raid array.  It turns out that, unlike ndiswrapper or sendmail configuration *shudder*, its incredibly easy.  Really, just make sure you have your hard drives in, (and partitioned), and then do one simple command like the following and its done.</p>
<pre>sudo mdadm --create /dev/md0  --chunk=16 --level=5 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1</pre>
<p>Now, before we go any further, lets talk about partitioning.  Strictly speaking, its not necessary.  Everything will work just as well on a bare drive as on one thats been partitioned.  The main reason you&#8217;d want to, and the reason i recommend you do, is because not all drives are created equally.  When you create a raid, by default, the smallest drive sets the size of all the other drives in the array.  So, if you have a 200 gig drive and 2 500&#8217;s, the net result will be an array of 3 200&#8217;s.  The real danger is, drives fail.  Often.  I can&#8217;t even count the number of dead hard drive&#8217;s i&#8217;ve personally seen working for <a title="Lincoln County School District #2" href="http://www.lcsd2.org">LCSD2</a>.  And if you made an array of 3 500 gig drives and one dies, the replacement has to be at least as big or it won&#8217;t work.  If the replacement is even 1 byte off, you cannot add it to the array.  Now you&#8217;ve just wasted money on a drive you can&#8217;t use and you run the risk of another drive failure and loss of all your data before you can obtain another (in a raid5).  So, i recommend that you partition each drive so that the partition on each is the same size but at least a couple of megs less than the total drive capacity.  Sure you lose 20 megs but you gain peace of mind :P.</p>
<p>Ok, back to creating the array.  Lets break that command down a little.</p>
<pre>mdadm</pre>
<p>This is <strong>the </strong>command.  This is the one, (and only one), command that you will be using to manage your array.  This is the one that create the array, assemble the array, start the array, stop the array, grow the array, replace/remove drives in the array, and finally, destroy the array (note: be careful with that part).</p>
<pre>--create /dev/md0</pre>
<p>This command specifies the device that will be your array.  This is the one that you will format and mount and add files to.  We call it md0 (<strong>multi disk</strong> number <strong>0</strong>).  This is mostly out of tradition.  For example, i could&#8217;ve said:</p>
<pre>--create /dev/jessesreallybigfreakingraidarraywithlotsofstoragespace</pre>
<p>Yeah, i recommend not doing that and just going with md0, md1, etc.</p>
<pre>--chunk=16</pre>
<p>Ok, chunk size.  Basically, in a raid5, data is striped across all the disks in the array.  Chunk size, i&#8217;m pretty sure, specifies the size of that stripe before it will be written and needs to be a multiple of 4 (2?).  Theoretically (and yeah, empirically), this has an effect on the speed and performance of the array.  I would advise against obsessing here and just using 16.  I did a lot of research and found only contradictory information.  e.g Anything over 128 is wasteful! Or Anything under 128 is a waste!  I&#8217;ll include links in my references section at the bottom if you really want to obsess.  In my testing 16 was basically as good as most anything else.  Also remember, you chose raid5 for reliability, not necessarily speed.</p>
<pre>--level=5</pre>
<p>This is where you specify what kind of raid you want.  Me, i wanted raid5.  You can specify any raid level you want here.  I won&#8217;t spend time describing each raid level, for that, <a title="List of and description of each raid level." href="http://en.wikipedia.org/wiki/Standard_RAID_levels">wikipedia</a> is your friend.  I will mention that chunk size has a different effect on raid0 so i would recommend reading the man pages.</p>
<pre>--raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1</pre>
<p>Pretty self explanatory.  Here you specify how many total devices are in this array and then list them.  Notice how all of them specify a partition?</p>
<p>Now you&#8217;re array is created.  I can&#8217;t speak for the others but, if you chose raid5, the array is created with one drive &#8220;missing&#8221; and it then &#8220;rebuilds&#8221; itself.  It does this for performance reasons (and yes, it really does).  The array will be a little slower till its done rebuilding but its fine.  Go ahead an use it all you want (or be paranoid and wait, whatever you have time for).  It took 3-4 hours for it to completely rebuild for my array.  Next step, formatting :).</p>
<pre>mkfs.ext3 /dev/md0</pre>
<p>There, done.  Its formatted.  Next.<br />
Ok, fine.  There <em>are</em> a few little things you can do here to make things a little more efficient.  Also, you don&#8217;t have to use ext3 as the filesystem if you don&#8217;t want to.  With ext3, you can specify things like stride length and width which will try to optimize things to match the block size, etc. to try and make it so that fewer read/write operations are needed.  As with block size, i didn&#8217;t bother.  In my (limited) testing, i found it to not make enough of a difference to warrant my doing anything.  If you want to try, i have links below.</p>
<p>Ok, now make a mount point somewhere, for example:</p>
<pre>mkdir /mnt/raid</pre>
<p>And add the device to your fstab so that its mounted automatically at boot.</p>
<pre>/dev/md0    /mnt/raid     ext3    defaults,errors=remount-ro,noatime,noexec,nodev    0    2</pre>
<p>One thing to note here.  In ubuntu, the mere installation of mdadm causes a new init ramdisk to be created, etc. and basically, it automatically scans for arrays on boot.  If you&#8217;re distro doesn&#8217;t do that, you need to figure out to make or add the following to your startup scripts.</p>
<pre>mdadm --assemble --scan</pre>
<p>Also, you&#8217;ll probably  have problems auto-mounting because your array may not be available when the fstab is processed.  Let me know if you have problems and i&#8217;ll try to help.</p>
<ul>
<li>Tips</li>
</ul>
<p>The whole point of raid5 is redundancy.  The idea being that the loss of a single drive means nothing because you can still get to your data and you can replace the drive.  However, if you are one drive short on boot, the array won&#8217;t be automatically started (at least on ubuntu, i&#8217;m not sure this is standard behavior).  To force an array to start sans a drive, do the following</p>
<pre>sudo mdadm -R /dev/md0</pre>
<p>Now you can backup data (highly recommended if possible), shutdown, pop the bad drive out, put the shiny new drive in, and add it to the array.</p>
<pre>sudo mdadm --add /dev/md0 /dev/sde1</pre>
<p>Reconstruction begins automatically.  You can follow the progress by check /proc/mdstat periodically.</p>
<pre>cat /proc/mdstat</pre>
<p>This will take a long time, especially if you just let it go.  By default, it limits the speed of the reconstruction to leave room for normal operation.  If you have a mostly idle array or are just impatient, you can increase the speed limit.  The speed limit is stored in &#8220;proc&#8221; virtual filesystem.</p>
<pre>cat /proc/sys/dev/raid/speed_limit_min</pre>
<p>By default, the speed limit is 1000 kb/s.  Thats very slow, not even a megabyte a second.  On a large array, it could take days at that speed.  To increase the speed, just overwrite the file (as root, sudo won&#8217;t work here).</p>
<pre>sudo -s
echo 15000 &gt; /proc/sys/dev/raid/speed_limit_min</pre>
<p>This increases the minimum speed limit to around 15 mb/s.  Much better.  Keep in mind that just because you make it that high, it might not reach the speed.  It is reading and writing constantly at the same time to rebuild that drive and can only go as fast as that drive (and bus) can handle.  That said, this is safe.  There should be no danger in increasing the speed and a simple reboot will return it defaults.  Also, it should be mentioned that a clean reboot (not a power failure probably) is fine and reconstruction will resume when it comes back up.</p>
<p>Now its been a while and we&#8217;ve ran out of space on our array.  We don&#8217;t want to start over with bigger drives but we have space for one more.  All we have to do is tell the array it has another drive and should &#8220;grow&#8221; to encompass it.  No problem.</p>
<pre>sudo mdadm --add /dev/md0 /dev/sdf1
sudo mdadm --grow /dev/md0 --raid-devices=5</pre>
<p>This will take a while and you may want to use the speed limit trick above to speed things up.  Now the array is bigger but theres a problem, you still don&#8217;t see the extra space.  The reason is the filesystem is still the size of the old array.  You need to resize the filesystem to accommodate the extra space.  This is also easy.</p>
<pre>sudo e2fsck -f /dev/md0
sudo resize2fs -p /dev/md0</pre>
<p>Resize2fs complains if you don&#8217;t do a file system check first so thats the reason for that.  This will only take a minute or two and you will have the full space available to you.  Technically its possible to do this online (while the filesystem is mounted) but i recommend unmounting it first.  This command also only works on ext3 filesystems so you&#8217;ll need to find the appropriate command for your file system of choice.</p>
<p>If you ever want to check the status of your array, you can just look at the mdstat file.</p>
<pre>cat /proc/mdstat</pre>
<p>This will show you the arrays it knows about and their status.  For more information you can use mdadm</p>
<pre>mdadm -D /dev/md0</pre>
<p>You can also use mdadm to monitor the array.</p>
<pre>mdadm --monitor</pre>
<p>This command starts mdadm and forks off a daemon that keeps an eye on the arrays.  If an array changes its state say, when a drive dies, mdadm will send off an email about it.  The configuration file is in /etc/mdadm/mdadm.conf.  Ubuntu by default has this running when its installed and will send an email to root when something happens.</p>
<p>I&#8217;ve had a really good experience with my array.  I&#8217;ve tested it thoroughly and fully trust it.  Its rock solid.  I&#8217;d like to know about your experiences, leave a message or a link in the comments.  Also if you need any help, i&#8217;d be happy to try.</p>
<ul>
<li>References</li>
</ul>
<p>to be added.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/08/30/software-raid-with-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My Gear</title>
		<link>http://www.jessecole.org/2008/07/30/my-gear/</link>
		<comments>http://www.jessecole.org/2008/07/30/my-gear/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 05:41:10 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Interesting Tech Crap]]></category>

		<category><![CDATA[Site Stuff]]></category>

		<category><![CDATA[gear]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=88</guid>
		<description><![CDATA[There is a new page in the about section titled &#8220;My Gear&#8221;  with a list of my computer setup at home complete with pictures.  So check it out, and, let me know in the comments what you&#8217;ve got.  Send me a link.  If i get several good ones i may post [...]]]></description>
			<content:encoded><![CDATA[<p>There is a new page in the about section titled &#8220;<a title="My Gear" href="/about/my-gear">My Gear</a>&#8221;  with a list of my computer setup at home complete with pictures.  So check it out, and, let me know in the comments what you&#8217;ve got.  Send me a link.  If i get several good ones i may post them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/07/30/my-gear/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mac OS X Single User Mode Password Reset</title>
		<link>http://www.jessecole.org/2008/06/25/mac-os-x-single-user-mode-password-reset/</link>
		<comments>http://www.jessecole.org/2008/06/25/mac-os-x-single-user-mode-password-reset/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 04:09:48 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Interesting Tech Crap]]></category>

		<category><![CDATA[10.4]]></category>

		<category><![CDATA[10.5]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[Mac]]></category>

		<category><![CDATA[netinfo]]></category>

		<category><![CDATA[password]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">773338991</guid>
		<description><![CDATA[Have you ever needed to get into a mac but didn&#8217;t know the password.  Maybe you forgot it.  Maybe your roommate changed it and headed off for christmas break.  Maybe you stole it in an airport and now want to use it.  Whatever the situation, you need in but don&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to get into a mac but didn&#8217;t know the password.  Maybe you forgot it.  Maybe your roommate changed it and headed off for christmas break.  Maybe you stole it in an airport and now want to use it.  Whatever the situation, you need in but don&#8217;t have the credentials.  I&#8217;m here to help.</p>
<p>In Mac OS X there are at least two methods for resetting a password.  And it does require resetting.  This isn&#8217;t windows, you can&#8217;t just boot off a cd and automatically crack the password.  Apple decided to used modern encryption techniques 10 years ago that were probably 10 years old then to protect your passwords.  Microsoft still hasn&#8217;t.</p>
<p>Method number 1:  Follow the instructions <a title="Generic password reset instructions." href="http://support.apple.com/kb/HT1274">here</a> to boot off a disc and reset your password the apple way.</p>
<p>Method number 2:  Follow my instructions below and reset it the &#8220;cool&#8221; way.</p>
<p><span id="more-58"></span>Before i begin, there&#8217;s something i should talk about.  In the traditional *nix world (unix, linux, solaris&#8230;nix), the idea of storing passwords in a flat file on the filesystem is the norm.  Usually, in linux anyway, user info is in /etc/passwd (user id, shell, name, etc.) and the password data is encrypted in /etc/shadow.  You will notice in OS X that the file /etc/fstab exists.  So that file is where all user account data is stored, right?  WRONG!  This file exists but it is only consulted/used in any way in single user mode (i&#8217;ll get to that later). The thing to take away here is that in OS X, account data is stored in a database.  Prior to 10.5 (maybe 10.4 too??) this database was apple&#8217;s proprietary <a title="Netinfo on wikipedia" href="http://en.wikipedia.org/wiki/Netinfo">netinfo</a> database.  In 10.5, netinfo was done away with completely and replaced something else ( i think its <a title="openldap homepage.  Try wikipedia for more info." href="http://www.openldap.org/">openldap</a>).  Either way, theres a little more to it than editing a text file.</p>
<p>I mentioned single user mode before.  In the *nix world (again. unix, linux, etc.), there is some concept for allowing access to the system without loading the entire system up.  You know, in case of emergencies or for maintenance reasons.  Microsoft actually does this also with the recovery console&#8230;kinda.  The important thing is, (unless you&#8217;ve locked it down) it gives you access to the system without authenticating.  Whats more is that it gives you &#8220;<a title="The SuperUser" href="http://en.wikipedia.org/wiki/Root_user">root</a>&#8221; access.</p>
<p>Ok, lets get to it.  To enter single user mode, reboot the machine and, at the chime, hold down the &#8220;apple&#8221; and the &#8220;s&#8221; keys.  Keep holding them down until you are presented with a text only prompt.  We will be modifying files on the filesystem so we need to remount the filesystem as read/write.  Type the following:</p>
<pre>mount -uw /</pre>
<p>Next step, we need to load the daemon responsible for providing access to the account database.  This is a little different between 10.4 and 10.5.  In 10.4, despite my sincerest efforts, i was unable to find a reliable way of starting only the process needed. I&#8217;ve only had trouble on clients 10.4.9 and below and i&#8217;m pretty sure its an apple bug.  It just doesn&#8217;t work right (hangs at blue aqua screen).  If you&#8217;re using 10.4.9 or below, good luck or check the end of this document for an alternative.</p>
<p>10.4:</p>
<pre>sh /etc/rc</pre>
<p>In 10.5, apple will actually give you the command to use if you try to use dscl (directory services command line utility).</p>
<p>10.5:</p>
<pre>launchtl load /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist</pre>
<p>Now the daemon is running and you have access to the database.  What we&#8217;re going to do here is enable the root account.  Remember how i said that you currently have root access?  Well, you can&#8217;t  type passwd, give it a password and be done.  The reason is like i said, right now /etc/passwd is being consulted.  At best the command would fail.  At worst, nothing would happen.  You need to change the directory database root user&#8217;s password.  I&#8217;m pretty sure this is the same in 10.4 and 10.5.  We&#8217;ll be doing this interactive mode:</p>
<pre>dscl .</pre>
<p>This opens the command line utility and gives you &#8220;shell&#8221; access to the database.  Next, we navigate to the right user like so&#8230;</p>
<pre>cd /Users</pre>
<p>Pretty easy so far.  Now we&#8217;ll give the root account a password thus enabling it on boot.  You can also substitute &#8220;root&#8221; here for any other account you see after typing ls to reset that password.</p>
<pre>/Users &gt; passwd root
New Password:
/Users &gt;</pre>
<p>Just enter your password of choice after &#8220;New Password&#8221; and your done.  Type exit and then reboot to reboot into normal mode</p>
<pre>exit
reboot</pre>
<p>When the computer comes up, either click on other and type root for user and the password you gave or just type it in the name a password fields and voila!  Superuser access.  Now be careful.  &#8220;With Great Power Comes Great Responsibility&#8221;.  Seriously, the superuser isn&#8217;t inhibited by any permissions or many of the security features of the system.  You can cause real damage and not even be warned about it with him.  That said, you can also use it to ignore permissions and retrieve files or whatever you need to do.</p>
<p>Method 2.b.  Make your own account.</p>
<p>Maybe you need into the computer but don&#8217;t want to bother any account data already there.  The following commands, in non-interactive mode, will create a user called Administrator with administrative privileges.</p>
<pre>dscl . -create /Users/"admin"
dscl . -create /Users/"admin" UserShell /bin/bash
dscl . -create /Users/"admin" RealName "Administrator"
dscl . -create /Users/"admin" UniqueID "id"
dscl . -create /Users/"admin" PrimaryGroupID "20"
dscl . -create /Users/"admin" NFSHomeDirectory /Users/admin
dscl . -passwd /Users/"admin" "password"
dscl . -append /Groups/admin GroupMembership admin</pre>
<p>One thing about the above.  The UniqueID.  This has to be unique.  One thing you can do to determine a usable uniqueid is to run this command:</p>
<pre>echo $[$(dscl . -list /Users uid | awk '{print $2}' | sort -n | tail -n1)+1]</pre>
<p>Of course, you&#8217;re probably safe using a high number like 550 provided you don&#8217;t have 50 or more local users on your machine.  You can change the commands above to create a user with a different name, etc. but be careful.  Theres a little more to it than that.  <a title="Apple's create user instructions" href="http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/additionalfeatures/chapter_10_section_9.html">Here</a> are apples instructions on creating users this way but they leave out creating a group for the user and just using staff instead.  Thats probably fine but i&#8217;ve had trouble not creating a group before.  I may do a writeup on that later.</p>
<p>Now, the security conscious people out there are probably wondering, &#8220;isn&#8217;t this a huge security hole?  I mean anyone can gain root whenever they want&#8221;.  First, no they can&#8217;t.  This might sound obvious but to do any of this, they have to be sitting in front of the machine.  For years, security experts have said physical security is the first step to a secure system.  Seriously, any machine can be compromised if you have physical access to it.  FWIW, there are any number of tools available online to reset windows passwords.  This same basic technique can also be applied to any linux system that hasn&#8217;t been really locked down but again, with physical access, you can reset it.  That said, you can&#8217;t always have physical security.  In a school for example, kids may be in a position to reboot a computer and do this without a teacher really noticing.  If you want to, there are a few things you can do to mitigate the problem.</p>
<ol>
<li>Set a firmware password.  <a title="Firmware password reset instructions." href="http://support.apple.com/kb/HT1352">Here</a> are apple&#8217;s instruction for doing so.  The upside is it prevents both single user mode and booting from a disc without the password.  The downside however is once again, physical security.  If you have physical access to the machine you can reset the firmware password by removing some memory, turning it on and off, and putting the memory back in.  This is, however,  much less easy to do in a school lab environment.</li>
<li>Turn on filevault.  Filevault will encrypt your home folder and all files in it using aes encryption.  Filevault requires your account password to decrypt it or alternatively, the master password.  The master password cannot be reset because only the one that encrypted it can decrypt it.  This secures your data but a new account could still be made allowing someone to use the machine.</li>
<li>Disable single user mode.  I hesitate to mention this because people might think its a legitimate thing to do.  Don&#8217;t.  Unless you&#8217;re sure you know what you&#8217;re doing, don&#8217;t.  I&#8217;m not going to post instructions or links here but a quick google search should give you what you want.</li>
</ol>
<p>Alternative method.</p>
<p>There is another thing you can do.  If you don&#8217;t care about the current user account or its corrupt or something, you can reset it completely.  Understand that all your login credentials will be wiped out and you will have to create a new one.  First, enter single user mode and mount the filesystem read/write.  Then do this:</p>
<p>10.4</p>
<pre>rm -Rf /var/db/netinfo</pre>
<p>10.5</p>
<pre>rm -Rf /var/db/dslocal
rm /var/db/.AppleSetupDone</pre>
<p>This removes the database files and forces Mac OS X to go through the setup assistant again allowing you to create an administrative account as though it were a brand new machine</p>
<p>Well, i hope this article has been informative.  Please leave a comment if you like or have any suggestions/corrections to make.</p>
<p><strong>*Update</strong>.  Turns out i was a little off on (at least)one thing.  In Mac OS X 10.5, netinfo has been completely dropped in favor of xml based files /var/db/dslocal.  It looks like the directory services daemon starts at runtime and reads these in allowing for database style queries to it.</p>
<p><strong>*Update 2</strong>.  I really need to learn to proofread.  Corrected many spelling errors and added commands where i had previously left placeholders.  Enjoy.</p>
<p><strong>*Update 3</strong>.  Mac (seriously &#8220;mac&#8221;? thats the best you could do?)  has pointed out that i&#8217;ve made a mistake.  In 10.5 there is an additional step to take after deleting the directory database.  I&#8217;ve added it above.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/06/25/mac-os-x-single-user-mode-password-reset/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dropdown Menu&#8217;s</title>
		<link>http://www.jessecole.org/2008/06/13/dropdown-menus/</link>
		<comments>http://www.jessecole.org/2008/06/13/dropdown-menus/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 20:53:16 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Site Stuff]]></category>

		<category><![CDATA[bradkovach]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=60</guid>
		<description><![CDATA[As anyone who follows me on twitter knows, I have added drop down menu&#8217;s to this site.  Its nice, check it out, hover over the &#8220;About Me&#8221; link up there.  Yeah, not bad.  Also known by twitter users is the fact that i did not come up with the css, etc. that [...]]]></description>
			<content:encoded><![CDATA[<p>As anyone who follows me on twitter knows, I have added drop down menu&#8217;s to this site.  Its nice, check it out, hover over the &#8220;About Me&#8221; link up there.  Yeah, not bad.  Also known by twitter users is the fact that i did not come up with the css, etc. that goes into this.  All credit, copyright, whatever goes to @<a title="Brad Kovach's Twitter Feed." href="http://twitter.com/bradkovach">bradkovach</a> (<a title="Brad Kovach and Friends." href="http://bradkovach.com">bradkovach.com</a>).  I have access to the themes he made for the <a title="Lincoln County School District #2" href="http://www.lcsd2.org">lcsd2.org</a> sites and i just copied and pasted from there without permission.  So i&#8217;d like to thank him for his generous lack of anger/suing me.</p>
<p>Now the reason i wanted drop down menu&#8217;s in the first place is for semantic organization.  Hover over about me and you get contact info, etc., stuff that belongs under about.  It also allows me to have more static content while still using this theme.  I rather like this theme/don&#8217;t feel like looking for another and would prefer to keep it.  Now i can.</p>
<p>Sometime in the future i will be adding things like contact info and actual content.  If you have any suggestions/hate, please use the contact page to let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/06/13/dropdown-menus/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A kitten prank.</title>
		<link>http://www.jessecole.org/2008/05/05/a-kitten-prank/</link>
		<comments>http://www.jessecole.org/2008/05/05/a-kitten-prank/#comments</comments>
		<pubDate>Tue, 06 May 2008 03:58:06 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Interesting Tech Crap]]></category>

		<category><![CDATA[bind]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[prank]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=57</guid>
		<description><![CDATA[Earlier today, i was sitting down, watching tv with my brother.  We were both on laptops doing other things at the same time.  He started watching an episode of loaded featuring 50 cent.  I do not like 50 cent.  After several minutes of the god-awful, talentless, garbage, i got sick of [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today, i was sitting down, watching tv with my brother.  We were both on laptops doing other things at the same time.  He started watching an episode of loaded featuring 50 cent.  I do not like 50 cent.  After several minutes of the god-awful, talentless, garbage, i got sick of it.  Did I go the pansy route and ask him to change it?  No!  I took the high road and made a few changed to my dns server causing all sites he tried to go to, to instead, go to <a title="Kittens!  Which one is cuter!?!  Its kittenwar.com!" href="http://kittenwar.com">kittenwar.com</a>. I&#8217;ll show you how i did it.</p>
<p><span id="more-57"></span></p>
<p>Now, first things first; you need to run your own dns server.  Secondly, the target must be using your dns server for lookups.</p>
<p>The first thing we need is the ip address to <a title="Kittens!  Yay!  Fuzzy! Wuzzy! Kittens!" href="http://kittenwar.com">kittenwar.com</a>.  Thats easy.  Its 64.111.96.38.  I shouldn&#8217;t have even mentioned this part.</p>
<p>Secondly, we need to construct a zone declaration that will claim to be the master for anything.  I used the following:</p>
<pre>zone "." {
	type master;
	file "kittenwar/all.hosts";
	};</pre>
<p>It worked great.  See, in dns, all domains end with an usually implied &#8220;.&#8221;.  (Its the one between the quotes)  This dot represents the root nameservers and how they&#8217;re the start of the domain name system.  I claim here to be the master authoritative namerserver for any domain ending in &#8220;.&#8221;.  That is to say, all domains.</p>
<p>Next, is the actual redirection&#8230;trickery&#8230;dns spoofing&#8230;whatever.  We now need to match all domains to have an A record of 64.111.96.38.  Luckily, this is easy.  I used the following:</p>
<pre>$TTL	86400
@			IN	SOA	localhost. root.localhost. (
					      2		; Serial
					 604800		; Refresh
					  86400		; Retry
					2419200		; Expire
					  86400 )	; Negative Cache TTL
;
@			IN	NS	localhost.
@			IN	A	64.111.96.38
*			IN	A	64.111.96.38</pre>
<p>Which also worked great.  Most of that isn&#8217;t strictly necessary for a zone like this but, i already had that one mostly made.  As you can see, we define &#8220;.&#8221; to have an A record for kittenwar as well as anything else &#8220;*&#8221;.  Well thats great, your done, your target is now going to <a title="Ok, seriously.  Stop reading the title text.  I'm BORED.  I can't think of anymore annoyingly cutesy phrases to put here." href="http://kittenwar.com">kittenwar.com</a> and there&#8217;s nothing he can do, right?  WRONG!!  You still need to select that victim to be the one that feels your wrath.</p>
<p>This next step involves views.  If your not using views, well, you should.  The tricky thing about them is every zone *must* be in a view if even one is.  So, remember that.  Bind cries bloody tears of pain everytime you don&#8217;t.  Sorry just wanted to make that point as graphic as possible.  You can add them manually if you want.  The way i did it, was with acl&#8217;s.  I used the following:</p>
<pre>acl kittened { 192.168.0.102; 192.168.0.110; };</pre>
<p>This matches both my brother (192.168.0.102) and myself (192.168.0.110).  I added myself so i could test that its working. I recommend doing this temporarily.  Now, add the acl to any views that the hosts may already be matched by.</p>
<pre>view "internal" {
    match-clients { !kittened; localnets; };
    recursion yes;
    include "/etc/bind/internal/internal.conf";
};</pre>
<p>There i&#8217;ve removed the acl &#8220;kittened&#8221; and all its hosts from normal service because i&#8217;m going to add them to a completely separate view.  Now, lets create that view.  The syntax is fairly simple, really just copy and paste from above where necessary.</p>
<pre>view "kittenwar" {
    match-clients { kittened; };
    recursion no;
    include "/etc/bind/kittenwar/kittenwar.conf";
};</pre>
<p>And thats it.  I turned off recursion for this view because its already authoritative for everything.  You don&#8217;t need to.  Give bind a good restart (it tends to like restarts better for changes like this) and try it out.  Now any domain/website that the target attempts to visit will simply bring up the page <a title="*Yaawwn* Kittenwar" href="http://kittenwar.com">kittenwar.com</a>.</p>
<p>*Note.  Operatings systems <strong>and</strong> browsers both tend to cache dns lookups.  It may take some time for these to expire and the effects to be seen.  For best results, have ssh access to the machine and clear the cache yourself/reboot the machine.  Also, you can do this for any site for which visiting the ip address takes you to the site.  Thats not always true, especially with shared hosting.  If you have any questions at all, leave a comment.</p>
<p>*Note 2.  When the target goes insane and begins chasing you around the house with a bloody chainsaw (why do the chainsaws always already have blood on them?).  And it <strong>will</strong> happen.  Its very easy to reverse this.  Just remove the ip address from the acl declaration and restart bind.  Then restart the machine/clear caches.  Intense &#8220;The Shining&#8221; style killing urges should subside after a while.  If it doesn&#8217;t, use your telepathic powers to summon the black guy to his death.  Somehow thats relevant and everything ends with you living despite being a retarded 9 year old vs a madman with an axe.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/05/05/a-kitten-prank/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google apps, jabber.</title>
		<link>http://www.jessecole.org/2008/04/02/google-apps-jabber/</link>
		<comments>http://www.jessecole.org/2008/04/02/google-apps-jabber/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 01:50:37 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Interesting Tech Crap]]></category>

		<category><![CDATA[Site Stuff]]></category>

		<category><![CDATA[bind]]></category>

		<category><![CDATA[dns]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[free]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">1584360211</guid>
		<description><![CDATA[As very few of you know, (maybe i should actually put something in the about me section) i started this little website as a project to learn linux better and to learn to manage a webserver.  Since then, this little project has turned into something i actually care about and take a measure of [...]]]></description>
			<content:encoded><![CDATA[<p>As very few of you know, (maybe i should actually put something in the <a title="About Me" href="http://www.jessecole.org/about">about me</a> section) i started this little website as a project to learn linux better and to learn to manage a webserver.  Since then, this little project has turned into something i actually care about and take a measure of pride in.  This is due in no small part to the miracle that is <a title="Google Apps" href="http://www.google.com/a/help/intl/en/admins/editions.html">google apps for your domain</a>.</p>
<p>I like managing a webserver.  I like manually managing <a title="ISC's Bind 9" href="http://en.wikipedia.org/bind">bind</a> and <a title="Apache" href="http://www.apache.org/">apache</a> from the command line.  I like the sense of control i feel when i am able to make any changes i want any time i want.  What i don&#8217;t like though, is email.  Email is evil.  Go ahead, take a look at the configuration files for <a title="Evil sendmail" href="http://www.sendmail.org/">sendmail</a> sometime.  Try <a title="Less Evil Postfix" href="http://www.postfix.org/">postfix</a>, not much better.  I don&#8217;t want to do email but i want to get email.  So what did i do? I went with google apps for your domain.</p>
<p><span id="more-54"></span></p>
<p>Google apps for your domain is a godsend.  I make a few small changed to my dns, which i can easily do; specifying google as my mail exchanger (mx) and i&#8217;m done.  Below i&#8217;ve included the records required for email.</p>
<pre>@           IN    MX 1     aspmx.l.google.com.
@           IN    MX 5     alt1.aspmx.l.google.com.
@           IN    MX 5     alt2.aspmx.l.google.com.
@           IN    MX 10    ASPMX2.GOOGLEMAIL.COM.
@           IN    MX 10    ASPMX3.GOOGLEMAIL.COM.
@           IN    MX 10    ASPMX4.GOOGLEMAIL.COM.
@           IN    MX 10    ASPMX5.GOOGLEMAIL.COM.</pre>
<p>Google handles all my email for me.  I can use their nice, friendly-ish web interface to add up to 100 users for email.  I can add mailing lists so that an email sent to, for example, lists@jessecole.org would go to whoever i added to that list.  I can tie in my other domains with it so that jesse@jessecole.info works just as well as jesse@jessecole.org and it gets delivered to the same mailbox.  On top of all of this, i get google&#8217;s <strong>fantastic!</strong> email filtering.  I never get a single spam message through and very rarely do i see a false positive.  Google even provides pop, smtp, and imap access to my email.</p>
<p>Another feature that isn&#8217;t talked about so much is google talk.  Thats right, every user i make can log in to google talk with user@domain.com.  The can also use any jabber client to log in.  Also, i recently implemented <a title="XMPP at wikipedia" href="http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol">XMPP</a> server dialback as per section <a title="Section 14.4 of RFC 3920" href="http://www.xmpp.org/specs/rfc3920.html#security-server">14.4</a> of <a title="RFC 3920" href="http://www.ietf.org/rfc/rfc3920.txt">RFC 3920</a> allowing virtually all jabber clients to talk to anyone logged in.  Ok, fine.  All that is accurate but i just followed google&#8217;s instructions <a title="Google's fancy smancy instruction for properly implementing section 14.4 of RFC 3920.  Pfff.. I like my way better." href="http://www.google.com/support/a/bin/answer.py?hl=en&amp;answer=34143">here</a>.  Incidently, its perfectly legal in dns-ese to paste the following into your zone file or include it globally.</p>
<pre>_xmpp-server._tcp   IN SRV  5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server1.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server2.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server3.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server4.l.google.com.

_jabber._tcp        IN SRV  5 0 5269 xmpp-server.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server1.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server2.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server3.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server4.l.google.com.</pre>
<p>Fully qualified domain names are for quitters.</p>
<p>With google apps for your domain you get all this and all of the google apps.  Thats right.  Your &lt;employee&gt;@jessecole.org account also gets its own google docs, google calendar, google everything!.  Its no wonder some businesses are using for their site.  The best part about all of this is that its free!  You can pay extra and get more users, features, support, etc.  Not necessary.  This is a great thing for little websites like me.</p>
<p>I hope you enjoyed my little post (post? this is an article!) on google apps.  Please, leave me a comment if you liked it/disagree/hate me/whatever.</p>
<p><strong>*Update*</strong> I am officially declaring the whitespace stripping in pre text a wordpress bug.  I think i&#8217;ll actually file one later today.  It won&#8217;t do it if you step just right through the posting process though so it should look good now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/04/02/google-apps-jabber/feed/</wfw:commentRss>
		</item>
		<item>
		<title>99.13% uptime</title>
		<link>http://www.jessecole.org/2008/03/31/9913-uptime/</link>
		<comments>http://www.jessecole.org/2008/03/31/9913-uptime/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 03:59:31 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Interesting Tech Crap]]></category>

		<category><![CDATA[Site Stuff]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[server]]></category>

		<category><![CDATA[uptime]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=53</guid>
		<description><![CDATA[I&#8217;ve been using host-tracker for a while now to monitor my uptime.  Today they sent me my quarterly report and i&#8217;m pleased to report, to you, that my uptime is better than many for pay shared hosting providers.  My little server that i put together myself, running directly on the grid with no [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a title="Host Tracker" href="http://host-tracker.com">host-tracker</a> for a while now to monitor my uptime.  Today they sent me my quarterly report and i&#8217;m pleased to report, to you, that my uptime is better than many for pay shared hosting providers.  My little server that i put together myself, running directly on the grid with no UPS, running off a little tiny slow home dsl connection, and connected to that connection via an old wireless bridge is better than some datacenters.  That is just awesome.  Below i have included the report they sent me, whitespace and all.</p>
<pre>Quarterly report 2008-01

http://www.jessecole.org
Total uptime:99.13% Downtime:6 hour(s) 13 min(s)
Quarterly uptime:99.13% Downtime:6 hour(s) 13 min(s)
Month 2008-03 Uptime:99.13% Downtime:6 hour(s) 13 min(s)</pre>
<p><strong>*Update*</strong>So, wordpress helpfully stripped the white space.  Yay!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/03/31/9913-uptime/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wordpress 2.5 finally released!</title>
		<link>http://www.jessecole.org/2008/03/29/wordpress-25-finally-released/</link>
		<comments>http://www.jessecole.org/2008/03/29/wordpress-25-finally-released/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 16:23:18 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Site Stuff]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=51</guid>
		<description><![CDATA[So finally, 3 weeks after the scheduled date, wordpress version 2.5 has been released.  Wordpress is the software i use to power this site and the new version gives me some nice new featured to help with that.  That doesn&#8217;t mean you will see any better content nor will it come any more [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wordpress.org"><img class="alignleft size-full wp-image-52" style="float: left;" title="Wordpress Logo" src="http://www.jessecole.org/wordpress/wp-content/uploads/wplogo25-1001.png" alt="Wordpress logo" width="100" height="100" /></a>So finally, 3 weeks after the scheduled date, wordpress version 2.5 has been released.  Wordpress is the software i use to power this site and the new version gives me some nice new featured to help with that.  That doesn&#8217;t mean you will see any better content nor will it come any more often.  It just means that the new version is out and i&#8217;m using it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/03/29/wordpress-25-finally-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Site policy, contact info, registrations.</title>
		<link>http://www.jessecole.org/2008/03/10/site-policy-contact-info-registrations/</link>
		<comments>http://www.jessecole.org/2008/03/10/site-policy-contact-info-registrations/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 00:59:00 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Site Stuff]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=48</guid>
		<description><![CDATA[I&#8217;ve made a new page detailing the site policy, etc.  I also realized that you apparently cannot leave comments for a page and that no one could contact me without using a post that may or may not be relevant.  I&#8217;ve created a new text box on the left sidebar(to the right) with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a new <a title="Disclosure." href="http://www.jessecole.org/disclosure/">page</a> detailing the site policy, etc.  I also realized that you apparently cannot leave comments for a page and that no one could contact me without using a post that may or may not be relevant.  I&#8217;ve created a new text box on the left sidebar(to the right) with all my contact info to get ahold of me.  I also turned on user registrations so people can have a little more of a permanent presence on my blog.  If this starts getting abused by bots, etc. i may have to get some capchas in there or turn it off.  If you request, i may up your status from subscriber to something that can submit posts, etc. to me.</p>
<p>I hope you enjoy the new changes and happy blogging :).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/03/10/site-policy-contact-info-registrations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Prime Numbers</title>
		<link>http://www.jessecole.org/2008/03/08/prime-numbers/</link>
		<comments>http://www.jessecole.org/2008/03/08/prime-numbers/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 23:39:44 +0000</pubDate>
		<dc:creator>Jesse Cole</dc:creator>
		
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.jessecole.org/?p=43</guid>
		<description><![CDATA[So, as you know from previous posts, I&#8217;m a geek. That means i like to do geeky things and then tell people.  What do i have this time you ask?  Why its a list of prime number up to and including 1005833, not counting 1(it was slightly more effort than i wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>So, as you know from previous posts, <a title="I'm a geek." href="http://www.jessecole.org/2007/12/10/im-a-geek/">I&#8217;m a geek.</a> That means i like to do geeky things and then tell people.  What do i have this time you ask?  Why its a list of prime number up to and including 1005833, not counting 1(it was slightly more effort than i wanted to put in to this).  Yeah, so i got bored and wrote the little program below in java to generate this.  I decided to run it on my file/web server here.  Its a 2.6 ghz pentium 4 with hyperthreading and it took about 4.5 hours to generate these.</p>
<pre>public class CountPrime
{
public static void main(String[] args)
{
for(long i=1;i&lt;30000000;i=i+2)
{
for(long j=i-1;j&gt;1;j--)
{
if(i%j==0) break;
if(j==2) System.out.println(i);
}
}	}
}</pre>
<p>This bring me to a little mini-rant.  Notice how i&#8217;m using longs in the code above?  Why not just do something smart and use unsigned integers giving you a nice 2^32 long space to work with?  Well here&#8217;s the answer.  JAVA DOESN&#8217;T FREAKING SUPPORT UNSIGNED ANYTHING!!!!  I took 2 classes on java and never heard a word about this.  I&#8217;ve defended java from idiots that for some reason <em>like</em> c or c++ without knowing this.  How do you freaking design a programming language without support for something so unbelievable basic as unsigned integers or short or chars or bytes or longs or anything like that?</p>
<p>Ok, that was a little more than a mini-rant but i feel better now.  Anywho, <a href="http://www.jessecole.org/wordpress/wp-content/uploads/prime.tgz">here</a> are the list of prime numbers.  The file is tar&#8217;ed and gzip&#8217;ed so if you&#8217;re using the only os in the world that doesn&#8217;t support it built-in (windows), its time to upgrade to something &#8216;nix based.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessecole.org/2008/03/08/prime-numbers/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
