<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/templates/default/atom.css" type="text/css" ?>

<feed version="0.3" 
   xmlns="http://purl.org/atom/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <link href="http://jasonfried.info/rss.php?version=atom0.3" rel="service.feed" title="JasonFried.info" type="application/x.atom+xml" />
    <link href="http://jasonfried.info/"                        rel="alternate"    title="JasonFried.info" type="text/html" />
    <link href="http://jasonfried.info/rss.php?version=2.0"     rel="alternate"    title="JasonFried.info" type="application/rss+xml" />
    <title mode="escaped" type="text/html">JasonFried.info</title>
    <tagline mode="escaped" type="text/html">My Technical Life</tagline>
    <id>http://jasonfried.info/</id>
    <modified>2010-06-16T19:13:05Z</modified>
    <generator url="http://www.s9y.org/" version="1.5-beta1">Serendipity 1.5-beta1 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>
    <info mode="xml" type="text/html">
        <div xmlns="http://www.w3.org/1999/xhtml">You are viewing an ATOM formatted XML site feed. Usually this file is inteded to be viewed in an aggregator or syndication software. If you want to know more about ATOM, please visist <a href="http://atomenabled.org/">Atomenabled.org</a></div>
    </info>

    <entry>
        <link href="http://jasonfried.info/archives/2-Active-Directory-and-Subversion-Fixing-the-case-sensitive-username-problem.html" rel="alternate" title="Active Directory and Subversion - Fixing the case-sensitive username problem " type="text/html" />
        <author>
            <name>Jason Fried</name>
                    </author>
    
        <issued>2010-06-10T21:11:44Z</issued>
        <created>2010-06-10T21:11:44Z</created>
        <modified>2010-06-16T19:13:05Z</modified>
        <wfw:comment>http://jasonfried.info/wfwcomment.php?cid=2</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://jasonfried.info/rss.php?version=atom0.3&amp;type=comments&amp;cid=2</wfw:commentRss>
    
        <id>http://jasonfried.info/archives/2-guid.html</id>
        <title mode="escaped" type="text/html">Active Directory and Subversion - Fixing the case-sensitive username problem </title>
        <content type="application/xhtml+xml" xml:base="http://jasonfried.info/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p><img src="http://jasonfried.info/uploads/journal/svn-square.jpg" border="0" alt="svn-square" title="svn-square" width="80" height="80" /><img src="http://jasonfried.info/uploads/journal/svn-name-banner.jpg" border="0" alt="svn-name-banner" title="svn-name-banner" width="320" height="80" /></p>
<p>If you are running Subversion under Apache HTTPD and you are using the basic ldap provider to connect to Active Directory, then you know that Active Directory will let you authenticate using any case as long as the password matches. Normally this would not be a problem, as most of the time people do not add capitalization to their login names. Where this becomes a problem is when your using an "sn authz" file, which is case-sensitive.</p>
<p style="padding-left: 30px;">joe.user = rw</p>
<p>this will not match if he logs in with "Joe.User". I became tired of telling people to use only lower-case that I decided to fix the problem for good. I had two possible solutions, patch Subversion or Make a custom authentication provider for Apache. The Apache route sounded easier and not prone to breaking next Subversion update. I already had mod_perl installed so it was quite easy to setup using <a onclick="javascript: pageTracker._trackPageview('/extlink/search.cpan.org/~geoff/Apache-AuthenHook-2.00_04/AuthenHook.pm');"  href="http://search.cpan.org/~geoff/Apache-AuthenHook-2.00_04/AuthenHook.pm" target="_blank" title="Apache::AuthenHook">Apache::AuthenHook</a>.</p>
<p>So first thing you need to do is create a lib folder somewhere to hold your basic provider pm file. I have a pretty organized subversion setup so i just created lib folder in my subversion root.</p>
<pre>[jfried@svn01]:/&gt; cat /infrastructure/source/lib/Fried/LDAPProvider.pm
package Fried::LDAPProvider;
use Net::LDAP;
use Apache2::RequestRec;
use Apache2::Const -compile =&gt; qw(OK DECLINED HTTP_UNAUTHORIZED);
use strict;

