<?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>divisionbyzero &#187; Article</title>
	<atom:link href="http://divisionbyzero.net/blog/category/article/feed/" rel="self" type="application/rss+xml" />
	<link>http://divisionbyzero.net/blog</link>
	<description>question . authority</description>
	<lastBuildDate>Tue, 06 Jul 2010 16:43:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Statistics, Risk Analysis, and Misunderstandings</title>
		<link>http://divisionbyzero.net/blog/2010/06/11/statistics-risk-analysis-and-misunderstandings/</link>
		<comments>http://divisionbyzero.net/blog/2010/06/11/statistics-risk-analysis-and-misunderstandings/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 14:55:05 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[risk management]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=172</guid>
		<description><![CDATA[I married a Statistician, so this article sums the lectures I receive on a daily basis.  Risk Management is statistical analysis, and I&#8217;m not sure how many folks in IT Security have Graduate level Stat exposure.  So, the understanding of our statistical shortcomings is key.  You need to read that entire article, twice. This statement [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">I married a Statistician, so <a title="Your intuition is not magic" href="http://lesswrong.com/lw/2bu/your_intuitions_are_not_magic/" target="_blank">this article</a> sums the lectures I receive on a daily basis.  Risk Management is statistical analysis, and I&#8217;m not sure how many folks in IT Security have Graduate level Stat exposure.  So, the understanding of our statistical shortcomings is key.  You need to read that entire article, twice.</div>
<div></div>
<div id="_mcePaste">This statement struck me, as I&#8217;ve noticed a scary trend in IT Security:</div>
<blockquote>
<div id="_mcePaste">&#8220;People who know a little bit of statistics &#8211; enough to use statistical techniques, not enough to understand why or how they work &#8211; often end up horribly misusing them.  Statistical tests are complicated mathematical techniques, and to work, they tend to make numerous assumptions. The problem is that if those assumptions are not valid, most statistical tests do not cleanly fail and produce obviously false results.&#8221;</div>
</blockquote>
<div id="_mcePaste">As we outsource more security, and buy more products, we must be careful, as this statement is also true:</div>
<blockquote>
<div id="_mcePaste">&#8220;People who know a little bit of <em>IT Security</em> &#8211; enough to use an <em>IDS or SIEM</em>, not enough to understand why or how they work &#8211; often end up horribly misusing them.  <em>Security tools</em> use <em>complicated technical techniques</em>, and to work, they tend to make numerous assumptions. The problem is that if those assumptions are not valid, most security tools do not cleanly fail and produce obviously false results.&#8221;</div>
</blockquote>
<div>My wife&#8217;s constant guidance in Statistics has been invaluable to my evaluations of IT Security Policy and Implementation.  When I came across this article thanks to <a title="alexhutton" href="http://twitter.com/alexhutton" target="_blank">@alexhutton</a>, I had to share it!</div>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2010/06/11/statistics-risk-analysis-and-misunderstandings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Unofficial Doctrine of &#8220;Helping Hand&#8221; Evolution</title>
		<link>http://divisionbyzero.net/blog/2010/03/08/the-unofficial-doctrine-of-helping-hand-evolution/</link>
		<comments>http://divisionbyzero.net/blog/2010/03/08/the-unofficial-doctrine-of-helping-hand-evolution/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 20:22:52 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[catholicism]]></category>
		<category><![CDATA[evolution]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=162</guid>
		<description><![CDATA[I&#8217;ve been schooling myself on Evolutionary Biology for about 3 or 4 years. I dropped out of college after my freshman year because Undergrad was then, and is still is today a lifeless process of rote memorization.  During that time, I didn&#8217;t learn to learn, or learn anything more than &#8220;here are the rules, and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been schooling myself on Evolutionary Biology for about 3 or 4 years.<br />
I dropped out of college after my freshman year because Undergrad was then,<br />
and is still is today a lifeless process of rote memorization.  During that<br />
time, I didn&#8217;t learn to learn, or learn anything more than &#8220;here are the<br />
rules, and if you don&#8217;t follow them, there will be consequences.&#8221;  I&#8217;m not<br />
sure if the topic of this essay is relevant to anyone outside of<br />
Catholicism, but I&#8217;ve not heard much about it in the Skeptic / Science<br />
Community.<br />
<span id="more-162"></span><br />
I attended public school through the 5th Grade  then and did very well.  I<br />
was placed in the &#8220;Gifted and Talented&#8221; program in 4th Grade and maintained<br />
advanced placement in Math through 5th Grade.  I earned a coveted &#8220;Student<br />
of the Year&#8221; Award for my participation in extracurricular activities and my<br />
high grades in the most advanced classes.</p>
<p>In 6th Grade, I was accepted into a Private Catholic School.  I was a good<br />
student for the rest of my Middle and High School careers, but not<br />
exceptional.  In grade school, I had asked and received answers to my<br />
toughest questions.  In Middle and High School, the questions became<br />
increasingly complex and more subversive to the Dogma.  My questions were<br />
discouraged, or worse punished, and I fell out of love with school.</p>
<p>In 10th Grade, I took my first &#8220;Biology&#8221; Class.  Biology in quotes because<br />
this was a Catholic High School.  We learned about cells, cell structures,<br />
dissected disgusting owl pellets, and covered Evolution.  It wasn&#8217;t really<br />
emphasized, and questions about it&#8217;s conflict with the Bible were glossed<br />
over by the generic &#8220;Helping Hand&#8221; Argument.  For an aspiring Devotee to<br />
Catholicism and Diligent Seeker of the Truth, this idea seemed amazingly<br />
beautiful and perfect.</p>
<p>There needs to be a distinction here between &#8220;Helping Hand&#8221; and &#8220;Intelligent<br />
Design.&#8221;  Intelligent Design is uneducated rubbish.  Had ID been<br />
presented to me at age 14, I would&#8217;ve laughed it straight out of the<br />
classroom.  ID looks at Life Forms and finds intricate, beautiful pieces of<br />
those organisms that seem unlikely to have arisen from pure, unadulterated<br />
random chance.  The eye and the Bombardier Beetle are prime examples of ID&#8217;s<br />
misinformation.</p>
<p>The convincing &#8220;Helping Hand&#8221; argument irresponsibly pitched to me by a<br />
well-meaning Biology Teacher essentially stated &#8220;God started the<br />
evolutionary process and made sure that the correct random mutations were<br />
selected for by shaping the environment in which our evolutionary ancestors<br />
arose.&#8221;  The fact that the ID Camp has not latched onto this concept<br />
demonstrates just how astoundingly stupid they are.  As a political idea,<br />
this &#8220;Helping Hand&#8221; argument appears to be a harmless means for religion to<br />
reconcile it&#8217;s Dark Age, Anti-Intellectual Dogma to modern science&#8217;s most<br />
powerful ideas.</p>
<p>So, why is this idea dangerous, idiotic, and offensive?  It&#8217;s simple.  The<br />
&#8220;Helping Hand&#8221; concept is irresponsible because it&#8217;s not necessary.  More<br />
than unnecessary, it exposes dangerous flaws in the Religion itself.<br />
Consider that religions consider God to be a fairly &#8220;Perfect&#8221; being.  Often<br />
God receives All-Knowing, All-Powerful, Ever Present status.  If that&#8217;s the<br />
case, then the &#8220;Helping Hand&#8221; argument serves only to expose God as an<br />
incompetent hack.</p>
<p>If there were intelligence behind the Evolutionary Process we should be able<br />
to see it in Humans.  After all, we are created in His image?  That doesn&#8217;t<br />
appear to be the case.  As products of Evolution, you and I are scarcely<br />
prepared to exist in the Modern World.  Our tongues sense Salt, a necessary<br />
mineral to help us maintain our overwhelmingly liquid existence.  We crave<br />
sugars, some of the most efficient mechanisms for transferring energy.  We<br />
sense bitterness, because in our evolutionary past bitterness often<br />
indicated poisons.  We crave savoriness because the protein of meat has<br />
encouraged the rapid, outpacing expansion of our brain.  We also taste and<br />
sense sourness, which identify acidic compounds necessary to maintain the<br />
alkalinity of the body.</p>
<p>All of these evolutionary processes served our ancestors incredibly well.<br />
They are indispensable in the shaping of Homo Sapiens.  This might seem<br />
neutral in our &#8220;Helping Hand&#8221; vs Natural Selection argument.  But, that&#8217;s<br />
not the case.  These cravings served us well in the past, but how are they<br />
affecting us these days?  Imagine this process was aided by an All-Knowing,<br />
All-Powerful Creator, targeting the emergence of Homo Sapiens as he zapped<br />
Reptiles and Bacteria from a cloud, patiently paving the road for us.  The<br />
Hands guiding us to where we were in 1 CE.</p>
<p>And then what?  These very simple and basic taste sensations that were<br />
necessary for a caloric scarce existence in the past, are literally killing<br />
us en masse in our Caloric Rich &#8220;Industrialized&#8221; existence today.  Has He<br />
stopped paying attention?  Did He get bored?  Hello, is this thing on?</p>
<p>By inserting the &#8220;Helping Hand&#8221; idea into Evolutionary Biology, theologians<br />
have created far more serious problems than they answered.  Taste is but one<br />
small, fairly simple demonstration of this fallacy.  Consider the #1 killer<br />
in America, Heart Disease.  The problem is compounded by our taste for<br />
calorie rich food, but that is overshadowed by the catastrophic design<br />
failure of the magnificent Human Heart.  If there was someone nudging<br />
evolution, who could see the future, surely they saw this problem coming.<br />
Back then, it would&#8217;ve been trivial to correct.  I&#8217;m not a Cardiologist, or<br />
Evolutionary Biologist.  I&#8217;m a Software Developer and System Administrator,<br />
so I&#8217;ll have to invoke one of the first design problems I was taught in my<br />
limited schooling: Single Point of Failure.   The Human Heart has 1 Major<br />
Artery into, and out of the Heart.</p>
<p>If I were designing, or nudging the process of Human Evolution, as an<br />
imperfect, under-educated, simplistic, narrow-minded Human Being, I&#8217;d say<br />
&#8220;maybe we should have some redundancy in such a critical element!&#8221;  Surely,<br />
that adaptation could be demonstrated to be benevolent and useful.  Surely<br />
it would exhibit the foresight of some intelligent being edging towards a<br />
perfect being.</p>
<p>The lack of foresight in such an obvious and enormous problem as Heart<br />
Disease, is Yet Another demonstration of the logical fallacies committed by<br />
the most well-meaning religious people.  It doesn&#8217;t need to be there.  It<br />
doesn&#8217;t answer any questions, it only creates more questions.  Science can<br />
only deal with questions that can be answered.  The &#8220;Unmoved Mover,&#8221;<br />
&#8220;Creationism,&#8221; &#8220;Intelligent Design,&#8221; and &#8220;Helping Hand&#8221; in-dignify the<br />
amazing brilliance of Human understanding, creativity, and intelligence.</p>
<p>If you&#8217;re reading this, and you&#8217;ve reconciled your faith with science in the<br />
same way I did in High School with this ludicrous idea of &#8220;Helping Hand&#8221;<br />
evolution, please stop deluding yourself, your neighbors, your friends, and<br />
most importantly your children.  You may think you&#8217;re helping, but you&#8217;re<br />
not.  The fact is, you&#8217;re lying and deceiving everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2010/03/08/the-unofficial-doctrine-of-helping-hand-evolution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using POE to hook syslog-ng</title>
		<link>http://divisionbyzero.net/blog/2009/07/02/using-poe-to-hook-syslog-ng/</link>
		<comments>http://divisionbyzero.net/blog/2009/07/02/using-poe-to-hook-syslog-ng/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 23:21:13 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl5]]></category>
		<category><![CDATA[poe]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[syslog]]></category>
		<category><![CDATA[syslog-ng]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=121</guid>
		<description><![CDATA[A massively code heavy post on integrating syslog into in house applications using syslog-ng and Perl's amazing POE Event Framework to do really crazy things!]]></description>
			<content:encoded><![CDATA[<p>Being able to do analysis, sorting, or database storage of syslog messages is incredibly useful.  There are tons of solutions on the market to do just that.  If you&#8217;re working on a system developed in house that you&#8217;d like to incorporate syslog messages into, then it may be easier to hook directly into the syslog stream than to introduce another piece of software into the environment which needs to be glued.</p>
<p>Syslog-ng facilitates easy integration with Perl binaries as the Perl program is spawned once during the daemon start up and a handle to that program&#8217;s STDIN is maintained for dispatching of messages.  Using POE, we can turn this into an event driven model, making additional complexity simple.</p>
<p>In this example, we&#8217;ll create a POE Master session that receives all of the syslog-ng input from STDIN.  Using off the shelf components, we&#8217;ll run a TCP Server on port 9514 that will allow clients to connect and subscribe to feeds based on the &#8220;program&#8221; name of the message being dispatched.<br />
<span id="more-121"></span><br />
Anytime I&#8217;m using Regular Expressions over and over, I like to &#8220;precook&#8221; them.  This compiles the regular expression, and lets the engine skip that step each time they&#8217;re used.  Doing so is simply a matter of declaring the regex with the <code>qr//</code> operator:</p>
<pre class="brush: perl;">
my %cooked = (
	program =&gt; qr/\s+\d+:\d+:\d+\s+\S+\s+([^:\s]+)(:|\s)/,
);
</pre>
<h2>Initialization</h2>
<p>Next we&#8217;ll create the administrative session in charge of dispatching the messages to the proper channels:</p>
<pre class="brush: perl;">
# Dispatcher Master Session
POE::Session-&gt;create(
	inline_states =&gt; {
		_start					=&gt; \&amp;dispatcher_start,
		_stop					=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },
		register_client			=&gt; \&amp;register_client,
		subscribe_client		=&gt; \&amp;subscribe_client,
		hangup_client			=&gt; \&amp;hangup_client,

		dispatch_message		=&gt; \&amp;dispatch_message,
	},
);
</pre>
<p>We&#8217;ll define those subroutines shortly, but we need to setup the rest of our sessions.  Next, we&#8217;ll need a TCP Server to handle the client connections, we can get that using <code>POE::Component::Server::TCP</code>:</p>
<pre class="brush: perl;">
# TCP Session Master
POE::Component::Server::TCP-&gt;new(
		Alias		=&gt; 'server',
		Address		=&gt; '127.0.0.1',
		Port		=&gt; 9514,

		ClientConnected		=&gt; \&amp;client_connect,
		ClientInput			=&gt; \&amp;client_input,

		ClientDisconnected	=&gt; \&amp;client_term,
		ClientError			=&gt; \&amp;client_term,

		InlineStates		=&gt; {
			client_print		=&gt; \&amp;client_print,
		},
);
</pre>
<p>The final session will handle the Input on STDIN from syslog-ng:</p>
<pre class="brush: perl;">
# Syslog-ng Stream Master
POE::Session-&gt;create(
		inline_states =&gt; {
			_start		=&gt; \&amp;stream_start,
			_stop		=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },
			stream_line		=&gt; \&amp;stream_line,
		},
);
</pre>
<p>Now we have to define the subroutines that we&#8217;ll be dispatching events to.  The heavy lifting is done by POE, and we&#8217;re left to handle simple things.</p>
<h1>Session Routines: <code>dispatcher</code></h1>
<p>This session is going to managing which clients receive which messages.  The actual input is handled by the <code>stream</code> session, and the sending of the messages to the client by the <code>server</code> session.  As we have a raw <code>POE::Session</code>, our first subroutine <code>dispatcher_start</code> is just going to do some basic preparation:</p>
<pre class="brush: perl;">
sub dispatcher_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'dispatcher' );  # allow named dispatch to this session.

	$heap-&gt;{subscribers} = {};
        $heap-&gt;{clients} = {};

}
</pre>
<p>Next event to be handled is the <i>register_client</i> event which is fired anytime a connection is established to the <code>server</code> session.  All the dispatcher does is register it&#8217;s session_id into an internal heap.  Nothing happens with it, but if we needed to send a message to all clients, we could loop over this hash and broadcast message.</p>
<pre class="brush: perl;">
sub register_client {
    # ARG0 =&gt; TCP Client Session ID
    my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

    $heap-&gt;{clients}{$sid} = 1;
}
</pre>
<p>Clients can subscribe to a program name, which they do by entering &#8220;<code>sub dhcpd, dnsmasq</code>&#8221; into the TCP Server.  It&#8217;s not fancy, but man is it convenient for debugging and development purposes.  The <code>server</code> session determines that the subscription is occurring and passes it&#8217;s argument string to the <code>dispatcher</code> session via the <i>subscribe_client</i> event.  This subroutine is called:</p>
<pre class="brush: perl;">
sub subscribe_client {
    # ARG0 =&gt; SID of Client
    # ARG1 =&gt; Argument String of the subscribe
	my ($kernel,$heap,$sid,$argstr) = @_[KERNEL,HEAP,ARG0,ARG1];

    # Split the input at commas or spaces into words:
	my @progs = map { lc } split /[\s,]+/, $argstr;
    # Add the SID to the list of Subscribed Clients for that program
	foreach my $prog (@progs) {
		$heap-&gt;{subscribers}{$prog}{$sid} = 1;
	}

    # Inform the client they've subscribed via client_print
	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Subscribed to : ' . join(', ', @progs ) );
}
</pre>
<p>If a client disconnects, we remove it from the message dispatching hash:</p>
<pre class="brush: perl;">
sub hangup_client {
    # ARG0 =&gt; SID of Client Disconnecting
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	delete $heap-&gt;{clients}{$sid};

	foreach my $p ( keys %{ $heap-&gt;{subscribers} } ) {
		delete $heap-&gt;{subscribers}{$p}{$sid}
			if exists $heap-&gt;{subscribers}{$p}{$sid};
	}
}
</pre>
<p>Now comes the most important event the dispatcher handles, <i>dispatch_message</i>.  In this event, we have a message from syslog-ng that needs to go to interested parties.  This event determines the &#8220;program&#8221; and it&#8217;s subscribers and sends that message along appropriately:</p>
<pre class="brush: perl; highlight: [14];">
sub dispatch_message {
    # ARG0 =&gt; The raw message from syslog-ng
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

    # Determine the program name
	if( my ($program) = map { lc } ($msg =~ /$cooked{program}/) ) {
		# remove the sub process and PID from the program
		$program =~ s/\(.*//g;
		$program =~ s/\[.*//g;

        # If we have subscribers, send them the message.
		if( exists $heap-&gt;{subscribers}{$program} ) {
			foreach my $sid (keys %{ $heap-&gt;{subscribers}{$program} }) {
				$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
			}
		}
}
</pre>
<p>You'll notice on line 14 above, the <code>post( $sid => client_print => $msg )</code> sends the event to the appropriate client and calls the <i>client_print</i> event on itself.  This is all the dispatcher needs to do.  The rest is handled by other other sessions.</p>
<h1>Session Routines: <code>server</code></h1>
<p>This session accepts new tcp clients and handles writing to the sockets.  We'll take a look at a few subroutines here.  Fist we'll look at the <i>ClientConnect</i> event.</p>
<pre class="brush: perl;">
sub client_connect {
    # SESSION is the client's session object
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];

	my $SID = $ses-&gt;ID;

    # Register the Client with the Dispatcher
	$kernel-&gt;post( 'dispatcher' =&gt; 'register_client' =&gt; $SID );

    # Store the current entry for 'client' in the heap so we can communicate later
	$heap-&gt;{clients}{ $SID } = $heap-&gt;{client};

	# Say hello to the client.
	$heap-&gt;{client}-&gt;put( &quot;Hello Client: $SID&quot; );
}
</pre>
<p>We also need a <i>disconnect</i> event:</p>
<pre class="brush: perl;">
sub client_term {
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];
	my $sid = $ses-&gt;ID;

    # Delete the Client's Dispatch Table
	delete $heap-&gt;{dispatch}{$sid};
    # Tell the dispatcher session we're through
	$kernel-&gt;post( 'dispatcher' =&gt; 'hangup_client' =&gt;  $sid );
}
</pre>
<p>Next we&#8217;ll handle sending message to the client, which is incredibly easy:</p>
<pre class="brush: perl;">
sub client_print {
    # ARG0 =&gt; Message to Send to the Client
	my ($kernel,$heap,$ses,$mesg) = @_[KERNEL,HEAP,SESSION,ARG0];

	$heap-&gt;{clients}{$ses-&gt;ID}-&gt;put($mesg);
}
</pre>
<p>Now we a routine to handle the <i>ClientInput</i> event.  This event will take commands from the clients and do something with them.  We&#8217;ll use an internal dispatch table in the form of a hash to handle translating commands.  This will allow us to expand our API if we need to.</p>
<pre class="brush: perl; highlight: [12,13,14,15,34,36];">
sub client_input {
    # SESSION is the Client Session Object with input
    # ARG0 =&gt; Input waiting from that client
	my ($kernel,$heap,$ses,$msg) = @_[KERNEL,HEAP,SESSION,ARG0];
	my $sid = $ses-&gt;ID;

    # Build a Dispatch Table if one does not exists in the heap for this entry.
	if( !exists $heap-&gt;{dispatch}{$sid} ) {
		$heap-&gt;{dispatch}{$sid} = {

			subscribe		=&gt; {
				re			=&gt; qr/^sub(?:scribe)? (.*)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'subscribe_client' =&gt; $sid, shift );
				},
			},
            # FUTURE API for Clients receiving every message!
			#fullfeed		=&gt; {
			#	re			=&gt; qr/^(fullfeed)/,
			#	callback	=&gt; sub {
			#		$kernel-&gt;post( 'dispatcher' =&gt; 'fullfeed_client' =&gt; $sid );
			#	},
			#},
		};
	}

	#
	# Check for messages:
	my $handled = 0;
    # Get Our Dispatch Table
	my $dispatch = $heap-&gt;{dispatch}{$sid};
    # Look up and take action according to our dispatch table
	foreach my $evt ( keys %{ $dispatch } ) {
		if( my($args) = ($msg =~ /$dispatch-&gt;{$evt}{re}/)) {
			$handled = 1;
			$dispatch-&gt;{$evt}{callback}-&gt;($args);
			last;
		}
	}

    # Inform the client that their command was not understood.
	if( !$handled ) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'UNKNOWN COMMAND, Ignored.' );
	}
}
</pre>
<p>That&#8217;s the most complicated routine in the program, but it does allow us to morph the dispatch tables for individual clients.  Lines 12-15 build a dispatch table entry with the regular expression to match the command, followed by a callback subroutine reference which handles the command.  Lines 34 and 36 are where these rules are applied to the input from the client.</p>
<h1>Session Routines: <code>stream</code></h1>
<p>The last session is very simple.  This session maintains the connection to STDIN from syslog-ng and dispatches those lines as events to the <code>dispatcher</code> session.  There is a startup routine:</p>
<pre class="brush: perl;">
sub stream_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'stream' );

	#
	# Initialize the connection to STDIN as a POE::Wheel
	my $stdin = IO::Handle-&gt;new_from_fd( \*STDIN, 'r' );
	my $stderr = IO::Handle-&gt;new_from_fd( \*STDERR, 'w' );

	$heap-&gt;{stream} = POE::Wheel::ReadWrite-&gt;new(
		InputHandle		=&gt; $stdin,
		OutputHandle	=&gt; $stderr,
		InputEvent		=&gt; 'stream_line',
	);
}
</pre>
<p>And the <i>stream_line</i> event which sends the incoming syslog messages to the <code>dispatcher</code> session for processing:</p>
<pre class="brush: perl;">
#--------------------------------------------------------------------------#
sub stream_line {
    # ARG0 =&gt; Line from STDIN, New line delimited.
	my ($kernel,$msg) = @_[KERNEL,ARG0];

	return unless length $msg;

	$kernel-&gt;post( 'dispatcher' =&gt; 'dispatch_message' =&gt; $msg );

}
</pre>
<h1>Setting it up with syslog-ng</h1>
<p>If we store our POE program in <code>/usr/local/bin/poe-syslog-ng.pl</code>, in the syslog-ng.conf we need to specify it as a program:</p>
<pre class="brush: plain;">
#
# Subscriber Feeds
destination d_subscribers {
	program(&quot;/usr/local/bin/poe-syslog-ng.pl&quot;);
};
</pre>
<p>Then you can feed it based on filters, just like the rest of the <code>destination</code> macros in syslog-ng:</p>
<pre class="brush: plain;">
#
# SUBSCRIPTION SERVICE:
log { source(s_ext); source(s_udp); filter(f_database); destination(d_subscribers); };
</pre>
<h1>The whole #! </h1>
<p>For those interested, I&#8217;ve written a program that expands this example with enhanced functionality.  The full source is available here:</p>
<pre class="brush: perl; collapse: true; light: false; toolbar: true;">
#!/usr/bin/perl
#
# This is the POE Master Server.
#  1) Take all the syslog input
#  2) Listen for parsers
#  3) Filter streams to parsers
#  TODO: 4) Maintain Parser State, restarting on crash

use strict;
use warnings;

use Socket;
use Regexp::Common qw(net);

sub POE::Kernel::ASSERT_DEFAULT (){ 1 }
#sub POE::Kernel::TRACE_DEFAULT (){ 1 }
use POE qw(
	Wheel::ReadWrite
	Component::Server::TCP
);

my %cooked = (
	program =&gt; qr/\s+\d+:\d+:\d+\s+\S+\s+([^:\s]+)(:|\s)/,
);

#--------------------------------------------------------------------------#
# POE Session Initialization

# Dispatcher Master Session
POE::Session-&gt;create(
	inline_states =&gt; {
		_start					=&gt; \&amp;dispatcher_start,
		_stop					=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },
		register_client			=&gt; \&amp;register_client,
		subscribe_client		=&gt; \&amp;subscribe_client,
		unsubscribe_client		=&gt; \&amp;unsubscribe_client,
		fullfeed_client			=&gt; \&amp;fullfeed_client,
		dispatch_message		=&gt; \&amp;dispatch_message,
		broadcast				=&gt; \&amp;broadcast,
		hangup_client			=&gt; \&amp;hangup_client,
		server_shutdown			=&gt; \&amp;server_shutdown,
		debug_client			=&gt; \&amp;debug_client,
		nobug_client			=&gt; \&amp;nobug_client,
		debug_message			=&gt; \&amp;debug_message,
	},
);

# TCP Session Master
POE::Component::Server::TCP-&gt;new(
		Alias		=&gt; 'server',
		Address		=&gt; '127.0.0.1',
		Port		=&gt; 9514,

		ClientConnected		=&gt; \&amp;client_connect,
		ClientInput			=&gt; \&amp;client_input,

		ClientDisconnected	=&gt; \&amp;client_term,
		ClientError			=&gt; \&amp;client_term,

		InlineStates		=&gt; {
			client_print		=&gt; \&amp;client_print,
		},
);

# Syslog-ng Stream Master
POE::Session-&gt;create(
		inline_states =&gt; {
			_start		=&gt; \&amp;stream_start,
			_stop		=&gt; sub { print &quot;SESSION &quot;, $_[SESSION]-&gt;ID, &quot; stopped.\n&quot;; },

			stream_line		=&gt; \&amp;stream_line,
			stream_error	=&gt; \&amp;stream_error,
		},
);

#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
# POE Main Loop
POE::Kernel-&gt;run();
exit 0;
#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
# POE Event Functions
#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
sub debug {
	my $msg = shift;
	chomp($msg);
	$poe_kernel-&gt;post( 'dispatcher' =&gt; 'debug_message' =&gt; $msg );
	print &quot;[debug] $msg\n&quot;;
}
#--------------------------------------------------------------------------#
sub dispatcher_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'dispatcher' );

	$heap-&gt;{subscribers} = { };
	$heap-&gt;{full} = { };
	$heap-&gt;{debug} = { };
}