sub handler {
    my ($r, $user, $password) = @_;
    my $ldap = Net::LDAP-&gt;new ('ldaps://DOMAIN') 
                                       or return Apache2::Const::DECLINED;
    my $mesg = $ldap-&gt;bind("$user@DOMAIN", password =&gt; $password );
    $mesg-&gt;code &amp;&amp; return Apache2::Const::DECLINED;
    if ($mesg-&gt;{resultCode} == 0) {
        $r-&gt;user(lc $user);
        return Apache2::Const::OK;
    }
    $ldap-&gt;unbind;

    return Apache2::Const::DECLINED;
}
1;
</pre>
<p>Just Update DOMAIN with your Active Directory Domain name. The important part that fixes the problem is the $r-&gt;user(lc $user) which tells Apache what the user name should be.</p>
<p>Now to make Apache make use of this we put the following inside our Apache configuration. Inside your subversion virtual host.</p>
<pre>PerlSwitches -I/infrastructure/source/lib
PerlLoadModule Apache::AuthenHook

&lt;Location /repos/&gt;
    DAV svn
    SVNParentPath /infrastructure/source/repos
    ...
    AuthType Basic
    AuthBasicProvider Fried::LDAPProvider
    AuthName "Subversion Repositories"
    Require valid-user
    ...
&lt;/Location&gt;
</pre>
<p>Reload and authz works no mater what case they login with.</p> 
            </div>
        </content>

        
    </entry>
    <entry>
        <link href="http://jasonfried.info/archives/1-Ubuntu-Live-USB.html" rel="alternate" title="Ubuntu Live USB " type="text/html" />
        <author>
            <name>Jason Fried</name>
                    </author>
    
        <issued>2010-04-10T03:37:20Z</issued>
        <created>2010-04-10T03:37:20Z</created>
        <modified>2010-04-16T16:15:44Z</modified>
        <wfw:comment>http://jasonfried.info/wfwcomment.php?cid=1</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://jasonfried.info/rss.php?version=atom0.3&amp;type=comments&amp;cid=1</wfw:commentRss>
    
        <id>http://jasonfried.info/archives/1-guid.html</id>
        <title mode="escaped" type="text/html">Ubuntu Live USB </title>
        <content type="application/xhtml+xml" xml:base="http://jasonfried.info/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>&#160;</p>