#--------------------------------------------------------------------------#
sub register_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	$heap-&gt;{clients}{$sid} = 1;
}

#--------------------------------------------------------------------------#
sub debug_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	if( exists $heap-&gt;{full}{$sid} ) {  return;  }

	$heap-&gt;{debug}{$sid} = 1;
	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Debugging enabled.' );
}

#--------------------------------------------------------------------------#
sub nobug_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	delete $heap-&gt;{debug}{$sid}
		if exists $heap-&gt;{debug}{$sid};
	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Debugging disabled.' );
}

#--------------------------------------------------------------------------#
sub fullfeed_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	#
	# Remove from normal subscribers.
	foreach my $prog (keys %{ $heap-&gt;{subscribers} }) {
		delete $heap-&gt;{subscribers}{$prog}{$sid}
			if exists $heap-&gt;{subscribers}{$prog}{$sid};
	}

	#
	# Turn off DEBUG
	if( exists $heap-&gt;{debug}{$sid} ) {
		delete $heap-&gt;{debug}{$sid};
	}

	#
	# Add to fullfeed:
	$heap-&gt;{full}{$sid} = 1;

	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Full feed enabled, all other functions disabled.');
}

#--------------------------------------------------------------------------#
sub subscribe_client {
	my ($kernel,$heap,$sid,$argstr) = @_[KERNEL,HEAP,ARG0,ARG1];

	if( exists $heap-&gt;{full}{$sid} ) {  return;  }

	my @progs = map { lc } split /[\s,]+/, $argstr;
	foreach my $prog (@progs) {
		$heap-&gt;{subscribers}{$prog}{$sid} = 1;
	}

	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Subscribed to : ' . join(', ', @progs ) );
}
#--------------------------------------------------------------------------#
sub unsubscribe_client {
	my ($kernel,$heap,$sid,$argstr) = @_[KERNEL,HEAP,ARG0,ARG1];

	my @progs = map { lc } split /[\s,]+/, $argstr;
	foreach my $prog (@progs) {
		delete $heap-&gt;{subscribers}{$prog}{$sid};
	}

	$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Subscription removed for : ' . join(', ', @progs ) );
}

#--------------------------------------------------------------------------#
sub hangup_client {
	my ($kernel,$heap,$sid) = @_[KERNEL,HEAP,ARG0];

	delete $heap-&gt;{clients}{$sid};

	foreach my $p ( keys %{ $heap-&gt;{subscribers} } ) {
		delete $heap-&gt;{subscribers}{$p}{$sid}
			if exists $heap-&gt;{subscribers}{$p}{$sid};
	}

	if( exists $heap-&gt;{debug}{$sid} ) {
		delete $heap-&gt;{debug}{$sid};
	}

	if( exists $heap-&gt;{full}{$sid} ) {
		delete $heap-&gt;{full}{$sid};
	}

	debug(&quot;Client Termination Posted: $sid\n&quot;);

}

#--------------------------------------------------------------------------#
sub stream_start {
	my ($kernel, $heap) = @_[KERNEL, HEAP];

	$kernel-&gt;alias_set( 'stream' );

	#
	# Initialize the connection to STDIN as a POE::Wheel
	my $stdin = IO::Handle-&gt;new_from_fd( \*STDIN, 'r' );
	my $stderr = IO::Handle-&gt;new_from_fd( \*STDERR, 'w' );

	$heap-&gt;{stream} = POE::Wheel::ReadWrite-&gt;new(
		InputHandle		=&gt; $stdin,
		OutputHandle	=&gt; $stderr,
		InputEvent		=&gt; 'stream_line',
		ErrorEvent		=&gt; 'stream_error',
	);
}

#--------------------------------------------------------------------------#
sub stream_line {
	my ($kernel,$msg) = @_[KERNEL,ARG0];

	return unless length $msg;

	$kernel-&gt;post( 'dispatcher' =&gt; 'dispatch_message' =&gt; $msg );

}

#--------------------------------------------------------------------------#
sub stream_error {
	my ($kernel) = $_[KERNEL];

	debug(&quot;STREAM ERROR!!!!!!!!!!\n&quot;);
	$kernel-&gt;call( 'dispatcher' =&gt; 'server_shutdown' =&gt; 'Stream lost' );
}

#--------------------------------------------------------------------------#
sub server_shutdown {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	$kernel-&gt;call( dispatcher =&gt; 'broadcast' =&gt; 'SERVER DISCONNECTING: ' . $msg );
	$kernel-&gt;call( 'server' =&gt; 'shutdown' );
	exit;
}

#--------------------------------------------------------------------------#
sub client_connect {
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];

	my $KID = $kernel-&gt;ID();
	my $CID = $heap-&gt;{client}-&gt;ID;
	my $SID = $ses-&gt;ID;

	$kernel-&gt;post( 'dispatcher' =&gt; 'register_client' =&gt; $SID );

	$heap-&gt;{clients}{ $SID } = $heap-&gt;{client};
	#
	# Say hello to the client.
	$heap-&gt;{client}-&gt;put( &quot;EHLO Streamer (KERNEL: $KID:$SID)&quot; );
}

#--------------------------------------------------------------------------#
sub client_print {
	my ($kernel,$heap,$ses,$mesg) = @_[KERNEL,HEAP,SESSION,ARG0];

	$heap-&gt;{clients}{$ses-&gt;ID}-&gt;put($mesg);
}

#--------------------------------------------------------------------------#
sub broadcast {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	foreach my $sid (keys %{ $heap-&gt;{clients} }) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
	}
}
#--------------------------------------------------------------------------#
sub dispatch_message {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	foreach my $sid ( keys %{ $heap-&gt;{full} } ) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
	}

	if( my ($program) = map { lc } ($msg =~ /$cooked{program}/) ) {
		# remove the sub process and PID from the program
		$program =~ s/\(.*//g;
		$program =~ s/\[.*//g;

		debug(&quot;DISPATCHING MESSAGE [$program]&quot;);

		if( exists $heap-&gt;{subscribers}{$program} ) {
			foreach my $sid (keys %{ $heap-&gt;{subscribers}{$program} }) {
				$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; $msg );
			}
		}
		else {
			debug(&quot;Message discarded, no listeners.&quot;);
		}
	}
	else {
			debug(&quot;Message discarded, format not understood.&quot;);
	}
}

#--------------------------------------------------------------------------#
sub debug_message {
	my ($kernel,$heap,$msg) = @_[KERNEL,HEAP,ARG0];

	foreach my $sid (keys %{ $heap-&gt;{debug} }) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; '[debug] ' . $msg );
	}
}

#--------------------------------------------------------------------------#
sub client_input {
	my ($kernel,$heap,$ses,$msg) = @_[KERNEL,HEAP,SESSION,ARG0];
	my $sid = $ses-&gt;ID;

	if( !exists $heap-&gt;{dispatch}{$sid} ) {
		$heap-&gt;{dispatch}{$sid} = {
			fullfeed		=&gt; {
				re			=&gt; qr/^(fullfeed)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'fullfeed_client' =&gt; $sid );
				},
			},
			subscribe		=&gt; {
				re			=&gt; qr/^sub(?:scribe)? (.*)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'subscribe_client' =&gt; $sid, shift );
				},
			},
			unsubscribe 	=&gt; {
				re			=&gt; qr/^unsub(?:scribe)? (.*)/,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'unsubscribe_client' =&gt; $sid, shift );
				},
			},
			debug 	=&gt; {
				re			=&gt; qr/^(debug)/i,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'debug_client' =&gt; $sid, shift );
				},
			},
			nobug 	=&gt; {
				re			=&gt; qr/^(no(de)?bug)/i,
				callback	=&gt; sub {
					$kernel-&gt;post( 'dispatcher' =&gt; 'nobug_client' =&gt; $sid, shift );
				},
			},
			#quit			=&gt; {
			#	re			=&gt; qr/(exit)|q(uit)?/,
			#	callback	=&gt; sub {
			#			$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'Terminating connection on your request.');
			#			$kernel-&gt;post( $sid =&gt; 'shutdown' );
			#	},
			#},
			#status			=&gt; {
			#	re			=&gt; qr/^status/,
			#	callback	=&gt; sub {
			#		my $cnt = scalar( keys %{ $heap-&gt;{clients} } );
			#		my $subcnt = scalar( keys %{ $heap-&gt;{subscribers} });
			#		my $msg = &quot;Currently $cnt connections, $subcnt subscribed.&quot;;
			#		$kernel-&gt;post( $sid, 'client_print', $msg );
			#	},
			#},
		};
	}

	#
	# Check for messages:
	my $handled = 0;
	my $dispatch = $heap-&gt;{dispatch}{$sid};
	foreach my $evt ( keys %{ $dispatch } ) {
		if( my($args) = ($msg =~ /$dispatch-&gt;{$evt}{re}/)) {
			$handled = 1;
			$dispatch-&gt;{$evt}{callback}-&gt;($args);
			last;
		}
	}

	if( !$handled ) {
		$kernel-&gt;post( $sid =&gt; 'client_print' =&gt; 'UNKNOWN COMMAND, Ignored.' );
	}
}

#--------------------------------------------------------------------------#
sub client_term {
	my ($kernel,$heap,$ses) = @_[KERNEL,HEAP,SESSION];
	my $sid = $ses-&gt;ID;

	delete $heap-&gt;{dispatch}{$sid};
	$kernel-&gt;post( 'dispatcher' =&gt; 'hangup_client' =&gt;  $sid );

	debug(&quot;SERVER, client $sid disconnected.\n&quot;);
}