<p><img src="http://jasonfried.info/uploads/journal/ubuntu_live_usb/ubuntu-logo1.png" border="0" alt="ubuntu-logo1" title="ubuntu-logo1" width="130" height="130" /><img src="http://jasonfried.info/uploads/journal/ubuntu_live_usb/amp.png" border="0" alt="amp" title="amp" width="130" height="130" /><img src="http://jasonfried.info/uploads/journal/ubuntu_live_usb/usbdrive.png" border="0" alt="usbdrive" title="usbdrive" width="130" height="130" /></p>
<p>Well Its Programming Contest time at the Hattiesburg Development Center a yearly recruiting event to attract students from the surrounding universities. Unlike the ACM Contest we give good prizes like game consoles. In past years we used a knoppix based CD image for the contests machines, last year we had some issues with hardware support. The knoppix image was three years old, so I volunteered to setup a new image this year. Seeing how remastering CD images and burning 20 something CDR's is not fun at all or easy I trashed the entire boot CD idea in favor of USB flash drives.</p>
<p><a onclick="javascript: pageTracker._trackPageview('/extlink/www.ubuntu.com');"  href="http://www.ubuntu.com" target="_blank" title="Ubuntu Linux Project">Ubuntu</a> has become very popular in recent years and I have heard good things (RedHat Family Man myself). So I grabbed the latest version and installed it on a Dell tower scavenged from an empty cube. It turns out that Ubuntu comes with a built in tool to create Live USB's it is called "<a onclick="javascript: pageTracker._trackPageview('/extlink/en.wikipedia.org/wiki/Ubuntu_Live_USB_creator');"  href="http://en.wikipedia.org/wiki/Ubuntu_Live_USB_creator" target="_blank" title="usb-creator at wikipedia">usb-creator</a>". It is very simple to use and it sets up the persistence for you.&#160;</p>
<p>Using the Live USB method the contestants can keep work saved threw system crashes and at the end of the contest they can take the entire contest environment home with them. Which i think is a little added value.</p>
<h4>Contest Image Setup</h4>
<p>So I boot up my new live USB ran an "apt-get upgrade" to bringe it upto date.</p>
<p>Installed the standard packages to support the 3 allowed submission languages: Java, C, C++, More if you can wrap them inside those 3 languages :)</p>
<ul>
<li>SUN JDK</li>
<li>JAVADOC</li>
<li>GNU G++</li>
</ul>
<p>To be nice to the contestants I gave them an IDE and a code friendly editor. Though in a contest an IDE will mostly slow you down.</p>
<ul>
<li>Eclipse</li>
<li>Komodo Edit</li>
</ul>
<h4>User Accounts</h4>
<p>I created three user accounts: Judge, Contest and Practice. The first obviously for the three judges to use for judging submissions. The practice user will be used for the practice round before the contest, to allow the team to get comfortable with the contest environment before contest start. And the contest user is for the actual contest, and we will make the password available in the problem statement packet .</p>
<p>I created links to the JAVA Docs and to Eclipse and Komodo Edit and placed them on the desktop of both the contest and practice user. Also copied in <a href="http://jasonfried.info/friedscript/" target="_blank" title="my TCSH recipe file">friedscript</a> to make the console friendly.</p>
<p>One of the requirements it that the machines have to be cleaned out between the practice round and contest to prevent any work carried over. This is pretty simple as well, I created a tar.gz of the practice home directory and placed a few lines in /etc/rc.local to make sure its clean every time the machine boots. Also /tmp clears out automatically.</p>
<pre>cd /home<br />rm -rf practice<br />tar -zxf practice.tar.gz<br /></pre>
<p>I can send runners around after the practice round to power cycle all the laptops.</p>
<h4>Judge Test Harness</h4>
<p>I created a test harness using Perl that takes three arguments the command to run the input file to pass it and the expected output file, also a fourth argument triggering debug output. The script runs the command in one thread and monitors its run time in another, if its run time extends past a set limit the command is killed and a "fail" message is sent to the judge. If the command does execute in time and produces output it is automaticly checked against the expected output using diff. The debug switch will show the judges the diff output. But if no difference between the actual output and expected output then a "Passed" message is displayed.</p>
<h4>Boot Splash Screen Timeout</h4>
<p>If i had more time to work on this project, I could edit the syslinux boot screen to make more sense. But I do not so I just opened up the <em>/cdrom/syslinux/syslinux.cfg </em>and set the timeout to 1. This will cause ubuntu to boot immediately instead of asking you if you want to install.</p>
<h4>Final Changes</h4>
<p>The guys working on the contest problems will be sending me the example input and output so that I can place them in a folder on the Contest users desktop. This is to prevent any confusion over white space characters on printed examples.</p>
<p>Also set the firefox homepage to the contest submission web site.</p>
<h4>Mass Replication</h4>
<p>I have been using the Unix '<em>dd</em>' command to make images of my master usb flash disk for safekeeping. Its also an easy process. <em>/dev/sdb</em> is the USB device</p>
<pre>dd if=/dev/sdb of=contest.img bs=64K<br /></pre>
<p>So my wife has a 7 port powered USB hub so I think I am going to barrow that combined with the 6 USB ports on my dell with the mouse and keyboard removed (I'll be using SSH). I can image 12 thumb disks at a time :) It will look something like this</p>
<pre>dd if=contest.img bs=64K | tee /dev/sdb | tee /dev/sbc | ... &gt; /dev/sdm <br /></pre>
<p>That should be interesting it will most likely push the USB bus to a slow crawl, but I am going to try it. I'll update this entry with my results.</p>
<p><em>(Updated) That does not work so well, the usb's produced had invalid partition tables, and only booted on my dell.</em></p>
<p>The Annual Deloitte Hattiesburg Development Center Programming Contest will take place on 4/17/2010. So we will see how successful my little image is then.</p> 
            </div>
        </content>

        
    </entry>
</feed>