#--------------------------------------------------------------------------#
</pre>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/07/02/using-poe-to-hook-syslog-ng/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>YAPC::NA 10th Anniversary Wrap Up Post</title>
		<link>http://divisionbyzero.net/blog/2009/06/26/yapcna-10th-anniversary-wrap-up-post/</link>
		<comments>http://divisionbyzero.net/blog/2009/06/26/yapcna-10th-anniversary-wrap-up-post/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 18:11:38 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[yapc]]></category>
		<category><![CDATA[yapc10]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=117</guid>
		<description><![CDATA[I got back from YAPC::NA #10 yesterday. There was a lot of sleeping required to recover from a tech conference with 8 am talks! A Twitter Search for &#8220;yapc&#8221; indicates I&#8217;m not the only one slow to recover those missing hours of sleep. Overall the conference was a fantastic success. There were highs and lows, [...]]]></description>
			<content:encoded><![CDATA[<p>I got back from <a href="http://yapc10.org/" alt="YAPC::NA 10">YAPC::NA #10</a> yesterday.  There was a lot of sleeping required to recover from a tech conference with 8 am talks!  A <a href="http://twitter.com/#search?q=yapc" alt="twitter search yapc">Twitter Search for &#8220;yapc&#8221;</a> indicates I&#8217;m not the only one slow to recover those missing hours of sleep.</p>
<p>Overall the conference was a fantastic success.  There were highs and lows, and I just wanted to take an opportunity to thank the conference organizers!! They did a wonderful job putting together another spectacular conference.</p>
<p>Also wanted to thank all the speakers as I know firsthand how much work goes into presenting at a conference like YAPC.  All the talks I attended were great, however several stood out as exceptional:</p>
<ul>
<li><a href="http://yapc10.org/yn2009/talk/1960" alt="Trapped in a Room with Schwern">Trapped in a Room with Schwern</a> &#8211; Michael Schwern is an excellent speaker, and this free room talk with back and forth between him and members of the community at all levels of mastery provided insight into projects I was unaware of, as well as some relief that most of my concerns about Perl 5 were being discussed by people far smarter than myself.</li>
<li><a href="http://yapc10.org/yn2009/talk/1975" alt="The Future of DBIx::Class">The Future of DBIx::Class</a> &#8211; Matt S Trout (MST) is a speaker for the real programmers.  His volume, accent, and excessive use of profanity actually keep people listening.  Getting yelled at by Matt Trout was the highlight of this conference for me.  He has good ideas and opinions and he&#8217;s not afraid to beat them into your head.  Kid gloving is great for Managers, but his presentation style and content really clicks with the people who don&#8217;t have their heads so far up their own asses to understand things need to change.  Excellent talk about the past, present, and future of DBIx::Class which is the most significant ORM in the Perl Community currently.</li>
<li><a href="http://yapc10.org/yn2009/talk/1983" alt="Take Advantage of Modern Perl">Take Advantage of Modern Perl</a> &#8211; chromatic&#8217;s speaking style is the complete opposite of MST&#8217;s, but his message synced with Schwern, MST, and the <a href="http://enlightenedperl.org" alt="The Enlightened Perl Organisation">The Enlightened Perl Organisation</a>: Encourage people to write better Perl.  Write Better Perl.  Teach others how to write better Perl.  Embrace the language where it is now, and transition away from the bad things in the past.  Fantastic Talk.</li>
<li><a href="http://yapc10.org/yn2009/talk/2155" alt="perl5i: Perl 5 Imporved">perl5i: Perl 5 Improved</a> &#8211; Michael Schwern echoing chromatic&#8217;s plea for leveraging the best of what Perl 5 offers today.  He&#8217;s got a module on cpan, <a href="http://github.com/schwern/perl5i/tree/master" alt="perl5i @ github">perl5i</a>, which implements the best of Perl 5 Tribal Knowledge.</li>
<li><a href="http://yapc10.org/yn2009/talk/1978" alt="Catching an ::Std">Catching an ::Std</a> &#8211; MST again.  He very honestly covered the trials, tribulations, and evolution of &#8220;Best Practices&#8221; in the Perl community.</li>
<li><a href="http://yapc10.org/yn2009/talk/2012" alt="CGI::Inspect">Drop in REPL for CGI Applications</a> &#8211; Brock Wilcox floored everyone demonstrating his ridiculously cool module <a href="http://search.cpan.org/~awwaiid/CGI-Inspect-0.4/">CGI::Inspect</a>.  I went in expecting &#8220;neat&#8221; and found &#8220;amazing.&#8221;  We&#8217;ll be abusing this in development very soon.</li>
</ul>
<p>These were my favorite talks, but like I said, every talk I went to was fantastic.  I did miss a few talks I wanted to see due to schedule conflicts, but I&#8217;ll be checking the YAPC website for slides and video/audio.  The conference organizers were not able to record anything, but a few attendees brought recording equipment with them.  If nothing else, I&#8217;ll hopefully see those missed talks next year or at the <a href="http://pghpw.org/">Pittsburgh Perl Workshop</a> in 2010!</p>
<p>I&#8217;m recommitting to the Perl Iron Man.  I was an idiot and jackass for bailing after 1 post! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/06/26/yapcna-10th-anniversary-wrap-up-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl is Dead</title>
		<link>http://divisionbyzero.net/blog/2009/04/05/perl-is-dead/</link>
		<comments>http://divisionbyzero.net/blog/2009/04/05/perl-is-dead/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 00:49:47 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[catalyst]]></category>
		<category><![CDATA[dbix::class]]></category>
		<category><![CDATA[mason]]></category>
		<category><![CDATA[moose]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl::critic]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=94</guid>
		<description><![CDATA[I&#8217;ve been doing web application development for years in several languages. I&#8217;ve spent time with PHP, Java, but primarily Perl. I consider myself a &#8220;Perl Programmer&#8221; first, everything else second. Until recently, most people would equate that to &#8220;Dinosaur.&#8221; However, there&#8217;s been a revival of Perl these days! There are a number of reasons for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing web application development for years in several languages.  I&#8217;ve spent time with PHP, Java, but primarily Perl.  I consider myself a &#8220;Perl Programmer&#8221; first, everything else second.  Until recently, most people would equate that to &#8220;Dinosaur.&#8221;  However, there&#8217;s been a revival of Perl these days!  There are <a title="Movable Type, Open Source" href="http://www.movabletype.org/" target="_blank">a</a> <a title="Enlightened Perl Org" href="http://www.enlightenedperl.org/">number</a> <a title="The Perl Foundation" href="http://www.perlfoundation.org/">of</a> <a title="Perl Sphere" href="http://perlsphere.net/" target="_blank">reasons</a> <a title="Perl Buzz" href="http://perlbuzz.com/" target="_blank">for</a> <a title="Modern Perl" href="http://www.modernperlbooks.com/mt/index.html" target="_blank">this</a>.</p>
<p><span id="more-94"></span></p>
<p>It all started with the concept of &#8220;Inside Out Objects&#8221; as a safe, functional object development methodology.  From there a number of modules sprouted attempting to do Inside-Out better.   Around this time, the Perl 6 <a title="Perl 6 Apocalypses" href="http://dev.perl.org/perl6/doc/apocalypse.html" target="_blank">Apocalypses</a> were being published and translated in Conway&#8217;s <a title="Perl 6 Exegeses" href="http://dev.perl.org/perl6/doc/exegesis.html" target="_blank">Exegeses</a>.  Conway  published &#8220;<a title="Perl Best Practices" href="http://oreilly.com/catalog/9780596001735/" target="_blank">Perl Best Practices</a>&#8221; and very soon after, <a title="Perl::Critic @ The CPAN" href="http://search.cpan.org/~elliotjs/Perl-Critic-1.096/" target="_blank">Perl::Critic</a> showed up on the <a title="The CPAN" href="http://www.cpan.org" target="_blank">CPAN</a> to enforce the rules laid out in the book.  Perl::Critic became a critical authority on the most maintainable way to write Perl code.  TIMTOWTDI will never die, but clean, maintainable code does outweigh some stranger interpreter abuses.</p>
<p>The modern looking object system for Perl 6 made it debut, and instantly the Army of CPAN began figuring out clever ways to implement fancy object notation in Perl 5.  his eventually led to the development of Class::MOP, from which the &#8220;post Modern Object System for Perl 5,&#8221; Moose, blossomed.</p>
<p>Concurrently, Ruby on Rails had layed waste to the entire scope of PHP Scaffolding systems in existence, building off the Model-View-Controller (MVC) Ideology implemented earlier in Perl 5 through Maypole.  As RoR gained traction, Python&#8217;s Django framework, through it&#8217;s association with the MVC philosophy, began to see serious deployment.  This made sense as a lot of large Open Source and Commercial companies were using Python for much of their behind the scenes development.  The result left PHP staggering and dizzy in the corner.</p>
<p>Unfortunately, there was a horrible association of PHP to Perl in most people&#8217;s heads, which sounded the Death Knell for Perl as well.  This wasn&#8217;t the case, as Perl, inside it&#8217;s mostly impenetrable Echo Chamber had not stagnated at all.  Perl 5.8.x was a huge performance and syntactical modernization of Perl 5.  This improvement was eclipsed with the release of 5.10, drawing from the Perl 6 Design Documents, and the push of the Echo Chamber for a more Modern Language.</p>
<p>The Army of CPAN was still hard at work in the background throughout all of this.  ORM&#8217;s drawing on the Success of the MVC philosophy took shape and evolved.  Rose::DB, Class::DBI, and the current forerunner DBIx::Class simplified database development through the use of abstraction through modules like SQL::Abstract.  Maypole, an simplified, earlier implementation of MVC sparked other MVC efforts in Perl 5, the most popular of which are Catalyst, Jifty, and CGI::Application.  Each have their strengths and weaknesses.</p>
<p>All of these modules are beginning to converge to create a beautiful, post modern web application development platform in pure Perl.  Additionally, projects like Strawberry Perl, and Padre are aiming to expand Perl&#8217;s reach into realms it&#8217;s shied away from: Windows &amp; IDEs.  The future is bright for Perl thanks to efforts of countless volunteers and programmers.</p>
<p>Perl is dead.  Long live Perl.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/04/05/perl-is-dead/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>From cfEngine to Puppet:  A retrospective</title>
		<link>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/</link>
		<comments>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 02:06:57 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[cfengine]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=74</guid>
		<description><![CDATA[For several years I&#8217;ve managed to bend cfEngine 2.0&#8242;s architecture to my will.  Being an experienced Perl programmer, I was able to abuse the configuration language snytax in order to accomplish a number of strange things including Copy Back and automated management of OSSEC-HIDS.  However, there comes a point when the managing the cfengine configs [...]]]></description>
			<content:encoded><![CDATA[<p>For several years I&#8217;ve managed to bend <a href="http://www.cfengine.org/" target="_blank">cfEngine</a> 2.0&#8242;s architecture to my will.  Being an experienced Perl programmer, I was able to abuse the configuration language snytax in order to accomplish a number of strange things including <a href="http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/" target="_blank">Copy Back</a> and <a href="http://www.ossec.net/wiki/index.php/Integration_%26_Deployment_with_cfengine">automated management of</a><a href="http://www.ossec.net/" target="_blank"> OSSEC-HIDS</a>.  However, there comes a point when the managing the cfengine configs becomes a burdensome and incredibly unmanageable.   I mean, sure, I know what they do.  How will any of my co-workers understand them?</p>
<p>After several colleagues recommending <a href="http://puppet.reductivelabs.com">Puppet</a>, I hesitantly began the slow, brain fscking process of:</p>
<ol>
<li>Understanding exactly what I had accomplished with cfEngine.</li>
<li>Understanding Ruby (ugh, I&#8217;m so thankful for Perl)</li>
<li>Understanding how to express my cfengine feelings in a way Puppet will understand without hurting it&#8217;s feelings</li>
<li>&#8230;</li>
<li>Profit.</li>
</ol>
<p><span id="more-74"></span>cfEngine makes some things incredibly easy to manage.  Nearly every command allows you to &#8220;define&#8221; new classes based on various conditions.  This allows to modify a configuration file, and then tell the daemon associated with that config file to restart.  However, when I needed to do something highly specialized, I had to create a shell script, copy the shell script to the server and then run the shell script.  Passing data back to do something was possible, though it seemed a bit hacky.  It separated the customized actions being performed from the dependent actions in the cfEngine configs.  If I had to go back later and make changes, I had to look at both the .cf file and the custom shell script in a completely different directory.</p>
<p>With Puppet, these things can be done relatively simply inside the same class file.  Also, Puppet can be extended simply through the use of defines (think macros) or complexly through the use of modules.  Additionally, Puppet supports templating, classes, inheritance, and explicit order.  Where with cfengine I&#8217;d have to do something like this:</p>
<pre style="padding-left: 30px; ">copy:
  s_snmpd.dc_has_snmp::
     $(distribute)/snmpd.conf	dest=/etc/snmp/snmpd.conf mode=644</pre>
<pre style="padding-left: 30px; ">				server=$(policyhost)
				type=sum
				define=dc_restart_snmpd</pre>
<pre style="padding-left: 30px; ">shellcommands:
   s_snmpd.dc_restart_snmpd::
	"/sbin/service snmpd restart"</pre>
<div>Utilizing the intermediary &#8220;dc_restart_snmpd&#8221; class.   With Puppet I can explicitly define the relationship with the config file and service:</div>
<pre>
<div style="padding-left: 30px; ">class ssh {</div>
<div style="padding-left: 30px; ">    package {</div>
<div style="padding-left: 30px; ">        [ "openssh-clients", "openssh-server" ]:</div>
<div style="padding-left: 30px; ">        ensure =&gt; latest</div>
<div style="padding-left: 30px; ">    }</div>
<div style="padding-left: 30px; ">    file { "/etc/ssh/sshd_config":
        mode  =&gt; 0600,
        owner =&gt; root,
        group =&gt; root,
        mode =&gt; 644,
        require =&gt; Package["openssh-server"],
        content =&gt; template("sshd_config.erb")
    }</div>
<div style="padding-left: 30px; ">    service { sshd:
        subscribe =&gt; File["/etc/ssh/sshd_config"],
        ensure    =&gt; running,
        enable    =&gt; true
    }
}</div>

 </pre>
<p>With this syntax it&#8217;s easy to read that the file /etc/ssh/sshd_config is dependent on the openssh-server package and that the sshd service is dependent on that file.  Puppet also feels more &#8220;cross-platform&#8221; as the &#8220;service&#8221; directive allows me to abstractly describe the service without having to hard code a call to /sbin/service.</p>
<p>Puppet is not without it&#8217;s drawbacks.  The first of which is that it is Ruby.  If you&#8217;re not using Ruby on your systems, this means more package installations on those servers.  If you&#8217;ve been programming in another language, like Perl or Python, it&#8217;s another language you have to fight with.  The memory usage is much higher than I expected.  On some virtual servers, this may be a huge drawback. Consider:</p>
<div id="attachment_85" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-85 " title="puppetmasterd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/puppetmasterd.png" alt="puppetmasterd" width="302" height="209" /><p class="wp-caption-text">Memory usage for puppetmasterd</p></div>
<p>Not too bad, but this is shocking:</p>
<div id="attachment_84" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-84 " title="puppetd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/puppetd.png" alt="Memory Usage at 300 MB prior to restart" width="302" height="209" /><p class="wp-caption-text">Memory Usage at ~250 MB prior to restart</p></div>
<p>Compare this to cfegine:</p>
<p> </p>
<div id="attachment_82" class="wp-caption alignnone" style="width: 311px"><img class="size-full wp-image-82 " title="cfservd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/cfservd.png" alt="Memory Usage for cfservd, Yes, Memory Leak." width="301" height="208" /><p class="wp-caption-text">Memory Usage for cfservd, Yes, Memory Leak.</p></div>
<p>and:</p>
<div id="attachment_81" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-81 " title="cfexed" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/cfexed.png" alt="Memory Usage for cfexecd" width="302" height="210" /><p class="wp-caption-text">Memory Usage for cfexecd</p></div>
<p>Hell, even a long running Perl program using POE and Net::Pcap to decode all packets on our uplink at work (which bursts to ~75mb/sec) isn&#8217;t using that much memory:</p>
<div id="attachment_83" class="wp-caption alignnone" style="width: 313px"><img class="size-full wp-image-83 " title="perl-poe" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/perl-poe.png" alt="Memory Usage for PoCo::Pcap based Traffic Inspector" width="303" height="208" /><p class="wp-caption-text">Memory Usage for PoCo::Pcap based Traffic Inspector</p></div>
<p>Ultimately, RAM is cheap and my time is expensive.  After kludging together configuration management in cfengine for the past three years, I&#8217;ve decided to ditch it in favor of a more sane and extensible configuration with Puppet.  I&#8217;ve got a lot to learn about Puppet still, so as I learn new and more exciting things and Puppet grows, I&#8217;ll be sure to share how it&#8217;s helping.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Proxy Evasion with SSH</title>
		<link>http://divisionbyzero.net/blog/2007/10/04/proxy-evasion-with-ssh/</link>
		<comments>http://divisionbyzero.net/blog/2007/10/04/proxy-evasion-with-ssh/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 21:41:42 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[evasion]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2007/10/04/proxy-evasion-with-ssh/</guid>
		<description><![CDATA[In our first installment, we looked at some solutions to provide a hospitable environment for proxy evasion. Today, we&#8217;ll dig deep into how to do this with my favorite protocol of all time, SSH. OpenSSH is a glorious implementation of a critical network protocol. Most networks have disabled and banned the use of telnet, rsh, [...]]]></description>
			<content:encoded><![CDATA[<p>In our <a href="http://divisionbyzero.net/blog/2006/12/09/proxy-evasion-the-environment/">first installment</a>,  we looked at some solutions to provide a hospitable environment for proxy evasion.  Today, we&#8217;ll dig deep into how to do this with my favorite protocol of all time, <a href="http://en.wikipedia.org/wiki/SSH">SSH</a>.</p>
<p><a href="http://openssh.org/">OpenSSH</a> is a glorious implementation of a critical network protocol.  Most networks have disabled and banned the use of telnet, rsh, and ftp in favor of the more &#8220;secure&#8221; SSH protocol.  OpenSSH runs on every platform I&#8217;ve encountered (using CygWin on Windows).  SSH provides an encrypted channel for data transfer.  Usually that&#8217;s Keyboard Interactive Sessions or Files (using SCP), however SSH is capable of setting up multiple channels and acting as a SOCKS4 or SOCKS5 Proxy.</p>
<p><span id="more-28"></span></p>
<p>From the manual:</p>
<blockquote>
<pre>
-D [bind_address:]port

Specifies a local ``dynamic'' application-level port forwarding.
This works by allocating a socket to listen to port on the local
side, optionally bound to the specified bind_address.  Whenever a
connection is made to this port, the connection is forwarded over
the secure channel, and the application protocol is then used to
determine where to connect to from the remote machine.  Currently
the SOCKS4 and SOCKS5 protocols are supported, and ssh will act
as a SOCKS server.  Only root can forward privileged ports.  Dy-
namic port forwardings can also be specified in the configuration
file.</pre>
</blockquote>
<p>That&#8217;s a lot of technical mumbo jumbo, so what does it mean?!  Well it means that if you have ssh and an ssh server outside of your work network that you can connect to, you can SOCKS5 Proxy all your Interesting Traffic elsewhere by issuing this command:</p>
<pre>ssh -D3128 server</pre>
<p>Then pointing your applications to SOCKS5 Proxy localhost port 3128 will encrypt all the traffic between you and the server that you&#8217;re connecting to.  <strong>This only provides privacy from the LOCAL or CORPORATE network, and does not encrypt your traffic on it&#8217;s way to it&#8217;s external destinations!!!!</strong></p>
<p>In the next installment, we&#8217;ll cover PuTTY.exe and how to evade proxies on Windows platforms.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2007/10/04/proxy-evasion-with-ssh/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Copy Back with cfengine</title>
		<link>http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/</link>
		<comments>http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/#comments</comments>
		<pubDate>Thu, 03 May 2007 22:01:02 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[cfengine]]></category>
		<category><![CDATA[management]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/</guid>
		<description><![CDATA[I love cfengine. There are tons of resources out there for managing all kinds of common and uncommon system administration tasks. Rather than regurgitate all that information I wanted to share how I worked around what has been noted as a short coming of cfengine, clients copying information back to the master server. Configuring the [...]]]></description>
			<content:encoded><![CDATA[<p>I love <a href="http://www.cfengine.org/">cfengine</a>.  There are tons of resources out there for managing all kinds of common and uncommon system administration tasks.  Rather than regurgitate all that information I wanted to share how I worked around what has been noted as a short coming of cfengine, clients copying information back to the master server.</p>
<p><span id="more-32"></span></p>
<h3>Configuring the cfengine master server, with cfegine!</h3>
<p>The easiest way to do secure file transfer without passwords would be ssh + public key authentication.  This will grant us a reasonable level of security, which we can fine tune with products like <a href="http://sublimation.org/scponly/wiki/index.php/Main_Page">scponly</a>.  For now, we&#8217;ll just play around with basics.</p>
<p>The first thing to do is to setup a user on your cfengine server to accept the file transfers.  Make this user unprivileged and make sure they are allowed to login with ssh.  I restrict ssh connectivity using groups.  I have a special group for utility accounts on my servers called &#8216;localssh&#8217;.  I&#8217;m going to create a user named &#8216;util&#8217; to handle this setup.</p>
<p><code>cfmaster# adduser -n -g localssh -h /home/util util</code></p>
<p>We need passwordless authentication, so we&#8217;re using ssh-keys.  However, we don&#8217;t want to generate those keys as they will be too much work.  We also want to make sure we keep that key under lock and barrel to ensure it&#8217;s safety.  I&#8217;ll use cfengine to configure the master server, and regenerate a utility key everyday.  This will ensure limited exposure of the key on the network.</p>
<p>Here&#8217;s the master section of our cfengine copyback.cf:</p>
<pre>
groups:
  hg_cfmaster     = ( cfmaster.domain.com )

control:
  any::
    util_keydir     = ( /usr/local/cfkeys )
    util_privkey   = ( /usr/local/cfkeys/util.dsa )
    util_pubkey   = ( /usr/local/cfkeys/util.dsa.pub )
    util_updir       = ( /home/util/cfin )
    actionsequence = ( directories tidy shellcommands )

directories:
  any::
    $(util_keydir)        mode=700 owner=root group=root fix=all

  hg_cfmaster::
    /home/util              mode=700 owner=util group=localssh fix=all
    $(util_updir)           mode=700 owner=util group=localssh fix=all

tidy:
  hg_cfmaster::
     $(util_keydir)   pattern=util.dsa age=1 r=0 define=dc_util_genkey

shellcommands:
  dc_util_genkey::
     "/usr/bin/ssh-keygen -t dsa -b 1024 -N '' -C 'util@domain.com' -f $(util_privkey)"

copy:
  hg_cfmaster::
    $(util_pubkey)      dest=/home/util/.ssh/authorized_keys mode=600 owner=util group=localssh type=sum</pre>
<p>What have we done!?@?!@?</p>
<p>Well, the control and groups sections setup our variables.  The &#8216;directories&#8217; section creates the directories and makes sure the permissions are nice and tight.  This ensures that cfengine keeps it that way.</p>
<p>The neat trick is my use of &#8220;dynamic classes&#8221; to take care of key regeneration.  The tidy section looks in the $(util_keydir) for anything matching &#8220;util.dsa&#8221; and removes it if it&#8217;s older than 1 day old.  The &#8220;define&#8221; section defines a dynamic class for the tidy statement if and only if files were deleted.</p>
<p>Then in shellcommands, if our dynamic class &#8220;dc_util_genkey&#8221; is active, we issue the ssh-keygen command to create our new key.</p>
<p>Last, the copy section moves the generated public_key into the ~/.ssh/authorized_keys file for our util user.  This enables the key for logging in without a password.  We can get fancier, but like I said, for now, its simple.</p>
<h3>Distributing the private key to the clients</h3>
<p>The cfengine clients are going to need the private key to be able to authenticate to our cfmaster server.  This is a quick addition in the aforementioned &#8216;copy&#8217; block so it looks like this:</p>
<pre>
copy:
  hg_cfmaster::
    $(util_pubkey)      dest=/home/util/.ssh/authorized_keys mode=600 owner=util group=localssh type=sum

  !hg_cfmaster::
     $(util_privkey)     dest=$(util_keydir) mode=0600 owner=root group=root type=sum server=$(policyhost)</pre>
<p>That&#8217;s it.  Now all the clients will decide if they need the key based on the checksum and replace it as a newer copy becomes available.  So, now we have an account that we can use to send files back to our cfengine master server.</p>
<h3>Sending a file to our cfengine master server</h3>
<p>What do we do now?  Well, I used this technique to issue a certificate request to my cfengine master server for a security tool called <a href="http://www.ossec.net">OSSEC-HIDS</a>.  This meant cfengine could manage the configurations and keys from my clients, making deployment completely automated.  Here&#8217;s an example using the key to scp a file back:</p>
<pre>
shellcommands:
  !hg_cfmaster::
    "/usr/bin/scp -i $(util_privkey) /tmp/somefilewithinformation.txt util@$(policyhost):~/$(host).txt"</pre>
<p>There ya go!  I&#8217;ll be putting up a page on the <a href="http://www.ossec.net/wiki/index.php/OSSEC">OSSEC-HIDS Wiki</a> on how I used this technique to manage all my clients configurations relatively soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Proxy Evasion, The Environment</title>
		<link>http://divisionbyzero.net/blog/2006/12/09/proxy-evasion-the-environment/</link>
		<comments>http://divisionbyzero.net/blog/2006/12/09/proxy-evasion-the-environment/#comments</comments>
		<pubDate>Sat, 09 Dec 2006 15:00:51 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[evasion]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2006/12/09/proxy-evasion-the-environment/</guid>
		<description><![CDATA[There are a ridiculous number of organizations using transparent proxying as a means to limit access to external resources. The idea is that by proxying all web traffic, they can keep employees from visiting porn sites. I&#8217;m not necessarily convinced that this does them much good. My general experience has been that the type of [...]]]></description>
			<content:encoded><![CDATA[<p>There are a ridiculous number of organizations using transparent proxying as a means to limit access to external resources.  The idea is that by proxying all web traffic, they can keep employees from visiting porn sites.  I&#8217;m not necessarily convinced that this does them much good.  My general experience has been that the type of people looking at porn during the day will not become more productive as a result of losing the freedom to look at porn at work.  They&#8217;ll still be useless employees that you have to performance review instead of firing for inappropriate use of technology.</p>
<p>Additionally, these proxies do very little to increase the security of the network.  I&#8217;m fairly certain that by the time the Proxy Vendor is alerted to malware distributing websites, an anti-virus company has already issued an update.  This is redundant.  Normally, I&#8217;d fully support this redundant &#8211; ok, I&#8217;ll drop the buzzword &#8211; Defense in Depth solution.</p>
<p>However, piggy-backing on the heels of ay real security value, which is best described as the graph of 1/x, are made up categories of websites to deter your users from doing things that your CEO believes are inappropriate.  Interestingly enough, if the CEO is involved in Fantasy Football, you&#8217;ll be hard pressed to find an IT Infrastructure that denotes that classification of sites as inappropriate.  I digress.</p>
<p><span id="more-27"></span></p>
<p>I hate these policies.  The whole concept of the internet is free access to information.  As my job is Information Security, I frequently surf into the areas of the internet that <a href="http://websense.com/global/en/">WebSense</a> might classify as &#8220;Inappropiate Content&#8221;, &#8220;Hacker Sites&#8221;, or &#8220;Proxy Sites&#8221;.  It&#8217;s the nature of my business.  Luckily for me, I&#8217;ve been granted an exception to the policy that allows me to view such terrible web content.</p>
<p>However, my users are frequently inconvenienced by searches for &#8220;adult oriented material&#8221; as some of our reproductivity scientists might need access to sites that contain terms like &#8220;sex&#8221;, with interesting prefixes like &#8220;oral&#8221; and &#8220;vaginal&#8221;.  <strong><em>*Gasp*</em></strong></p>
<p>So, tired of executives so out of touch with their users that they don&#8217;t recognize them, much less know what they do, I begin my multipart series on Proxy Evasion with the Environmental Concerns.</p>
<h3>CygWin</h3>
<p>If you&#8217;re running Windows, I highly recommend that you install <a href="http://www.cygwin.com/">CygWin</a>.  <a href="http://en.wikipedia.org/wiki/POSIX">It provides a POSIX Compliant Environment</a> for Windows.  I&#8217;d be lost on Windows without it.</p>
<p>Using CygWin you can install a host of tools for network scouting, monitoring, manipulation, defense, and attack.  Some of my indispensables include:</p>
<ul>
<li><a href="http://insecure.org/nmap/">nmap</a> &#8211; find out about a host</li>
<li><a href="http://iptraf.seul.org/">iptraf</a> &#8211; find out about network traffic</li>
<li><a href="http://www.tcpdump.org/">tcpdump / libpcap</a> &#8211; excellent network sniffer</li>
<li><a href="http://www.winpcap.org/">winpcap</a> &#8211; I can&#8217;t remember if CygWin actually has libpcap support, if not, I remember having enormous success with WinPCAP</li>
</ul>
<p>None of those are necessary for Proxy Evasion, but they are nice tools to have laying around when you&#8217;re connected to a network.</p>
<h3>Mac OS X</h3>
<p>Don&#8217;t worry, I&#8217;m a Mac user too.  Mac OS X comes with a number of UNIX utilities already installed.  I highly reccommend installing the Developer&#8217;s Tools package to get GCC and then installing one of the ports systems available.  The two forerunners in the GNU/OpenSource porting for OS X are:</p>
<ul>
<li><a href="http://fink.sourceforge.net/">Fink</a> &#8211; Provides source &#038; binary downloads of packages with full dependency support.</li>
<li><a href="http://www.macports.org/">MacPorts</a> &#8211; Previously DarwinPorts, source only ports system.</li>
</ul>
<p>Though most free software will download and compile without hassle, it&#8217;s nice to have a package management suite that manages and downloads dependencies so you spend less time searching and installing and more time using your software.</p>
<h3>But.. But.. I don&#8217;t have Admin Rights!</h3>
<p>As a way to &#8220;increase security&#8221;, organizations will remove administrative privileges from average user&#8217;s computers.  <a href="http://divisionbyzero.net/blog/2006/07/18/eating-your-own-dog-food/">I feel this is complete hipocracy</a>, so I discourage it.  However, if you&#8217;re unfortunate to have these restraints enforced on your computer, there are ways to run your programs without installing them, and thus be compliant with the &#8220;I will not install my own software on company computers&#8221; rule you signed when you took the job.</p>
<p>They&#8217;re called &#8220;Portable Apps.&#8221;  They&#8217;re designed to be installed &#038; run off of <a href="http://en.wikipedia.org/wiki/USB_flash_drive">USB flash drives</a> and require no disk access on the computer you run it on.  This generally avoids all automated software policy enforcement, allowing you to run your programs without being hassled.</p>
<p>Here are the two biggest repositories for portable apps:</p>
<ul>
<li><a href="http://portableapps.com/">Portable Windows Apps</a></li>
<li><a href="http://www.freesmug.org/portableapps/">Portable Mac OS X Apps</a></li>
</ul>
<p>This biggest advantage to portable apps is the fact that they&#8217;re preferences are also stored on the drives.  This means even if you don&#8217;t have access to modify the network settings (ie, Proxy settings) on your applications because of an enforced policy, you can still modify the preferences on the portable apps.  This is terribly useful once we have tunnels setup to use for proxying.</p>
<p>I carry around a copy of Thunderbird, Firefox, Gaim/Adium, Abiword, and for Windows, <a href="http://www.putty.nl/">PuTTY</a>.</p>
<p>If you&#8217;re on Windows, please <a href="http://www.putty.nl/latest/x86/putty.exe">download PuTTY</a> now.  It&#8217;s a light weight ssh terminal that does not need to be installed.  It&#8217;s precompiled and can run with out writing preferences anywhere you&#8217;re not allowed.</p>
<p>By becoming aware of software solutions that allow you to do your work, you can setup a hospitable environment for productivity, free from the annoyances of &#8220;ADMINISTRATOR PRIVILEGES REQUIRED.&#8221;</p>
<p>In the next article, we&#8217;ll cover using SSH for Proxy Evasion.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2006/12/09/proxy-evasion-the-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Is &#8216;Security Theatre&#8217; Good Enough?</title>
		<link>http://divisionbyzero.net/blog/2006/10/31/is-security-theatre-good-enough/</link>
		<comments>http://divisionbyzero.net/blog/2006/10/31/is-security-theatre-good-enough/#comments</comments>
		<pubDate>Wed, 01 Nov 2006 04:20:56 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2006/10/31/is-security-theatre-good-enough/</guid>
		<description><![CDATA[The American Populace is being inconvenienced, spied on, stripped of Constitutional Rights, and taxed without any idea where that money is going. The perpetrator is not some foreign, militant, activist group, it&#8217;s our own Government. There&#8217;s no outcry. All of these treacheries are being committed to increase security while the fact remains that all of [...]]]></description>
			<content:encoded><![CDATA[<p>The American Populace is being inconvenienced, spied on, stripped of Constitutional Rights, and taxed without any idea where that money is going.  The perpetrator is not some foreign, militant, activist group, it&#8217;s our own Government.  There&#8217;s no outcry.  All of these treacheries are being committed to increase security while the fact remains that all of these drastic measures have failed miserably.  The one constant is the relentless pursuit and protection of these programs by our elected officials.  They should be the voice of the populace, and perhaps they are.  Perhaps, &#8216;Security Theatre&#8217; is good enough for the masses.</p>
<p><span id="more-21"></span></p>
<p>There&#8217;s been a lot of coverage for a while about the inconsistencies and problems with the U.S. and it&#8217;s failed attempts at providing real security.  We have <a href="http://www.cleveland.com/news/plaindealer/index.ssf?/base/news/116212303846570.xml&#038;coll=2">Airport Screeners missing 20 of 22 bombs</a> in a live test of security conducted by TSA.  The New Scientist <a href="http://www.newscientist.com/channel/opinion/mg19225725.000">argues that most of the $44 BILLION spent on bioterrorism defense has been wasted</a>.  Recently, a bright young student at University of Indiana made a <a href="http://www.boingboing.net/2006/10/28/fbi_returns_to_fake_.html">fake boarding pass program</a>.  The interesting thing is this sort of thing had been <a href="http://www.schneier.com/crypto-gram-0308.html#6">documented</a> <a href="http://www.senate.gov/~schumer/SchumerWebsite/pressroom/press_releases/2005/PR4123.aviationsecurity021305.html">several</a> <a href="http://www.slate.com/id/2113157/fr/rss/">times</a> <a href="http://ioerror.livejournal.com/192472.html">before</a>.</p>
<p><a href="http://www.boingboing.net/2006/10/27/congressman_wants_fa.html">Blame</a>, of course, fell on this unsuspecting young student.  He crossed the line.  He made it _EASY_ for people to do this.  See, that&#8217;s the problem with these terrorists.  They&#8217;re inherently lazy.  They have no drive or ambition that would push them to open up MS Paint and digitally alter the image of a boarding pass.   That would require about 15 minutes, and terrorists certainly don&#8217;t have 15 minutes to spare to circumvent poor security measures.  The blame is misplaced.  TSA should be raided by the FBI.  Their lives should be disrupted and their houses sacked.</p>
<p>But we won&#8217;t point the finger at our security measures, certainly not Airport Security.  The fact is that good security measures could be developed that introduce little inconvenience into the picture for the end users.  However, I&#8217;m not entirely sure that would make people feel better.  This isn&#8217;t about real security or fighting terrorism.  It&#8217;s about being affected on a personal level by these security measures.</p>
<p>I don&#8217;t fly much.  Not because I&#8217;m afraid of terrorists, I rarely have the need to fly.  However, when I do, and I&#8217;m stuck in the long security lines at Airports, I can&#8217;t help but over hear people talking about how &#8220;at least we know we&#8217;re safe on the plane.&#8221;  Depending on my relative proximity to these conversations, I will tend to pipe up and explain the fault with the systems to my fellow travellers.  The response has not been good.  Now, they&#8217;re standing in a long line, wasting time, and Airport Screeners missed 20 out of 22 bombs.  Oddly enough, they kill the messenger.  Most of them just ask me to stop talking and then mutter under their breaths about how I don&#8217;t really know what I&#8217;m talking about.</p>
<p><strong>They want to <em>feel</em> secure, not <em>be </em>secure</strong>.  For these people, and they represent the masses, Security Theatre is not just good enough, it&#8217;s the requirement.  They may complain about it and rant, but if after 9/11 (take a shot if you&#8217;re playing along at home), they weren&#8217;t forced to stand in ridiculous lines and have underpaid, uninterested security guards look at their personal effects and throw their lip gloss in a trashcan labeled &#8216;contraband&#8217;, they&#8217;d be disoriented and petrified.  Sure, you think they&#8217;re scared now, but I really don&#8217;t think that air travel would&#8217;ve recovered as quickly as it did post 9/11 (*shot*) if people hadn&#8217;t been grotesquely inconvenienced.</p>
<p>There&#8217;s a problem with the perception of Security.  I see it in my day to day duties as a System Administrator / Programmer / Security Administrator.  If I had a nickel for every time I heard &#8220;security is getting in my way,&#8221; I&#8217;d be set.  People perceive security as inconvenience these days.  If they&#8217;re not being inconvenienced, then they&#8217;re pretty sure they&#8217;re not secure.  Nothing is going to change with the large scale security systems in this country until we change the perception of security.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2006/10/31/is-security-theatre-good-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Full Disk Encryption</title>
		<link>http://divisionbyzero.net/blog/2006/08/21/full-disk-encryption/</link>
		<comments>http://divisionbyzero.net/blog/2006/08/21/full-disk-encryption/#comments</comments>
		<pubDate>Mon, 21 Aug 2006 18:41:44 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[dumb]]></category>
		<category><![CDATA[fde]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2006/08/21/full-disk-encryption/</guid>
		<description><![CDATA[As you may or may not know, I am gainfully employed by the Federal Government in the area of Information Security. Recently the Bush Administration responded to media hype to issue a Federal Mandate requiring all government owned laptops use encryption technologies to encrypt their data. There are two interpretations of this memo. Encrypt the [...]]]></description>
			<content:encoded><![CDATA[<p>As you may or may not know, I am gainfully employed by the Federal Government in the area of Information Security.  <a href="http://www.whitehouse.gov/omb/memoranda/fy2006/m06-16.pdf">Recently the Bush Administration</a> responded to media hype to issue a Federal Mandate requiring all government owned laptops use encryption technologies to encrypt their data.</p>
<p>There are two interpretations of this memo.</p>
<ul>
<li>Encrypt the ENTIRE disk.</li>
<li>Encrypt just the files containing the data.</li>
</ul>
<p>So, what&#8217;s a lowly security administrator to do?!  Choices are bad!  Obviously you encrypt the entire disk! Right?! no? Why not?<br />
<span id="more-16"></span><br />
Well, recently concerned has been growing in the media over &#8220;Personally Identifiable Information&#8221; being recovered from stolen laptops.  Sadly, they&#8217;ve missed the point.  You see, most of the identity theft perpitrated results from malware, with a smaller number coming from physical security breaches, involving mostly <em>server hardware</em> like backup tapes, hard drives, and entire computers.  OMB and the Presidential mandate don&#8217;t deal with any of these issues, so their mandates can be viewed as little more than knee-jerk reactions to news coverage on the stolen VA Laptop.</p>
<p>Essentially, the media is now responsible for dictating Federal IT Security Policy.  This is what happens when you have governing bodies like OMB that don&#8217;t rationally evaluate threats or understand the technical aspect of IT Security.  It takes maybe another 10 minutes of searching through the archives at <a href="http://www.emergentchaos.com">Emergent Chaos</a> to realize that most breaches are the result of software breakins.  However, that&#8217;s not gonna stop the Federal Government from shelling out millions, possibly billions, to address the threat of data being stolen from a laptop that&#8217;s shutdown.</p>
<p>I don&#8217;t know about you, but the last time my laptop was shutdown was, well.. that one time it ran out of battery and I was miles away from a power adapter.  Otherwise my PowerBook just gets folded up and goes to sleep.  Full Disk Encryption decrypts the disk at BOOT.  So, since I&#8217;ve already booted, my entire drive is already booted, I gain nothing unless the battery dies.</p>
<p>&#8220;Full Disk Encryption&#8221; is also a pretty intimidating mouthful for most computer users.  Uninitiated, and some who think they&#8217;re initiated, sporting CISSP&#8217;s, would be lulled into thinking &#8220;HEY! My WHOLE disk is encrypted!  I&#8217;m secure!!!!!!!!!&#8221;  Unfortunately, this does nothing to protect your data from the software threats that are much more common.  You see, the disk is decrypted at boot, and then any programs just use the disk without even knowing that it&#8217;s encrypted.  So all the viruses and malware you&#8217;ve accumulated surfing the net for discount shopping and myspace.com updates on IE, is able to read ALL the data on your drive.</p>
<p>You haven&#8217;t really secured things from the most common threat, however, you have added another layer of complexity to the user&#8217;s experience.</p>
<p>So what is the solution?  Well first, it&#8217;s time to start investigating new methods for virus detection.  The Big 3 Vendors (Symantec, McAfee, and Trend Micro) have miss rates of 80% <a href="http://www.schneier.com/blog/archives/2006/08/why_the_topsell.html">because Virus authors are testing their virus against them</a>.  Closing this hole in the organizational structure will eliminate 80% of the threat to Identity Theft.</p>
<p>Horrible programming practices are usually to blame for the majority of personalized attacks that have leaked information in the past.  Managers should be encouraged to hire talented programmers and work with the programmers to create an atmosphere of cooperation.  The programmers should be involved in the design process.  They should also be given the right to veto or question their managers decisions.  Source control systems should be in place and encouraged.  Peer reviews should be factored into the development process.  The more eyes on the code, the more likely something will be caught.  The organization should adapt Best Practices based on recommendations by the development team.  These best practices require the same peer review that the code base gets.</p>
<p>This sounds like a lot of work, and it is.  Additionally, it&#8217;ll only fix like 1% of the Identity Theft problems.  However, it will raise the quality of the code, thus the product.  It might initially introduce some overhead, but that overhead will pay for itself and prove more cost effective as the products developed more accurately reflect customer desires.</p>
<p>If you have people with sensitive data on laptops or other portable media, you&#8217;re gonna need to deploy some form of encrypted mechanism for storage.  Personally, the encryption schemes that come builtin to Mac OS X and Windows XP should suffice for most intents and purposes.  Even OMB could&#8217;ve saved some money by leveraging this had they paid attention to their own rules.  Apple and Microsoft are both in process for attaining the coveted FIPS-140-2 compliance that is required for productions imploring encryption of federal data.  The Apple and Microsoft solutions have no cost overhead as they&#8217;re already installed on all the Apple and Microsoft laptops in production.</p>
<p>Folders with sensitive data should be encrypted in such a manner that there&#8217;s a an inactivity timeout, and the files must be decrypted when required.  Apple&#8217;s Disk Utility allows a user to construct an encrypted disk image that can be mounted like a regular DMG.  I&#8217;ve been told that Windows XP has a similar utility.  There are also free products out there like <a href="http://www.truecrypt.org">TrueCrypt</a> that allow you to hide the encrypted image in a JPG or other benign file.  For most people, the built-in encryption tools should be sufficient.</p>
<p>Users need to be trained to use the built-in features.  That&#8217;s where the money could go.  A simple PowerPoint presentation would satisfy most users.  I&#8217;d recommend that people routinely working with sensitive data be instructed on proper ways to store that data on their local machines.  You can pretend it won&#8217;t happen by making it a violation of Policy, but policy is a horrible place to hinge your IT Security Infrastructure on.</p>
<p>Don&#8217;t be sucked into the hype.  Think about things rationally and don&#8217;t make mandates that affect all government organizations without figuring out if there&#8217;s a potential threat there.  Realize, in my organization, we have over 300 users with laptops and in two years, we&#8217;ve had 0 lost or stolen laptops.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2006/08/21/full-disk-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP, Are you serious?</title>
		<link>http://divisionbyzero.net/blog/2006/07/26/php-are-you-serious/</link>
		<comments>http://divisionbyzero.net/blog/2006/07/26/php-are-you-serious/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 03:55:44 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2006/07/26/php-are-you-serious/</guid>
		<description><![CDATA[A long time ago, in a galaxy far, far away, I programmed in PHP for a mortgage company. I ended up leaving that job for personal reasons. Apparently, 40 hours/week truly is not enough. I was a Perl programmer prior to that excursion, and I guess I never grew out of it. I always felt [...]]]></description>
			<content:encoded><![CDATA[<p>A long time ago, in a galaxy far, far away, I programmed in <a title="PHP Site" href="http://www.php.net">PHP</a> for a mortgage company.  I ended up leaving that job for personal reasons.  Apparently, 40 hours/week truly is not enough.  I was a Perl programmer prior to that excursion, and I guess I never grew out of it.  I always felt uncomfortable there.  For a while I thought it might be social, but after further reflection, it&#8217;s obvious it was actually PHP&#8217;s fault.</p>
<p>To frame this, I just got back from <a title="YAPC::NA Chicago" href="http://www.yapcchicago.org">YAPC::NA</a>.  I learned all kinds of new techniques and tricks from MJD, chromatic, brian d. foy, Randal Schwartz, Damian Conway, and countless other acquaintances.  What&#8217;s not to love about <a title="Mason Headquarters" href="http://www.masonhq.com">Mason</a>, <a title="DBIx::Class" href="http://search.cpan.org/~jrobinson/DBIx-Class-0.06003/lib/DBIx/Class.pm">DBIx::Class</a>, and the brain bending functional tricks you can learn from MJD and chromatic?  I never knew that @INC could contain a subroutine reference, did you?  I also never thought of something so clever as recursively calling an anonymous sub ref contained in a scalar by using another anonymous subroutine that dereferences that ref at runtime.</p>
<p><span id="more-13"></span> So now, after refactoring a TON of my code to <a title="PBP @ O'Reilly" href="http://www.oreilly.com/catalog/perlbp/index.html">Perl Best Practices</a>, I&#8217;m back into the land of PHP temporarily.  Our administration group at work is looking for a project tracking system.  After favorable experiences with <a title="dotProject Homepage" href="http://www.dotproject.net">dotProject</a> a year ago, I suggested that.  I hadn&#8217;t touched dotProject or PHP since dotProject&#8217;s 1.x branch.  They&#8217;re now at 2.0.4 and it seems there just might be a few more hands in the pot.  The code is not as coherent and refreshing as I remember it.</p>
<p>I&#8217;ve been spending time building a module for additional &#8220;fund&#8221; tracking.  PHP seriously gets in my way.  Granted, I have a very heavy bias against anything but Perl, but my god, there&#8217;s a reason why <a title="Google :: " href="http://www.google.com/search?q=php%20sucks">this Google Search</a> exists.  They&#8217;re not lying.  I&#8217;m dealing with PHP4, so perhaps PHP5 has gotten better, but I harbor serious doubt that even by getting &#8220;better&#8221; that PHP5 would approach anything a serious computer scientist / programmer would consider usable.</p>
<p>The language is a patchwork of functions.  There&#8217;s no real defining factor or consistency.   As a matter of fact, the only thing consistent is the fact that regardless of what library in PHP you&#8217;re using, chances are the function names and argument orders lack consistency in that module and in the whole picture.</p>
<p>Don&#8217;t get me wrong, PHP is great for web designers and novices.  There&#8217;s a very low barrier to entry.  However, we now have a landscape littered with horrible PHP applications that expose servers to vicious attacks from outsiders.  PHP is not by any means a language that should be taken seriously by any serious developer.  Please invest your time elsewhere.  I&#8217;d even recommend Python over PHP.  Ruby would be a more worthwhile excursion.</p>
<p>PHP makes simple things simple and hard and obscure.  Hard things are impossible.  The biggest hole in the language from the perspective of a Perl or Lisp programmer is the complete lack of lexical scope.  I know, inside of a function there&#8217;s a lexical scope, but it&#8217;s not really a lexical scope, it&#8217;s a hack.  You  have your choice between global scoped variables, or variables scoped inside of a function.  No other closure provides an effective measure to force destruction and garbage clean up.  More importantly, certain techniques become ridiculous without proper lexical scope.</p>
<p>Early version of PHP3, maybe even &#8220;late&#8221; versions, had no scoping even for functions.  This became a problem to anyone used to using recursion to solve recursive problems.  Recursion relies on the fact that each call to the function can resolve independantly of the rest of the call stack.  Modifying variables that are still in wait on the stack can cause some &#8220;unexpected&#8221; behavior.</p>
<p>There also seems to be a problem with ternary operators.  Unexplainably, if the false condition of a ternary construct is in itself another ternary, the false is evaluated.  In order to &#8220;nest&#8221; ternary operators, <a title="Aboslute Bullshit Nested ternary operators." href="http://us2.php.net/manual/en/language.operators.comparison.php#56572">you need to enclose each INDIVIDUAL ternary in its own set of parentheses</a>.  Find precident for that illogical BS.  Why in the hell are we evaluating the false condition if the current ternary operator has returned &#8220;true&#8221; ?</p>
<p>It&#8217;s been a painful process, but in order to program in PHP, I&#8217;ve learned that you absolutely need a function reference.  It is impossible for a human being to formulate a logical function naming convention (is it &#8220;noun then verb? verb than noun? do I separate with underscores, or just smash it together&#8221;?) let alone the argument order even inside the same &#8220;module&#8221;.  Just peruse the <a title="PHP Function Reference" href="http://us2.php.net/manual/en/funcref.php">function reference on the php.net site</a> to see what I&#8217;m talking about.  Zero consistency.  Please, pick an interface and stick with it.</p>
<p>Bottom line, PHP is a good place to start, but don&#8217;t stop there.  Pick up another language.  I recommend Perl.  I&#8217;ll even teach you.  I&#8217;m gonna be teaching at NIH in the near future and I&#8217;ll be sharing my course material here.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2006/07/26/php-are-you-serious/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eating your own dog food</title>
		<link>http://divisionbyzero.net/blog/2006/07/18/eating-your-own-dog-food/</link>
		<comments>http://divisionbyzero.net/blog/2006/07/18/eating-your-own-dog-food/#comments</comments>
		<pubDate>Wed, 19 Jul 2006 02:18:14 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[trust]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/2006/07/18/eating-your-own-dog-food/</guid>
		<description><![CDATA[Most of the organizations I&#8217;ve been a part of, the IT staff usually has exemptions from IT policies if not significantly escalated privileges. This distances them from their users. I also happen to know and test MANY different ways to circumvent the policies and controls in place on the network. You can&#8217;t push policies and [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the organizations I&#8217;ve been a part of, the IT staff usually has exemptions from IT policies if not significantly escalated privileges.  This distances them from their users.  I also happen to know and test MANY different ways to circumvent the policies and controls in place on the network.  You can&#8217;t push policies and haphazardly grant exceptions to those policies to the group in charge of making them.</p>
<p><span id="more-11"></span></p>
<p>We live in a world of malware.  Spyware, Adware, Virii, and generally annoying programs saturate the landscape of the web.  Users don&#8217;t even have to really try to get these infections either.  Just visiting some <a title="websites" href="http://www.informationweek.com/management/showArticle.jhtml?articleID=190302133">websites</a> can lead to infection if you&#8217;re blissfully unaware of the evil in EULA&#8217;s.  To combat this problem, a large number of corporations automatically remove Administrator rights from user&#8217;s computers.  This sounds like a great idea, but atleast until Vista, Microsoft Employees all have <a title="Microsoft considering revoking administrative rights from employees with Vista" href="http://www.zdnet.com.au/news/security/soa/Microsoft_considers_taking_admin_rights_from_employees/0,2000061744,39257228,00.htm">administrative rights on their own workstations</a>!</p>
<p>Worse than your IT Staff being unfamiliar with userland without privileges, is the OS DEVELOPER being relatively unfamiliar with its interface without administrative privileges. Even with this protection, attackers can still <a title="ACL Privilege Escalation" href="http://www.frsirt.com/english/advisories/2006/0417">escalate privileges</a>, or circumvent that fact by <a title="Secunia Archive for Symantec AV" href="http://secunia.com/product/5555/">exploiting programs</a> that HAVE to run as administrator.  Take a look at the <a title="Secunia Security Advisories" href="http://www.secunia.com">Secunia</a> database for JUST the Operating System flaws in <a title="Secunia XP Advisory Listing" href="http://secunia.com/product/22/">Microsoft Windows XP Pro</a>.  A <a title="Search Secunia for " href="http://secunia.com/search/?search=antivirus">search for &#8220;antivirus&#8221; on Secunia</a> is also a bit depressing, listing 88 vulnerabilities for Antivirus Suites.</p>
<p>Aside from hackers, technologically inclined staff can <a title="Portable Applications" href="http://portableapps.com/">undermine</a> your group policies in several interesting ways.  Network security can be <a title="Breaking firewalls with OpenSSH &#038; Putty" href="http://souptonuts.sourceforge.net/sshtips.htm">circumvented</a> just as <a title="Torpark ( Firefox + Tor, portable )" href="http://torpark.nfshost.com/">easily</a>.  The advent of portable applications and network anonimizers, techniques used by &#8220;bad guys&#8221; for years, have destroyed policy&#8217;s strong hold on the corporate network.  Determined users will knock down any and all technological barriers to their productivity.<br />
Even if you&#8217;ve managed to take all the precautions to prevent the circumvention of your policies, including BIOS Protection, a determined user armed with <a title="Google Search :: bypass BIOS passwords" href="http://www.google.com/search?q=bypassing%20bios%20passwords">google</a> can <a title="Bypass BIOS passwords" href="http://labmice.techtarget.com/articles/BIOS_hack.htm">circumvent your BIOS password</a> and just boot up into <a title="Download Ubuntu" href="http://www.ubuntu.com/download/">Ubuntu</a> or any <a title="Arudius - Information Assurance Linux Live CD" href="http://arudius.sourceforge.net/">number</a> of <a title="Knoppix :: Security Tools Distribution" href="http://s-t-d.org/tools.html">other</a> <a title="PCLinuxOS :: Free linux Live CD" href="http://ftp.belnet.be/linux/pclinuxos/live-cd/english/preview/">free</a>, <a title="Auditor Security Collection" href="http://www.remote-exploit.org/index.php/Auditor_main">live</a> <a title="SLAX :: Slackware based, purpose driven Live CDs" href="http://www.slax.org/download.php">CD</a> distributions of linux to escape all of your fancy Active Directory Based security policies.  From there it&#8217;s trivial for users to do what they want.  Using <a title="WINE :: WINE Is Not an Emulator" href="http://www.winehq.org">WINE</a> and <a title="Open Office" href="http://www.openoffice.org">OpenOffice</a>, they can be just as productive as normal users, and far less restricted.</p>
<p>The bottom line is that the users have to be able to comfortably work within your organization with your security policies before your policies are effective at preventing breaches.  There are a number of factors, far beyond the reach of most corporate IT Policies &#038; Procedures documents that need to be addressed.</p>
<p>Employees honestly need to feel like a part of the organization, which is difficult when you consider how <a title="Executives Exploit the Labor" href="http://www.faireconomy.org/press/archive/1999/Executive_Excess/decade_of_executive_excess.html">upper management is distancing itself from the worker bees</a>.  As retarded as it sounds, when the average worker is being degraded by executives who take home more in BONUSES than most DEPARTMENTS take home cumulatively in their organization over the course of a year, there&#8217;s incentive for corporate espionage and sabotage.  This has been witnessed <a title="Wikipedia on the USSR" href="http://en.wikipedia.org/wiki/USSR">several</a> <a title="Wikipedia on Hitler" href="http://en.wikipedia.org/wiki/Adolf_Hitler">times</a> in <a title="French Revolution" href="http://en.wikipedia.org/wiki/French_revolution">history</a>.  I&#8217;ll stop before I get political, but bottom line, is there will never be &#8220;Information Security&#8221; in a country where there&#8217;s an obsurd distinction between rich &#038; poor.</p>
<p>Employees must also be given certain amount of <a title="My thoughts on trust." href="http://divisionbyzero.net/blog/2006/07/12/trust/">Trust</a> to give them a feeling of belonging or exclusivity.  The <a title="Perl - the official site" href="http://www.perl.org">tools</a> to <a title="Prelude IDS, Event Correlation" href="http://www.prelude-ids.org">provide accountability</a> to <a title="Snort, open source IDS" href="http://www.snort.org">actions on your network</a> are readily available, so should they fall out of line, you can casually remind them or adjust your policy if necessary.  If there&#8217;s no trust in the organization, the employee is forced to look out exclusively for themselves, which means they&#8217;ll be much more likely to act without regard to their impact on the organization.</p>
<p>Employees need room to grow and learn.  Without the potential to better themselves and their monetary compensation for their laborious contributions to your organization, the employees will leave, taking with them knowledge of your security measures.  They will also be more receptive to ideas of subterfuge, infidelity, and mutiny.  Reward your employees whenever possible.</p>
<p>Eventually you&#8217;ll get to the IT side of Network Security.  Basic preventive and passive monitoring measures should be deployed on the network to prevent outsiders from attacking.  The prevention of &#8220;insider attacks&#8221; requires more than just a Booklet of IT Security Rules.  Those rules should be flexible enough to be deployed throughout the organization, with as few exceptions as possible.  Ideally you want your computer systems working for you, not getting in your way.</p>
<p>Regardless of the policies you decide on, the IT group should be the FIRST group to adopt the policy, trickle out from there.  That way you can determine and fix potential problem for power users before the CTO kicks your door in.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2006/07/18/eating-your-own-dog-food/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trust.</title>
		<link>http://divisionbyzero.net/blog/2006/07/12/trust/</link>
		<comments>http://divisionbyzero.net/blog/2006/07/12/trust/#comments</comments>
		<pubDate>Wed, 12 Jul 2006 16:01:22 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[trust]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/2006/07/12/trust/</guid>
		<description><![CDATA[As a programmer, I&#8217;ve had the concept of &#8220;DON&#8217;T EVER TRUST YOUR USERS&#8221; beaten into my head. For programmers, this concept is incredibly important. Users almost always exceed your expectations for creativity with your new application. By planning for unexpected input, and properly cleaning all variables you can theoretically account for abuses of your system [...]]]></description>
			<content:encoded><![CDATA[<p>As a programmer, I&#8217;ve had the concept of &#8220;DON&#8217;T EVER TRUST YOUR USERS&#8221; beaten into my head.  For programmers, this concept is incredibly important.  Users almost always exceed your expectations for creativity with your new application.  By planning for unexpected input, and properly cleaning all variables you can theoretically account for abuses of your system by malicious users and provide a graceful failure for users attempting to enter in bogus data.</p>
<p>This concept is key to PROGRAMMING.  What I find astounding, is a large majority of corporations are adopting this practice for ALL IT related issues, and it&#8217;s even saturating into HR and other areas of employment.  Working as a Security Administrator, I&#8217;m surprised that most employers have decided to not trust their employees.  If you can&#8217;t trust them, then why would you hire them?</p>
<p><span id="more-4"></span></p>
<p>Some key differences between &#8220;users&#8221; and &#8220;employees&#8221;.  We&#8217;ll assume for the sake of argument, that we&#8217;re talking about a Web Application and an Employee&#8217;s Desktop Computer.</p>
<p>Web Applications:</p>
<ul>
<li>Usually allow most of the internet to establish a connection.</li>
<li>Usually implement a custom or home-grown authentication schema.</li>
<li>Usually implement a custom separation of privilege system.</li>
<li>Usually users are not screened prior to access.</li>
</ul>
<p>Employee&#8217;s Desktop Computer:</p>
<ul>
<li>Usually require physical acces (normally, badged entrance to a building, sector of a building, and possibly a room key).</li>
<li>Usually sit behind fairly restrictive firewalls that block unrequested inbound communication from external places.</li>
<li>Usually implement a centrally controlled authentication system like ActiveDirectory, or LDAP.</li>
<ul>
<li>Usually this process is linked directly into HR&#8217;s New Hire / Termination Process</li>
</ul>
<li>Permission and ACL system&#8217;s are usually tied directly into ActiveDirectory and/or LDAP</li>
<li>Users are screened through the interview process.  They also tend to be known to the organization.</li>
<li>Actions on the systems usually include a system for accountability wherein an event can be traced directly back to a particular user.</li>
</ul>
<p>Yes, there are exceptions.  I know Kevin Mitnik would just walk into a building behind an employee, pretend like he belonged there and sit down at an unused computer and &#8220;hack&#8221; internally.  However, people like Mitnik are exceptions to the rule.  Most of these pimply faced, angst ridden, EMO listening script kiddies don&#8217;t have the courage necessary to &#8220;hack&#8221; at a social level.</p>
<p>So why doesn&#8217;t your organization trust you?  They can easily punish &#038; revoke acccess after repeat offenses.  Theoretically, it&#8217;s not more work than is currently being done.  Actually, if users had administrative rights over their pc&#8217;s, they could install the software they need to get their jobs done without putting in tickets to a corporate help desk.  Would machines get thrashed by malware and stupid ass HotBar installs?  Of course, but how many untrusting environments currently deal with those problems as is?</p>
<p>The fact is, virus and malware writers are clever.  Certain processes run as administrator on a windows machine regardless of the user logged in.  Using the builtin messaging systems, the malware writers can force their installer to run as administrator if you have an Antivirus process running.  So in a sense, we have policies that impact and impede employees while not really eliminating the serious threats they&#8217;re being flagged as preventing.</p>
<p>Currently, using a combination of open source tools at work, we&#8217;re trusting our users.  If they&#8217;re not productive, they don&#8217;t stick around.  We get the IT overhead the hell out of their way and let them be productive.  The result has been more effective employees.  We do have problems occassionally, but every IT section fights the occassional virus or malware outbreak.  Even cooler, the system we&#8217;ve adapted has helped us automate a lot of the fight because we&#8217;ve had far more time free to implement proactive and reactive network security policies since we&#8217;re not spending all our time installing Adobe Acrobat on all 800 of our users&#8217; Desktops.</p>
<p>We&#8217;ve also noticed that when users feel trusted, they tend to have a much more positive outlook on the whole IT field.  I&#8217;ve been in environments where users hate their computer so much they become beligerent the second they get an error message.  Granted, we still have angry users, but much less frequently than previously.  We hired our employees because they were the best candidates and part of their job is being responsible.  If they&#8217;re not responsible, they don&#8217;t last long.</p>
<p>Of course, there&#8217;s an additional piece to consider.  Now that we&#8217;ve nailed down the monitoring and accountability, we&#8217;ve noticed that after users get warned about something once, they generally don&#8217;t repeat offenses.  They genuinely want to be secure.  Do you honestly think your employees want to compromise their personal data, trade secrets, or customer data?  Hell no!  That&#8217;s bad.  No one wants bad.  They generally don&#8217;t know not to click the f*cking monkey until you tell them not to.  It&#8217;s education.</p>
<p>The internet is a scary place filled with promises of riches beyond your wildest imagination.  That promise, techies know is no different than any opportunity that existed prior to the internet.  Usually, if it sounds too good to be true, it generally is.  Users need and want to be better educated about the threats they face online.  Just like you paid that consultant to come in and teach best practices to your programmers, you should put together classes for users to get education on the internet and computers.</p>
<p>If you don&#8217;t believe me, I dare you to put together an introductory course to internet safety for your users.  Offer the class, don&#8217;t force it down their throats and see what the response is.  Also, please don&#8217;t be ignorant to non-work related issues.  Your employees screw around at work, and if they like you, they work at home.  So, address clicking on the monkey and myspace.com and the threats that they face on those sites.  Don&#8217;t be arrogant and make the class fun.</p>
<p>Even if a small percentage come to the first class, they&#8217;ll generally spread that knowledge to co-workers and friends virally.  The average person wants to know and use best practices for maintaining security on their home &#038; work PCs.  They don&#8217;t want the world to know that they just bought Yanni tickets!</p>
<p>Generally speaking, not trusting the users is a GOOD thing for PROGRAMMING.  However, used as blanket policy for your employees, it creates an environment of distrust and disdain.  It will undermine any &#8220;team building&#8221; seminars you just paid for to help people &#8220;synergize&#8221;.  They&#8217;re your employees and many of you spend more time at work than with your own families.  If you&#8217;re around people you can&#8217;t trust, GET OUT OF THERE NOW.  IT Policies will not help you in this case.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2006/07/12/trust/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
