<?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>My Wushu Blog &#187; Mike Carlson</title>
	<atom:link href="http://www.mywushublog.com/author/mike/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mywushublog.com</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 18:42:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using CouchDB with Puppet and Bacula</title>
		<link>http://www.mywushublog.com/2012/01/using-couchdb-with-puppet-and-bacula/</link>
		<comments>http://www.mywushublog.com/2012/01/using-couchdb-with-puppet-and-bacula/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 04:48:07 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[Bacula]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1648</guid>
		<description><![CDATA[On aspect that I was never happy with the Bacula environment I built while at LLNL was the fact that I could no look up certain values for each client. Values like: Passwords Storage Devices Certificates (if you are using Encryption) Well, over the past few week&#8217;s I&#8217;ve been able ...]]></description>
			<content:encoded><![CDATA[<p>On aspect that I was never happy with the Bacula environment I built while at LLNL was the fact that I could no look up certain values for each client. Values like:</p>
<ul>
<li>Passwords</li>
<li>Storage Devices</li>
<li>Certificates (if you are using Encryption)</li>
</ul>
<p>Well, over the past few week&#8217;s I&#8217;ve been able to work around this problem by storing additional information in a CouchDB DB.</p>
<p>It is not the ideal solution, but it is a start and I&#8217;m okay with that. I should also warn you, I do HORRIBLE things here with Bash and JSON. Since Bash doesn&#8217;t know about JSON, I rely upon awk. I know, I know, I should re-write all of this in a nice new language like Python or Ruby&#8230;</p>
<p>First thing is first, I had to create a new database:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ curl <span style="color: #660033;">-kX</span> PUT https:<span style="color: #000000; font-weight: bold;">//</span>puppet.bayphoto.local<span style="color: #000000; font-weight: bold;">/</span>bacula_meta
<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;ok&quot;</span>:<span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>I&#8217;m not going to worry about that name, to me it is a database that contains some metadata of our clients.</p>
<p>My client creation tool that I posted in my previous <a href="/2011/07/bacula-in-the-enterprise-part-2/">Bacula</a> article has been updated to do a little bit more. Aside from no longer using TEMPLATE files, I&#8217;ve added some additional code to push a few details into this new bacula_meta database. Here is my &#8220;write_json&#8221; function:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Some NEW Variables:</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">COUCH_SERVER</span>=<span style="color: #ff0000;">&quot;https://puppet.bayphoto.local&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DB</span>=<span style="color: #ff0000;">&quot;bacula_meta&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CERTDIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$BDIR</span>/certs&quot;</span>
&nbsp;
write_json<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   curl <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/json&quot;</span> <span style="color: #660033;">-kX</span> PUT <span style="color: #660033;">-d</span> <span style="color: #ff0000;">'{ &quot;_id&quot;: &quot;'</span><span style="color: #800000;">${HOSTNAME}</span><span style="color: #ff0000;">'&quot;,&quot;passhash&quot;: &quot;'</span><span style="color: #800000;">${PASSHASH}</span><span style="color: #ff0000;">'&quot; }'</span> <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>The document I create is simple, it is named after the short hostname of the client added to backups, and for this first run we store that and the password.</p>
<p>The &#8220;main&#8221; function of the script first tests to see if a document in the bacula_meta db exists, and if not it will create a new client. If it does exist, you can either continue and re-create the bacula client&#8217;s configuration, or quite:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">TEST</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$TEST</span> == <span style="color: #000000; font-weight: bold;">*</span>not_found<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
       <span style="color: #666666; font-style: italic;"># Generate a bacula password.</span>
       <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PASSHASH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>random <span style="color: #007800;">bs</span>=<span style="color: #000000;">6</span> <span style="color: #007800;">count</span>=<span style="color: #000000;">4</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">|</span> openssl base64<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
       <span style="color: #666666; font-style: italic;"># This is the actual .conf configuration</span>
       print_client_conf
&nbsp;
       <span style="color: #666666; font-style: italic;"># Create a new client document in $DB</span>
       write_json
&nbsp;
       <span style="color: #666666; font-style: italic;"># Create SSL key-pair</span>
       create_keys
&nbsp;
       <span style="color: #666666; font-style: italic;"># Adding the client .conf file for the director to source.</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> \<span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
&nbsp;
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'created client definition: '</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'for '</span><span style="color: #007800;">$HOSTNAME</span>
<span style="color: #000000; font-weight: bold;">else</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'client '</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #ff0000;">'already exists.'</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Do you want to override the current configuration for:'</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'      '</span><span style="color: #007800;">$HOSTNAME</span>
       <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;[y/N] &quot;</span> prompt
       <span style="color: #007800;">prompt</span>=<span style="color: #800000;">${prompt,,}</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$prompt</span> =~ ^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #000000; font-weight: bold;">|</span>y<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
       <span style="color: #000000; font-weight: bold;">then</span>
               <span style="color: #666666; font-style: italic;"># if we choose to override, a new client conf will be generated and added and commited.</span>
&nbsp;
               <span style="color: #666666; font-style: italic;"># Lets re-obtain our stored client password first</span>
               <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PASSHASH</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span>  <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F: <span style="color: #ff0000;">'gsub(&quot;{|}&quot;,&quot;&quot;) { print $5 }'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
               <span style="color: #666666; font-style: italic;"># print out a new cliend.conf</span>
               print_client_conf
&nbsp;
               <span style="color: #666666; font-style: italic;"># Push the clients key-pair back to couchdb       </span>
               curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-X</span> PUT <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$FQDN</span>-fd.pem?<span style="color: #007800;">rev</span>=<span style="color: #007800;">$DOC_REV</span> <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$CERTDIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$FQDN</span>-fd.pem  <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/octet-stream&quot;</span>
&nbsp;
                <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-w</span> <span style="color: #007800;">$HOSTNAME</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
                <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'client '</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #ff0000;">'already exists...'</span>
                <span style="color: #000000; font-weight: bold;">else</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> \<span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
                <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">else</span>
               <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Ok, no clients were modified or added!&quot;</span>
       <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>The other addition was a create_keys function. Our clients encrypt their data to the storage node (we send some backup volumes to S3 storage, which is over http and not stored in any sort of encrypted format), and we needed a decent way to distribute the keys (using Puppet&#8230;).</p>
<p>This was difficult for me to do. What I failed to understand about adding attachments to CouchDB is you have to reference the current document _rev, and after a LOT of trial and error I finally got it. The DOC_REV variable grabs the current documents revision:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DOC_REV</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">':|&quot;'</span> <span style="color: #ff0000;">'{ print $10}'</span><span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>Which is then used when I actually PUT the file in there:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-X</span> PUT <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem?<span style="color: #007800;">rev</span>=<span style="color: #007800;">$DOC_REV</span> <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem  <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/octet-stream&quot;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">create_keys<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">DOC_REV</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">':|&quot;'</span> <span style="color: #ff0000;">'{ print $10}'</span><span style="color: #000000; font-weight: bold;">`</span>
  <span style="color: #007800;">C</span>=<span style="color: #ff0000;">&quot;US&quot;</span>
  <span style="color: #007800;">ST</span>=<span style="color: #ff0000;">&quot;California&quot;</span>
  <span style="color: #007800;">L</span>=<span style="color: #ff0000;">&quot;Santa Cruz&quot;</span>
  <span style="color: #007800;">O</span>=<span style="color: #ff0000;">&quot;Bay Photo Lab&quot;</span>
  <span style="color: #007800;">OU</span>=<span style="color: #ff0000;">&quot;IT&quot;</span>
  <span style="color: #007800;">CN</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${HOSTNAME}</span>.bayphoto.local&quot;</span>
  <span style="color: #007800;">EMAIL</span>=<span style="color: #ff0000;">&quot;bayit@bayphoto.com&quot;</span>
&nbsp;
openssl genrsa <span style="color: #660033;">-out</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.key <span style="color: #000000;">2048</span>
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.key <span style="color: #660033;">-x509</span> <span style="color: #660033;">-out</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.cert <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
${C}
${ST}
${L}
${O}
${OU}
${CN}
$EMAIL
EOF</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.key <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.cert <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>-fd.pem
&nbsp;
curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-X</span> PUT <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem?<span style="color: #007800;">rev</span>=<span style="color: #007800;">$DOC_REV</span> <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem  <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/octet-stream&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>So what does adding a new client look like using this updated tool?</p>
<pre>
# ./cclient.bash -s Standard -h client-a
INSERT 0 1
{"ok":true,"id":"client-a","rev":"1-0841684988ec85c6d2b16cb941a739ac"}
Generating RSA private key, 2048 bit long modulus
..............................................................+++
..............+++
e is 65537 (0x10001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:State or Province Name (full name) [Some-State]:Locality Name (eg, city) []:Organization Name (eg, company) [Internet Widgits Pty Ltd]:Organizational Unit Name (eg, section) []:Common Name (eg, YOUR name) []:Email Address []:
{"ok":true,"id":"client-a","rev":"2-21d4e7bc019c2176dfa2583b320387ab"}
created client definition: /usr/local/etc/bacula/clients.d/client-a.conf
for client-a
</pre>
<p>And my new record in CouchDB has all the right data:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-kX</span> GET https:<span style="color: #000000; font-weight: bold;">//</span>puppet.bayphoto.local<span style="color: #000000; font-weight: bold;">/</span>bacula_meta<span style="color: #000000; font-weight: bold;">/</span>client-a
<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;_id&quot;</span>:<span style="color: #ff0000;">&quot;client-a&quot;</span>,<span style="color: #ff0000;">&quot;_rev&quot;</span>:<span style="color: #ff0000;">&quot;2-21d4e7bc019c2176dfa2583b320387ab&quot;</span>,<span style="color: #ff0000;">&quot;hostname&quot;</span>:<span style="color: #ff0000;">&quot;client-a&quot;</span>,<span style="color: #ff0000;">&quot;passhash&quot;</span>:<span style="color: #ff0000;">&quot;y9WBgacrd8JbZjrefeZHKbPk9Kda5UQc&quot;</span>,<span style="color: #ff0000;">&quot;_attachments&quot;</span>:<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;client-a.bayphoto.local-fd.pem&quot;</span>:<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;content_type&quot;</span>:<span style="color: #ff0000;">&quot;application/octet-stream&quot;</span>,<span style="color: #ff0000;">&quot;revpos&quot;</span>:<span style="color: #000000;">2</span>,<span style="color: #ff0000;">&quot;digest&quot;</span>:<span style="color: #ff0000;">&quot;md5-kqi8ODloPxT6D6IxZbCoVg==&quot;</span>,<span style="color: #ff0000;">&quot;length&quot;</span>:<span style="color: #000000;">3411</span>,<span style="color: #ff0000;">&quot;stub&quot;</span>:<span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Thats ugly&#8230; how about a nice screenshot!<br />
<a href="http://www.mywushublog.com/wp-content/uploads/2012/01/client-a.png"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/client-a-300x173.png" alt="" title="client-a" width="300" height="173" class="aligncenter size-medium wp-image-1649" /></a></p>
<p>Now that we have the Bacula tool pushing passwords and and certificates, we need to get Puppet to pull the data.</p>
<p>I found a github project called couchdblookup:<br />

https://github.com/camptocamp/puppet-couchdb/blob/master/lib/puppet/parser/functions/couchdblookup.rb</p>

<p>I placed that couchdblookup.rb file into one of my Puppet modules (etc/puppet/environments/production/bacula/lib/puppet/parser/functions/couchdblookup.rb), and created a bacula::fd::cert class:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> bacula::fd::cert inherits bacula::fd <span style="color:#006600; font-weight:bold;">&#123;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Pull bacula client password from our</span>
  <span style="color:#008000; font-style:italic;"># CouchDB server</span>
  <span style="color:#ff6633; font-weight:bold;">$couchdb_bind_address</span> = <span style="color:#996600;">&quot;puppet.bayphoto.local&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$couchdb_port</span> = <span style="color:#996600;">&quot;5984&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$couchdb_base_url</span> = <span style="color:#996600;">&quot;https://${couchdb_bind_address}:${couchdb_port}&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$bacula_meta</span> = <span style="color:#996600;">&quot;${couchdb_base_url}/bacula_meta/${hostname}&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$bacula_fd_cert</span> = <span style="color:#996600;">&quot;${couchdb_base_url}/bacula_meta/${hostname}/${fqdn}-fd.pem&quot;</span>
&nbsp;
  <span style="color:#ff6633; font-weight:bold;">$bacula_fd_passhash</span> = couchdblookup<span style="color:#006600; font-weight:bold;">&#40;</span>$bacula_meta, <span style="color:#996600;">&quot;passhash&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  file <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;master.cert&quot;</span>:
    name    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff6633; font-weight:bold;">$operatingsystem</span> ? <span style="color:#006600; font-weight:bold;">&#123;</span>
      FreeBSD  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/usr/local/etc/bacula/certs/master.cert&quot;</span>,
      windows  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;C:<span style="color:#000099;">\P</span>rogram Files<span style="color:#000099;">\B</span>acula<span style="color:#000099;">\m</span>aster.cert&quot;</span>,
      default  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/etc/bacula/certs/master.cert&quot;</span>,
    <span style="color:#006600; font-weight:bold;">&#125;</span>,
    owner   <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">0</span>,
    mode    <span style="color:#006600; font-weight:bold;">=&gt;</span> 0640,
    source  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;puppet:///bacula/master.cert&quot;</span>,
  <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  <span style="color:#CC0066; font-weight:bold;">exec</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;fd.cert&quot;</span>:
    path    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;/usr/bin&quot;</span>,<span style="color:#996600;">&quot;/usr/local/bin&quot;</span>,<span style="color:#996600;">&quot;/bin&quot;</span>,<span style="color:#996600;">&quot;/sbin&quot;</span>,<span style="color:#996600;">&quot;/usr/sbin&quot;</span>,<span style="color:#996600;">&quot;/usr/local/sbin&quot;</span>,<span style="color:#996600;">&quot;/usr/local/libexec&quot;</span>,<span style="color:#996600;">&quot;/usr/libexec&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>,
    command <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff6633; font-weight:bold;">$operatingsystem</span> ? <span style="color:#006600; font-weight:bold;">&#123;</span>
      FreeBSD  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;fetch -o /usr/local/etc/bacula/certs/${fqdn}-fd.pem $bacula_fd_cert&quot;</span>,
      windows  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;C:/scripts/curl.exe -sk $bacula_fd_cert -o <span style="color:#000099;">\&quot;</span><span style="color:#000099;">\P</span>rogram Files<span style="color:#000099;">\B</span>acula<span style="color:#000099;">\\</span>${::fqdn}-fd.pem<span style="color:#000099;">\&quot;</span>&quot;</span>,
      default  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;curl -sk $bacula_fd_cert -o /etc/bacula/certs/${fqdn}-fd.pem&quot;</span>,
    <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>As you can see, I&#8217;m also working on getting Windows systems into our Puppet environment.</p>
<p>It is incredibly immature right now, and Windows lacks a lot of tools I take for granted. It would make my life a lot easier if Microsoft just tool all the BSD licensed userland tools like diff, fetch (or curl), md5, ssh, etc&#8230; to make my Puppet automation easier. You NEED diff.exe to use Puppet on windows, otherwise templating won&#8217;t work.</p>
<p>Aside from the windows side of things being a pain, this has been working out well enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2012/01/using-couchdb-with-puppet-and-bacula/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello Bay Photo Lab</title>
		<link>http://www.mywushublog.com/2012/01/hello-bay-photo-lab/</link>
		<comments>http://www.mywushublog.com/2012/01/hello-bay-photo-lab/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 00:38:12 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1624</guid>
		<description><![CDATA[After 9.5 years with one employer (LLNL), I joined Bay Photo Lab in Santa Cruz. This has brought on many changes, not just a career change but a significant change in my way of life. First off, I&#8217;m renting a room until my family gets down here. I have this ...]]></description>
			<content:encoded><![CDATA[<div id="attachment_1630" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111118_185210.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111118_185210-300x224.jpg" alt="" title="IMG_20111118_185210" width="300" height="224" class="size-medium wp-image-1630" /></a><p class="wp-caption-text">From one Lab to another</p></div>
<p>After 9.5 years with one employer (LLNL), I joined Bay Photo Lab in Santa Cruz.</p>
<p>This has brought on many changes, not just a career change but a significant change in my way of life.</p>
<p>First off, I&#8217;m renting a room until my family gets down here. I have this weird double life now, where during the week I live alone in a small room with no heating, and then I go back home on the weekend. Not seeing the kids is the hardest part. We typically do a video chat on Wednesday nights, but when I come home Owen is usually a little stand-offish and Caralyne is unhappy during the week (especially when I have to leave). Its sad.</p>
<div id="attachment_1629" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111114_214020.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111114_214020-300x224.jpg" alt="" title="IMG_20111114_214020" width="300" height="224" class="size-medium wp-image-1629" /></a><p class="wp-caption-text">Here was the bathroom in my place for the first week. As in, I did not have one.</p></div>
<p>Like a kid fresh out of his parents home, I have to do things like laundry, and all of my own dishes.<br />
<div id="attachment_1631" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111118_135327.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111118_135327-300x224.jpg" alt="" title="IMG_20111118_135327" width="300" height="224" class="size-medium wp-image-1631" /></a><p class="wp-caption-text">I&#039;m in no hurry to hurry back</p></div></p>
<p>My commute is significantly different. I drive a lot less during the week, I&#8217;m about 3 miles from work. Some days I choose to walk, and other days I&#8217;ll drive in after jogging back home during lunch. It is pretty awesome, it has been 12 years since I have lived and worked in the same place.</p>
<p>Let&#8217;s talk about Bay Photo. I had a slight idea of what they did when I initially interviewed with them IT team here (Rob and Patrick), and I did some simple Google-ing. However, after working here for two months, it is incredibly impressive how much they do and how great the people are here.</p>
<p>Bay Photo Lab has a nice small company feel to it, and it is inCREDIBLY friendly here. People are pretty passionate about the work they do here, and so is the IT team here. </p>
<p>This has been really awesome, as passion (and really, it should be called &#8220;the desire to do the right thing&#8221;) was something LLNL did not reward or encourage. </p>
<p>Rob, my counterpart here, has been essentially on his own and he has a lot of great ideas that I can help him implement. We both really love technology and open source, so we hardly have to bring each other up to speed. I no longer have to talk until I&#8217;m blue in the face to extol the virtues of FreeBSD, Puppet, Bacula, Wiki&#8217;s, Git, code management tools, etc&#8230; they are accepted as a matter of fact. I&#8217;m also allowed to run whatever OS I want for whatever reason. Rob and I were talking about DragonflyBSD&#8217;s HAMMER filesystem, and how we are both just looking for an excuse to use it.</p>
<p>I couldn&#8217;t even afford to entertain that though while at LLNL. It was hard enough getting OS&#8217;s approved, because it was never about technical merit, and the thought of trying to defend yet another OS was enough to prevent me from using it.</p>
<p>Work has been rewarding, and I can honestly say that I&#8217;ve never worked harder at a job that before. I&#8217;ve refined my workflow a bit, and with the help of my friend Steve, I&#8217;ve been shown how to use JIRA and FishEye to keep track of my projects. Now when I come in to work, I don&#8217;t have to sit here and think about where I was yesterday, I an just pull up my project page and review my tasks.</p>
<p>I also now have somewhat of a social life, which is pretty exciting! Tuesday nights I drive to Monterey and have dinner with Glenn and Erin:<br />
<div id="attachment_1636" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111213_204119.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111213_204119-300x224.jpg" alt="" title="IMG_20111213_204119" width="300" height="224" class="size-medium wp-image-1636" /></a><p class="wp-caption-text">Glenn and Eric cookin&#039; in the kitchen</p></div><br />
<div id="attachment_1635" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111213_204027.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/IMG_20111213_204027-300x224.jpg" alt="" title="IMG_20111213_204027" width="300" height="224" class="size-medium wp-image-1635" /></a><p class="wp-caption-text">Delicious pizza!</p></div></p>
<p>We have dinner, converse, and then we bust out the instruments. I had to drop my music class at DVC, but having someone to be musical with is very fulfilling. No tour dates or T-Shirts just yet, but we have a great time. I&#8217;m looking forward to getting my gear down here so we can get really crazy</p>
<p>I also get to see Steve and Summer a whole lot more, and we typically meet up on Thursday nights. It will be nice when I&#8217;m finally moved down in the area so we can do that on the weekend, have a BBQ or something.</p>
<p>Well, that about sums up the last two months I&#8217;ve been here. I&#8217;ll be moving to Felton in the beginning of the month, so more after that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2012/01/hello-bay-photo-lab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coal</title>
		<link>http://www.mywushublog.com/2011/12/coal/</link>
		<comments>http://www.mywushublog.com/2011/12/coal/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 02:00:07 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Family]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Coal]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1606</guid>
		<description><![CDATA[I&#8217;m absolutely crushed. I&#8217;ve lost a great friend and member of our family, Coal. He escaped our backyard and was hit by car between the A and G street freeway on-ramps. He turned two on 11/16. Coal was the dog I dreamed of having; he was the combination of all ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m absolutely crushed. I&#8217;ve lost a great friend and member of our family, Coal. He escaped our backyard and was hit by car between the A and G street freeway on-ramps. He turned two on 11/16.</p>
<p>Coal was the dog I dreamed of having; he was the combination of all the Aussies I&#8217;ve had growing up.</p>
<p>He was the best. That dog never seemed to have a down moment. He was always happy, and always looking for trouble. I also felt like he was an extension to me, but I suspect that is me projecting my own personality on him. Lets be honest, he wasn&#8217;t an extension of me, he was better than me. He was me and more. Filled with unconditional love and never had a bad day, a temper tantrum, and a moment of self-involved narcissism. I was lucky to be with him.</p>
<p>I&#8217;ve always had an Australian Shepard; Max, Buddy, and then my parents both had Shasta and Happy. I loved their energy, friendliness, how expressive they seemed to be with their eyes. Even the ridiculous smile, which they always greeted me with.</p>
<p>They all lived to a average and predictable age (Shasta is still going strong) and I was prepared for their natural deaths. Over the years, both of my parents have gotten Aussie&#8217;s, and I&#8217;ve loved them too. I couldn&#8217;t be happier when I would visit and show them all the affection I could.</p>
<p>Not Coal. I&#8217;m not prepared to accept that he is gone, it still hasn&#8217;t fully processed yet. I keep looking at this pictures and even though I get upset, I still think that I&#8217;ll see him when I get home. Or when I look in the backyard, I expect to see him up to his usual shenanigans. </p>
<p>I didn&#8217;t get enough time with him, and I&#8217;m mad that I let him out early that morning instead of just keeping him in the house. I know that he just had it in him to escape and run around. He loved it, he loved exploring and being free, and that was noticeable when we first got him and he tried to escape the backyard.</p>
<p>His attempts to escape got really bad after Zoey died. It seemed that having her around helped ground him, especially when he got scared from loud noises like fireworks or gun shots. We knew we wanted to get out of Antioch for the kids, but when Coal started getting scared and trying to take off if we were not home, I knew he needed to move to a safer place as well. I just thought if he could make it until we moved, he would be happier and better off.</p>
<p>He just kept getting out though, and he got lucky every time. People would find him and bring him home to us, and I&#8217;d give them what ever I could to show my appreciation. He&#8217;d be happier than ever that he got to run around and then get delivered back to us, and it was concerning to me that he never came home on his own. That night I closed up where I noticed he had escaped from</p>
<p>I&#8217;m so sad that I didn&#8217;t get him to Santa Cruz, and that I wont get to hug him, kick the soccer ball around with him, go on walks, watch him sleep, kiss his cute snout with that black button nose. I&#8217;m going to miss him terribly.</p>
<p>I&#8217;ve shared an album on Picasa, please enjoy:</p>
<table style="width:330px;">
<tr>
<td align="center" style="height:194px;background:url(https://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat left"><a href="https://picasaweb.google.com/m87carlson/Coal02?authuser=0&#038;feat=embedwebsite"><img src="https://lh4.googleusercontent.com/-Qgv1TV4AaTM/Tu_nuzBOg-E/AAAAAAAAEEs/A9o21M7zQYA/s160-c/Coal02.jpg" width="300" height="300" style="margin:1px 0 0 4px;"></a></td>
</tr>
<tr>
<td style="text-align:center;font-family:arial,sans-serif;font-size:11px"><a href="https://picasaweb.google.com/m87carlson/Coal02?authuser=0&#038;feat=embedwebsite" style="color:#4D4D4D;font-weight:bold;text-decoration:none;">Coal</a></td>
</tr>
</table>
<p>Goodbye Coal, I&#8217;m so sorry I couldn&#8217;t keep you safe. This is how I&#8217;ll always remember the two of us.<br />
<a href="http://www.mywushublog.com/wp-content/uploads/2011/12/IMG_5906.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2011/12/IMG_5906-300x200.jpg" alt="" title="IMG_5906" width="300" height="200" class="aligncenter size-medium wp-image-1612" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/12/coal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Goodbye LLNL</title>
		<link>http://www.mywushublog.com/2011/11/goodbye-llnl/</link>
		<comments>http://www.mywushublog.com/2011/11/goodbye-llnl/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 06:21:34 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Jenny]]></category>
		<category><![CDATA[LLNL]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1589</guid>
		<description><![CDATA[Well, after about 9 and a half years with Lawrence Livermore National Laboratory 11/09 was my last day. Now, I wasn&#8217;t the only admin besides Jenny (thats the aquilino1@llnl.gov email you see there), but she was my closest friend and peer while I was there. There was a little poetic ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mywushublog.com/wp-content/uploads/2011/11/goodbye-llnl-crop.png"><img src="http://www.mywushublog.com/wp-content/uploads/2011/11/goodbye-llnl-crop.png" alt="" title="goodbye-llnl-crop" width="509" height="186" class="aligncenter size-full wp-image-1595" /></a></p>
<p>Well, after about 9 and a half years with Lawrence Livermore National Laboratory 11/09 was my last day. Now, I wasn&#8217;t the only admin besides Jenny (thats the aquilino1@llnl.gov email you see there), but she was my closest friend and peer while I was there. There was a little poetic license there, but it was accurate.</p>
<p>It is hard to quantify the emotions about leaving LLNL. I do not know if I have the appropriate words to describe the feeling.</p>
<p>How about this:</p>
<p>Remember when you left the comfortable confines of high school? That microcosm was your entire world. You had spend the majority of your adolescent life being a part of that world; your friends, you responsibilities, and learning that environment. When you left high school, it was sort of scary, and it was hard to imagine how things would be after leaving high school. The only certainty was the regiment of &#8220;work&#8221; that you learned in school would continue on (hopefully to college).</p>
<p>Its a big scary world out there, and when you are &#8220;institutionalized&#8221; you may not want to leave even if it is time.</p>
<p>This is where I am at. It was time for me to forge a new path in my career, and I was starting to feel a little confined by the Lab&#8217;s philosophy of what I.T. is. I was also feeling a bit over-specialized. Not in what I specifically do, which is *NIX Administration, but things that only a national lab has to deal with. That is a bit more complicated, so despite the fact that I could have made a lifetime out of LLNL, I was not getting the fulfillment I require. I look for technical challenges, not inter-personally communication challenges.</p>
<p>Like high school, I will keep some of the friends I had made there. Also like high school, I will soon find myself in a different environment where my vantage point and perspective will be force to change and adapt to the new culture. There is nothing wrong with that as long as I continue to have a healthy respect for the past, it is after-all what brought me here.</p>
<p>Most importantly, I will have my anchor: the &#8220;work&#8221;. The core of my skill set may be re-balanced for the new job, but it will not fundamentally change and I am happy to accept that.</p>
<p>So far, after two full days have gone by, I&#8217;m pretty excited about the growing list of projects and tasks that we are facing. Renting in a shared house with two other room mates isn&#8217;t so awesome though, I&#8217;ll be a full fledged germaphobe (mysophobia) in no time. I clean my dishes but I sort of freak out of my sponge touches anything else but my dish.</p>
<p>Here is to new adventures!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/11/goodbye-llnl/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Welcome to Antioch</title>
		<link>http://www.mywushublog.com/2011/10/welcome-to-antioch/</link>
		<comments>http://www.mywushublog.com/2011/10/welcome-to-antioch/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 20:39:12 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Family]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[antioch]]></category>
		<category><![CDATA[crime]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1562</guid>
		<description><![CDATA[For a few reasons, I decided to go through the City of Antioch&#8217;s Type I crime reports (available here: http://www.ci.antioch.ca.us/citygov/police/crime-maps/crime-maps.htm). The City only publishes this as a PDF image, comparing the year selected, and the previous year. It also only goes back to 2005. To help view this as a ...]]></description>
			<content:encoded><![CDATA[<p>For a few reasons, I decided to go through the City of Antioch&#8217;s Type I crime reports (available here: <a href="http://www.ci.antioch.ca.us/citygov/police/crime-maps/crime-maps.htm">http://www.ci.antioch.ca.us/citygov/police/crime-maps/crime-maps.htm</a>).</p>
<p>The City only publishes this as a PDF image, comparing the year selected, and the previous year. It also only goes back to 2005.</p>
<p>To help view this as a possible trend, and not just a snapshot in time, I typed up all of them in Google Docs &#8211; <a href="https://docs.google.com/spreadsheet/ccc?key=0Aki2JyKe_ya2dGMwUFV1UU9SVFhPVWdHbWI1NVVDV2c&#038;hl=en_US">City of Antioch Crime Stats</a></p>
<p>It does some some improvement after a few years of growth, it is still however an order of magnitude worse than other cities in California.</p>
<p>According to Homesurfer.com&#8217;s Crime report, even the Sister city to Antioch, Pittsburg had <strong>323</strong> per 100,000 &#8220;incidents&#8221; in one year (2008). While Antioch had <strong>869</strong> per 100,000.</p>
<p>Compare that to places like Moraga which had <strong>35</strong> incidents per 100,000 or heck, even Oakley&#8217;s <strong>248</strong>, which borders Antioch on the eastern side.</p>
<p>Here is a decent table output:</p>
<table border=0 cellpadding=0 cellspacing=0 class='tblGenFixed' id='tblMain'>
<tr class='rShim'>
<td class='rShim' style='width:0;'>
<td class='rShim' style='width:120px;'>
<td class='rShim' style='width:28px;'>
<td class='rShim' style='width:28px;'>
<td class='rShim' style='width:30px;'>
<td class='rShim' style='width:28px;'>
<td class='rShim' style='width:32px;'>
<td class='rShim' style='width:28px;'>
<td class='rShim' style='width:28px;'>
<td class='rShim' style='width:30px;'>
<td class='rShim' style='width:30px;'>
<td class='rShim' style='width:28px;'>
<td class='rShim' style='width:31px;'>
<td class='rShim' style='width:30px;'>
<td class='rShim' style='width:45px;'>
<td class='rShim' style='width:120px;'>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s0'>TYPE
<td  class='s1'>Jan
<td  class='s1'>Feb
<td  class='s1'>Mar
<td  class='s1'>Apr
<td  class='s1'>May
<td  class='s1'>Jun
<td  class='s1'>Jul
<td  class='s1'>Aug
<td  class='s1'>Sep
<td  class='s1'>Oct
<td  class='s1'>Nov
<td  class='s1'>Dec
<td  class='s1'>TOTAL
<td  class='s1'>%CHANGE</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>HOMI
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>1
<td >
<td >
<td >
<td >
<td  class='s4'>4
<td  class='s5'>-69.23%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>5
<td  class='s4'>13
<td  class='s5'>160.00%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>5
<td  class='s5'>-37.50%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>3
<td  class='s4'>8
<td  class='s5'>-20.00%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>10
<td  class='s5'>0.00%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>3
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>10
<td  class='s5'>0.00%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>10
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>RAPE
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>0
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>4
<td  class='s4'>1
<td >
<td >
<td >
<td >
<td  class='s4'>13
<td  class='s5'>-59.38%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>3
<td  class='s4'>2
<td  class='s4'>3
<td  class='s4'>7
<td  class='s4'>4
<td  class='s4'>4
<td  class='s4'>3
<td  class='s4'>2
<td  class='s4'>32
<td  class='s5'>-20.00%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>5
<td  class='s4'>4
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>5
<td  class='s4'>2
<td  class='s4'>5
<td  class='s4'>6
<td  class='s4'>6
<td  class='s4'>1
<td  class='s4'>0
<td  class='s4'>3
<td  class='s4'>40
<td  class='s5'>37.93%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>5
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>5
<td  class='s4'>29
<td  class='s5'>7.41%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>2
<td  class='s4'>3
<td  class='s4'>5
<td  class='s4'>3
<td  class='s4'>0
<td  class='s4'>6
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>0
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>27
<td  class='s5'>-22.86%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>5
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>4
<td  class='s4'>2
<td  class='s4'>6
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>4
<td  class='s4'>35
<td  class='s5'>25.00%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>1
<td  class='s4'>5
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>4
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>5
<td  class='s4'>0
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>3
<td  class='s4'>28
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>ROBB
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>24
<td  class='s4'>21
<td  class='s4'>19
<td  class='s4'>23
<td  class='s4'>22
<td  class='s4'>21
<td  class='s4'>20
<td  class='s4'>26
<td >
<td >
<td >
<td >
<td  class='s4'>176
<td  class='s5'>-43.77%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>23
<td  class='s4'>26
<td  class='s4'>24
<td  class='s4'>37
<td  class='s4'>33
<td  class='s4'>28
<td  class='s4'>32
<td  class='s4'>29
<td  class='s4'>24
<td  class='s4'>21
<td  class='s4'>16
<td  class='s4'>20
<td  class='s4'>313
<td  class='s5'>-0.63%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>21
<td  class='s4'>33
<td  class='s4'>23
<td  class='s4'>27
<td  class='s4'>42
<td  class='s4'>24
<td  class='s4'>32
<td  class='s4'>21
<td  class='s4'>19
<td  class='s4'>25
<td  class='s4'>32
<td  class='s4'>16
<td  class='s4'>315
<td  class='s5'>-20.85%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>25
<td  class='s4'>39
<td  class='s4'>48
<td  class='s4'>42
<td  class='s4'>37
<td  class='s4'>38
<td  class='s4'>27
<td  class='s4'>22
<td  class='s4'>26
<td  class='s4'>40
<td  class='s4'>23
<td  class='s4'>31
<td  class='s4'>398
<td  class='s5'>-3.16%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>34
<td  class='s4'>31
<td  class='s4'>20
<td  class='s4'>32
<td  class='s4'>53
<td  class='s4'>35
<td  class='s4'>31
<td  class='s4'>40
<td  class='s4'>23
<td  class='s4'>26
<td  class='s4'>47
<td  class='s4'>39
<td  class='s4'>411
<td  class='s5'>44.21%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>15
<td  class='s4'>30
<td  class='s4'>22
<td  class='s4'>33
<td  class='s4'>24
<td  class='s4'>16
<td  class='s4'>25
<td  class='s4'>26
<td  class='s4'>26
<td  class='s4'>11
<td  class='s4'>8
<td  class='s4'>49
<td  class='s4'>285
<td  class='s5'>22.84%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>19
<td  class='s4'>18
<td  class='s4'>13
<td  class='s4'>28
<td  class='s4'>14
<td  class='s4'>26
<td  class='s4'>25
<td  class='s4'>21
<td  class='s4'>12
<td  class='s4'>35
<td  class='s4'>10
<td  class='s4'>11
<td  class='s4'>232
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>AGR ASSAULT
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>26
<td  class='s4'>29
<td  class='s4'>47
<td  class='s4'>34
<td  class='s4'>44
<td  class='s4'>34
<td  class='s4'>35
<td  class='s4'>43
<td >
<td >
<td >
<td >
<td  class='s4'>292
<td  class='s5'>-42.29%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>47
<td  class='s4'>27
<td  class='s4'>55
<td  class='s4'>41
<td  class='s4'>43
<td  class='s4'>43
<td  class='s4'>38
<td  class='s4'>47
<td  class='s4'>52
<td  class='s4'>33
<td  class='s4'>34
<td  class='s4'>46
<td  class='s4'>506
<td  class='s5'>-5.77%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>37
<td  class='s4'>39
<td  class='s4'>36
<td  class='s4'>64
<td  class='s4'>49
<td  class='s4'>52
<td  class='s4'>44
<td  class='s4'>46
<td  class='s4'>49
<td  class='s4'>33
<td  class='s4'>50
<td  class='s4'>38
<td  class='s4'>537
<td  class='s5'>22.05%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>36
<td  class='s4'>35
<td  class='s4'>38
<td  class='s4'>27
<td  class='s4'>26
<td  class='s4'>28
<td  class='s4'>42
<td  class='s4'>32
<td  class='s4'>46
<td  class='s4'>50
<td  class='s4'>37
<td  class='s4'>43
<td  class='s4'>440
<td  class='s5'>6.80%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>39
<td  class='s4'>27
<td  class='s4'>30
<td  class='s4'>21
<td  class='s4'>30
<td  class='s4'>37
<td  class='s4'>35
<td  class='s4'>51
<td  class='s4'>45
<td  class='s4'>26
<td  class='s4'>30
<td  class='s4'>41
<td  class='s4'>412
<td  class='s5'>25.99%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>18
<td  class='s4'>27
<td  class='s4'>27
<td  class='s4'>32
<td  class='s4'>28
<td  class='s4'>19
<td  class='s4'>25
<td  class='s4'>36
<td  class='s4'>23
<td  class='s4'>28
<td  class='s4'>12
<td  class='s4'>52
<td  class='s4'>327
<td  class='s5'>15.55%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>14
<td  class='s4'>13
<td  class='s4'>22
<td  class='s4'>14
<td  class='s4'>34
<td  class='s4'>35
<td  class='s4'>25
<td  class='s4'>20
<td  class='s4'>14
<td  class='s4'>38
<td  class='s4'>24
<td  class='s4'>30
<td  class='s4'>283
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>BURG
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>86
<td  class='s4'>87
<td  class='s4'>127
<td  class='s4'>96
<td  class='s4'>113
<td  class='s4'>93
<td  class='s4'>93
<td  class='s4'>103
<td >
<td >
<td >
<td >
<td  class='s4'>798
<td  class='s5'>-26.59%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>98
<td  class='s4'>114
<td  class='s4'>113
<td  class='s4'>89
<td  class='s4'>60
<td  class='s4'>76
<td  class='s4'>75
<td  class='s4'>90
<td  class='s4'>80
<td  class='s4'>77
<td  class='s4'>111
<td  class='s4'>104
<td  class='s4'>1087
<td  class='s5'>31.92%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>42
<td  class='s4'>53
<td  class='s4'>62
<td  class='s4'>93
<td  class='s4'>89
<td  class='s4'>89
<td  class='s4'>56
<td  class='s4'>63
<td  class='s4'>54
<td  class='s4'>64
<td  class='s4'>86
<td  class='s4'>73
<td  class='s4'>824
<td  class='s5'>-10.73%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>76
<td  class='s4'>81
<td  class='s4'>69
<td  class='s4'>58
<td  class='s4'>93
<td  class='s4'>79
<td  class='s4'>66
<td  class='s4'>69
<td  class='s4'>66
<td  class='s4'>88
<td  class='s4'>100
<td  class='s4'>78
<td  class='s4'>923
<td  class='s5'>-10.13%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>79
<td  class='s4'>70
<td  class='s4'>93
<td  class='s4'>104
<td  class='s4'>91
<td  class='s4'>94
<td  class='s4'>73
<td  class='s4'>109
<td  class='s4'>81
<td  class='s4'>78
<td  class='s4'>75
<td  class='s4'>80
<td  class='s4'>1027
<td  class='s5'>22.26%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>69
<td  class='s4'>49
<td  class='s4'>38
<td  class='s4'>67
<td  class='s4'>65
<td  class='s4'>45
<td  class='s4'>62
<td  class='s4'>85
<td  class='s4'>78
<td  class='s4'>40
<td  class='s4'>94
<td  class='s4'>148
<td  class='s4'>840
<td  class='s5'>14.60%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>97
<td  class='s4'>59
<td  class='s4'>49
<td  class='s4'>62
<td  class='s4'>61
<td  class='s4'>71
<td  class='s4'>51
<td  class='s4'>63
<td  class='s4'>45
<td  class='s4'>62
<td  class='s4'>49
<td  class='s4'>64
<td  class='s4'>733
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>THEFT
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>69
<td  class='s4'>82
<td  class='s4'>98
<td  class='s4'>75
<td  class='s4'>72
<td  class='s4'>108
<td  class='s4'>119
<td  class='s4'>120
<td >
<td >
<td >
<td >
<td  class='s4'>743
<td  class='s5'>-29.17%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>79
<td  class='s4'>98
<td  class='s4'>113
<td  class='s4'>94
<td  class='s4'>95
<td  class='s4'>99
<td  class='s4'>90
<td  class='s4'>91
<td  class='s4'>86
<td  class='s4'>53
<td  class='s4'>70
<td  class='s4'>81
<td  class='s4'>1049
<td  class='s5'>-3.05%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>117
<td  class='s4'>137
<td  class='s4'>89
<td  class='s4'>135
<td  class='s4'>74
<td  class='s4'>90
<td  class='s4'>97
<td  class='s4'>85
<td  class='s4'>55
<td  class='s4'>73
<td  class='s4'>48
<td  class='s4'>82
<td  class='s4'>1082
<td  class='s5'>-12.81%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>73
<td  class='s4'>95
<td  class='s4'>93
<td  class='s4'>135
<td  class='s4'>89
<td  class='s4'>91
<td  class='s4'>114
<td  class='s4'>71
<td  class='s4'>86
<td  class='s4'>132
<td  class='s4'>106
<td  class='s4'>156
<td  class='s4'>1241
<td  class='s5'>8.29%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>128
<td  class='s4'>90
<td  class='s4'>126
<td  class='s4'>97
<td  class='s4'>121
<td  class='s4'>91
<td  class='s4'>64
<td  class='s4'>105
<td  class='s4'>64
<td  class='s4'>80
<td  class='s4'>97
<td  class='s4'>83
<td  class='s4'>1146
<td  class='s5'>1.96%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>82
<td  class='s4'>119
<td  class='s4'>109
<td  class='s4'>79
<td  class='s4'>70
<td  class='s4'>58
<td  class='s4'>72
<td  class='s4'>122
<td  class='s4'>81
<td  class='s4'>82
<td  class='s4'>53
<td  class='s4'>197
<td  class='s4'>1124
<td  class='s5'>-11.43%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>134
<td  class='s4'>96
<td  class='s4'>110
<td  class='s4'>90
<td  class='s4'>130
<td  class='s4'>137
<td  class='s4'>83
<td  class='s4'>87
<td  class='s4'>91
<td  class='s4'>117
<td  class='s4'>82
<td  class='s4'>112
<td  class='s4'>1269
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>MVTHEFT
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>76
<td  class='s4'>63
<td  class='s4'>71
<td  class='s4'>71
<td  class='s4'>91
<td  class='s4'>68
<td  class='s4'>67
<td  class='s4'>53
<td >
<td >
<td >
<td >
<td  class='s4'>560
<td  class='s5'>-41.67%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>72
<td  class='s4'>46
<td  class='s4'>117
<td  class='s4'>70
<td  class='s4'>103
<td  class='s4'>50
<td  class='s4'>45
<td  class='s4'>69
<td  class='s4'>74
<td  class='s4'>83
<td  class='s4'>94
<td  class='s4'>137
<td  class='s4'>960
<td  class='s5'>28.51%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>65
<td  class='s4'>39
<td  class='s4'>88
<td  class='s4'>89
<td  class='s4'>72
<td  class='s4'>75
<td  class='s4'>63
<td  class='s4'>59
<td  class='s4'>64
<td  class='s4'>35
<td  class='s4'>55
<td  class='s4'>43
<td  class='s4'>747
<td  class='s5'>8.89%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>74
<td  class='s4'>64
<td  class='s4'>34
<td  class='s4'>71
<td  class='s4'>81
<td  class='s4'>45
<td  class='s4'>37
<td  class='s4'>48
<td  class='s4'>45
<td  class='s4'>51
<td  class='s4'>75
<td  class='s4'>61
<td  class='s4'>686
<td  class='s5'>-27.71%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>90
<td  class='s4'>108
<td  class='s4'>68
<td  class='s4'>76
<td  class='s4'>61
<td  class='s4'>71
<td  class='s4'>74
<td  class='s4'>75
<td  class='s4'>65
<td  class='s4'>84
<td  class='s4'>77
<td  class='s4'>100
<td  class='s4'>949
<td  class='s5'>7.84%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>53
<td  class='s4'>64
<td  class='s4'>74
<td  class='s4'>71
<td  class='s4'>44
<td  class='s4'>69
<td  class='s4'>75
<td  class='s4'>92
<td  class='s4'>74
<td  class='s4'>95
<td  class='s4'>80
<td  class='s4'>89
<td  class='s4'>880
<td  class='s5'>-4.14%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>110
<td  class='s4'>74
<td  class='s4'>66
<td  class='s4'>74
<td  class='s4'>92
<td  class='s4'>94
<td  class='s4'>57
<td  class='s4'>67
<td  class='s4'>46
<td  class='s4'>91
<td  class='s4'>83
<td  class='s4'>64
<td  class='s4'>918
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>ARSON
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>11
<td  class='s4'>5
<td >
<td >
<td >
<td >
<td  class='s4'>30
<td  class='s5'>-18.92%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>2
<td  class='s4'>3
<td  class='s4'>4
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>4
<td  class='s4'>3
<td  class='s4'>10
<td  class='s4'>3
<td  class='s4'>0
<td  class='s4'>1
<td  class='s4'>37
<td  class='s5'>-7.50%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>0
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>8
<td  class='s4'>7
<td  class='s4'>5
<td  class='s4'>4
<td  class='s4'>1
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>4
<td  class='s4'>40
<td  class='s5'>5.26%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>3
<td  class='s4'>3
<td  class='s4'>2
<td  class='s4'>4
<td  class='s4'>6
<td  class='s4'>3
<td  class='s4'>7
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>38
<td  class='s5'>-25.49%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>5
<td  class='s4'>2
<td  class='s4'>8
<td  class='s4'>5
<td  class='s4'>1
<td  class='s4'>8
<td  class='s4'>7
<td  class='s4'>3
<td  class='s4'>7
<td  class='s4'>2
<td  class='s4'>51
<td  class='s5'>-8.93%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>5
<td  class='s4'>1
<td  class='s4'>3
<td  class='s4'>4
<td  class='s4'>5
<td  class='s4'>5
<td  class='s4'>13
<td  class='s4'>3
<td  class='s4'>5
<td  class='s4'>6
<td  class='s4'>4
<td  class='s4'>2
<td  class='s4'>56
<td  class='s5'>27.27%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>2
<td  class='s4'>2
<td  class='s4'>10
<td  class='s4'>5
<td  class='s4'>6
<td  class='s4'>3
<td  class='s4'>1
<td  class='s4'>7
<td  class='s4'>0
<td  class='s4'>5
<td  class='s4'>2
<td  class='s4'>1
<td  class='s4'>44
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>ADULT ARRESTS
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td  class='s4'>0
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>360
<td  class='s4'>308
<td  class='s4'>333
<td  class='s4'>335
<td  class='s4'>386
<td  class='s4'>220
<td  class='s4'>212
<td  class='s4'>346
<td >
<td >
<td >
<td >
<td  class='s4'>2500
<td  class='s5'>-38.23%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>522
<td  class='s4'>282
<td  class='s4'>306
<td  class='s4'>364
<td  class='s4'>357
<td  class='s4'>320
<td  class='s4'>219
<td  class='s4'>245
<td  class='s4'>361
<td  class='s4'>380
<td  class='s4'>268
<td  class='s4'>423
<td  class='s4'>4047
<td  class='s5'>-25.03%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>424
<td  class='s4'>539
<td  class='s4'>535
<td  class='s4'>462
<td  class='s4'>398
<td  class='s4'>390
<td  class='s4'>507
<td  class='s4'>407
<td  class='s4'>458
<td  class='s4'>412
<td  class='s4'>248
<td  class='s4'>618
<td  class='s4'>5398
<td  class='s5'>-6.06%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>535
<td  class='s4'>378
<td  class='s4'>450
<td  class='s4'>418
<td  class='s4'>429
<td  class='s4'>453
<td  class='s4'>558
<td  class='s4'>387
<td  class='s4'>557
<td  class='s4'>491
<td  class='s4'>535
<td  class='s4'>555
<td  class='s4'>5746
<td  class='s5'>14.69%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>323
<td  class='s4'>457
<td  class='s4'>731
<td  class='s4'>417
<td  class='s4'>308
<td  class='s4'>289
<td  class='s4'>504
<td  class='s4'>404
<td  class='s4'>363
<td  class='s4'>364
<td  class='s4'>338
<td  class='s4'>512
<td  class='s4'>5010
<td  class='s5'>12.84%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>272
<td  class='s4'>312
<td  class='s4'>294
<td  class='s4'>408
<td  class='s4'>430
<td  class='s4'>381
<td  class='s4'>564
<td  class='s4'>459
<td  class='s4'>608
<td  class='s4'>319
<td  class='s4'>121
<td  class='s4'>272
<td  class='s4'>4440
<td  class='s5'>-5.97%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>462
<td  class='s4'>277
<td  class='s4'>698
<td  class='s4'>472
<td  class='s4'>433
<td  class='s4'>485
<td  class='s4'>495
<td  class='s4'>561
<td  class='s4'>191
<td  class='s4'>209
<td  class='s4'>181
<td  class='s4'>258
<td  class='s4'>4722
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s2'>JUV ARRESTS
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td >
<td ></tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2011
<td  class='s4'>69
<td  class='s4'>80
<td  class='s4'>92
<td  class='s4'>95
<td  class='s4'>87
<td  class='s4'>79
<td  class='s4'>99
<td  class='s4'>70
<td >
<td >
<td >
<td >
<td  class='s4'>671
<td  class='s5'>-40.93%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2010
<td  class='s4'>103
<td  class='s4'>121
<td  class='s4'>96
<td  class='s4'>127
<td  class='s4'>116
<td  class='s4'>83
<td  class='s4'>47
<td  class='s4'>69
<td  class='s4'>85
<td  class='s4'>113
<td  class='s4'>83
<td  class='s4'>93
<td  class='s4'>1136
<td  class='s5'>-10.48%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2009
<td  class='s4'>94
<td  class='s4'>137
<td  class='s4'>138
<td  class='s4'>117
<td  class='s4'>111
<td  class='s4'>129
<td  class='s4'>79
<td  class='s4'>75
<td  class='s4'>76
<td  class='s4'>105
<td  class='s4'>90
<td  class='s4'>118
<td  class='s4'>1269
<td  class='s5'>-22.43%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2008
<td  class='s4'>128
<td  class='s4'>136
<td  class='s4'>158
<td  class='s4'>193
<td  class='s4'>167
<td  class='s4'>123
<td  class='s4'>154
<td  class='s4'>72
<td  class='s4'>142
<td  class='s4'>113
<td  class='s4'>119
<td  class='s4'>131
<td  class='s4'>1636
<td  class='s5'>6.65%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2007
<td  class='s4'>90
<td  class='s4'>132
<td  class='s4'>204
<td  class='s4'>125
<td  class='s4'>130
<td  class='s4'>172
<td  class='s4'>128
<td  class='s4'>124
<td  class='s4'>83
<td  class='s4'>121
<td  class='s4'>105
<td  class='s4'>120
<td  class='s4'>1534
<td  class='s5'>15.08%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2006
<td  class='s4'>71
<td  class='s4'>75
<td  class='s4'>80
<td  class='s4'>114
<td  class='s4'>150
<td  class='s4'>93
<td  class='s4'>148
<td  class='s4'>147
<td  class='s4'>117
<td  class='s4'>127
<td  class='s4'>48
<td  class='s4'>163
<td  class='s4'>1333
<td  class='s5'>22.07%</tr>
<tr>
<td class=hd>
<p style='height:16px;'>.</td>
<td  class='s3'>2005
<td  class='s4'>91
<td  class='s4'>64
<td  class='s4'>181
<td  class='s4'>114
<td  class='s4'>116
<td  class='s4'>118
<td  class='s4'>110
<td  class='s4'>80
<td  class='s4'>52
<td  class='s4'>63
<td  class='s4'>44
<td  class='s4'>59
<td  class='s4'>1092
<td ></tr>
</table>
<p>I applaud the police department for making a dent over the past two years, and even more so for publishing this data (Concord and Pittsburg did not have this information easily accessible). Even with their effort, I don&#8217;t think I&#8217;ll be hanging around to see if it pays off.</p>
<p>I hope that Antioch becomes a nice bedding community again. The type of place where people like my grandfather, only had to drawn their weapon once during a domestic dispute, and never had to fire it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/10/welcome-to-antioch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FreeBSD Training</title>
		<link>http://www.mywushublog.com/2011/08/freebsd-training/</link>
		<comments>http://www.mywushublog.com/2011/08/freebsd-training/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 01:57:47 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1549</guid>
		<description><![CDATA[At work I ran a 5 part FreeBSD Administration training course for the Unix team. I enjoyed it a lot, because I really like to share information. It is especially rewarding when it is something I have taken a great interest in, like the FreeBSD Operating System. The design of the course ...]]></description>
			<content:encoded><![CDATA[<p>At work I ran a 5 part FreeBSD Administration training course for the Unix team.</p>
<p>I enjoyed it a lot, because I really like to share information. It is especially rewarding when it is something I have taken a great interest in, like the FreeBSD Operating System.</p>
<p>The design of the course was simple, I did my best to fill in the gap that a Solaris or Linux administrator might have. Everyone on the team has experience with Unix, mostly Solaris and Red Hat, so I skipped a lot of the basics.</p>
<p>This was also done in 1.5 hours increments over a few months. None of us had the time to dedicate four or so days in a real class room environment where I could concoct lab exercises. I wish we could have, that would have been GREAT. Alas, I wrote these up in my spare time and put them up on the calendar for the team.</p>
<p>I even created a certificate for those that attended all of them :)</p>
<p>Cert: <a href="http://www.mywushublog.com/wp-content/uploads/2011/08/fbsd-admin-template.pdf">fbsd-admin-template</a></p>
<p>So, here is what I&#8217;m going to do. I think it is important to share, so I converted all of my slides and material into Google&#8217;s Presentation document and made them Public.</p>
<p>Both to read and write.</p>
<p>So, if you feel that there are typo&#8217;s, errors, or something can be added, I want to extend to opportunity to anyone to correct them.</p>
<p>Part1:<br />
<a href="https://docs.google.com/present/edit?id=0AUi2JyKe_ya2ZGNtZmZ3MnhfM2NrenMzaHZ4&#038;hl=en_US">FreeBSD Training #1 &#8211; Introduction</a><br />
Part 2:<br />
<a href="https://docs.google.com/present/edit?id=0AUi2JyKe_ya2ZGNtZmZ3MnhfMTdjdHA0bXRjcQ&#038;hl=en_US">FreeBSD Training #2 &#8211; Software Management</a><br />
Part 3:<br />
<a href="https://docs.google.com/present/edit?id=0AUi2JyKe_ya2ZGNtZmZ3MnhfMzhjMzh4eDdoZw&#038;hl=en_US">FreeBSD Training #3 &#8211; Service Management</a><br />
Part 4:<br />
<a href="https://docs.google.com/present/edit?id=0AUi2JyKe_ya2ZGNtZmZ3MnhfNTg0bm1nNnpjNg&#038;hl=en_US">FreeBSD Training #4 &#8211; Hardware Management</a></p>
<p>The last class was me running through SysInstall. My logic for that was simple, everyone should first know how to install and manage software and services before they begin installing a fresh OS.</p>
<p>There you go Internets, enjoy, and please don&#8217;t add Viagra links in my presentations :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/08/freebsd-training/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bacula in the Enterprise &#8211; Part 2</title>
		<link>http://www.mywushublog.com/2011/07/bacula-in-the-enterprise-part-2/</link>
		<comments>http://www.mywushublog.com/2011/07/bacula-in-the-enterprise-part-2/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 19:10:26 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Bacula]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Jenny]]></category>
		<category><![CDATA[ZFS]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1524</guid>
		<description><![CDATA[Software As mentioned many times, this is a FreeBSD based environment. Some good sysinfo output below: Operating system release: FreeBSD 8.2-RELEASE OS architecture: amd64 Kernel build dir location: /usr/obj/usr/src/sys/GENERIC Currently booted kernel: /boot/kernel/kernel Currently loaded kernel modules (kldstat(8)): zfs.ko opensolaris.ko Bootloader settings for the Director/Database node: The /boot/loader.conf has the ...]]></description>
			<content:encoded><![CDATA[<h1>Software</h1>
<p>As mentioned many times, this is a FreeBSD based environment. Some good sysinfo output below:</p>
<pre>
Operating system release: FreeBSD 8.2-RELEASE
OS architecture: amd64
Kernel build dir location: /usr/obj/usr/src/sys/GENERIC
Currently booted kernel: /boot/kernel/kernel

Currently loaded kernel modules (kldstat(8)):
zfs.ko
opensolaris.ko
</pre>
<p>Bootloader settings for the Director/Database node:</p>
<pre>
The /boot/loader.conf has the following contents:
kern.ipc.semmni=1024
kern.ipc.semmns=2048
kern.ipc.semmnu=1024
</pre>
<p>All of the storage nodes and the director are running a GENERIC kernel with very few system tweaking. One of the storage nodes has a Chelsio 10Gb controller, but that hasn&#8217;t had a high enough load to crack the 1Gb/sec barrier.</p>
<p>I&#8217;m using Bacula from the ports tree, and the directory has a special Make flag to build with gcc&#8217;s debugging symbols. Jenny worked on getting that setup when we were having some stability issues.</p>
<p>The Bacula configuration one the director node is backed by a git repository. It adds a little bit of complexity for a systems administrator, when they want to add a client, but the benefit is clear. This backup project actually enforces change control and tracks all of the commits by who.</p>
<p>I&#8217;ve also setup Redmine as a project front-end, and I&#8217;ve begun to file tickets and reference what commit fixed what. This not only tracks my progress, but it is the first time I&#8217;ve had a backup server that was clearly documented and had some type of accountability.<br />
<div id="attachment_1525" class="wp-caption aligncenter" style="width: 643px"><a href="http://www.mywushublog.com/wp-content/uploads/2011/07/redmine.png"><img src="http://www.mywushublog.com/wp-content/uploads/2011/07/redmine.png" alt="" title="redmine" width="633" height="412" class="size-full wp-image-1525" /></a><p class="wp-caption-text">A snippet of the Redmine site</p></div></p>
<h1>The Structure</h1>
<p>I&#8217;ve compared projects like bacula to a large box of LegosTM. It doesn&#8217;t enforce a structure by any means, and I&#8217;ve taken it upon myself to add meaning to the otherwise flat and incomprehensible bacula-dir.conf</p>
<p>The Bacula Port on FreeBSD installs all configuration files in <strong>/usr/local/etc</strong>.</p>
<p>Write, the Director, only contains the following in /usr/local/etc/bacula-dir.conf:</p>
<pre>
@/usr/local/etc/bacula/bacula-dir.conf
@/usr/local/etc/bacula/storage.conf
@/usr/local/etc/bacula/clients.conf
@/usr/local/etc/bacula/messages.conf
@/usr/local/etc/bacula/schedules.conf
@/usr/local/etc/bacula/pools.conf
</pre>
<p>As you can see, I place everything in etc/bacula/.</p>
<p>Here is a beautiful output of tree(1):</p>
<pre>
bacula
|-- bacula-dir.conf
|-- bin
|   |-- create_client.sh
|   `-- package_list.sh
|-- clients.conf
|-- clients.d
|   |-- 10am
|   |-- 10pm
|   |-- 11pm
|   |-- 12am
|   |-- 1am
|   |-- 2am
|   |-- 3am
|   |-- 4am
|   |-- 4pm
|   |-- 5am
|   |-- 5pm
|   |-- 6am
|   |-- 6pm
|   |-- 7am
|   |-- 7pm
|   |-- 8am
|   |-- 8pm
|   |-- 9am
|   |-- 9pm
|   |-- TEMPLATE-mac
|   |-- TEMPLATE-unix
|   `-- TEMPLATE-win32
|-- excludes.d
|   |-- common.conf
|   |-- mac.conf
|   |-- unix.conf
|   `-- win32.conf
|-- messages.conf
|-- pools.conf
|-- schedules.conf
|-- storage.conf
`-- storage.d
    |-- write-01.conf
    |-- write-02.conf
    |-- write-03.conf
    |-- write-04.conf
    |-- write-05.conf
    `-- write-06.conf
</pre>
<h1>Storage Nodes</h1>
<p>All of the storage nodes are using <strong>ZFS</strong> as the filesystem/Volume manager.</p>
<pre>
write-06# zpool list
NAME         SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
filevol001  90.6T  33.3T  57.3T    36%  ONLINE  -
</pre>
<p>They all have one volume, <strong>/filevol001</strong>, and I created 512 &#8220;drives&#8221; within that volume. Effectivly, each storage node has 512 drives, and clients are randomly assigned a drive.</p>
<p>Since I have 6 storage nodes, I wrote a little shell script to handle the directory creation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">i</span>=<span style="color: #000000;">1</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">-le</span> <span style="color: #000000;">512</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-d</span> <span style="color: #660033;">-o</span> bacula <span style="color: #660033;">-g</span> bacula <span style="color: #660033;">-m</span> <span style="color: #000000;">770</span> <span style="color: #000000; font-weight: bold;">/</span>filevol001<span style="color: #000000; font-weight: bold;">/</span>drive<span style="color: #007800;">$i</span>
        <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Simple, right? I also wrote a script to generate the bacula-sd.conf file on a storage node as well:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
usage<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt; EOF
    Usage $0 NUMBER &gt; /usr/local/etc/bacula-sd.conf
&nbsp;
    Where &quot;NUMBER&quot; is just a single digit indicating which storage node this is.
&nbsp;
    Example, for write-07:
    $ make_sd.sh 7 &gt; /usr/local/etc/bacula-sd.conf
EOF</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">i</span>=<span style="color: #000000;">1</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
    usage
    <span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Storage {<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Name = write-0$1.llnl.gov-sd<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>SDAddress = write-0$1.llnl.gov<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>SDPort = 9103<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>WorkingDirectory = <span style="color: #000099; font-weight: bold;">\&quot;</span>/var/db/bacula<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Pid Directory = <span style="color: #000099; font-weight: bold;">\&quot;</span>/var/run<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Maximum Concurrent Jobs = 516<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;}<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;#<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;# List Directors who are permitted to contact Storage daemon<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;#<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Director {<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Name = write.llnl.gov-dir<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Password = <span style="color: #000099; font-weight: bold;">\&quot;</span>ItsASecret<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;}<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;#<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;# Restricted Director, used by tray-monitor to get the<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;#   status of the storage daemon<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;#<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Director {<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Name = write.llnl.gov-mon<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Password = <span style="color: #000099; font-weight: bold;">\&quot;</span>ItsANotherSecret<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Monitor = yes<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;}<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Messages {<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Name = Standard<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>director = write.llnl.gov-dir = all<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;}<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Device {<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Name = W0$1FileStorage<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Media Type = File<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Archive Device = /filevol001<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>LabelMedia = yes;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Random Access = Yes;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>AutomaticMount = yes;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>RemovableMedia = no;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>AlwaysOpen = no;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Maximum Concurrent Jobs = 2<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;}<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">-le</span> <span style="color: #000000;">512</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;Device {<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Name = W0$1FileStorageD<span style="color: #007800;">$i</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Media Type = File<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Archive Device = /filevol001/drive<span style="color: #007800;">$i</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>LabelMedia = yes;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Random Access = Yes;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>AutomaticMount = yes;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>RemovableMedia = no;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>AlwaysOpen = no;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Maximum Concurrent Jobs = 2<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;}<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>On the Directory, a storage node definition is saved in /usr/local/etc/bacula/storage.d/write-0{N}.conf, which is included in /usr/local/etc/bacula/storage.conf:</p>
<pre>
@/usr/local/etc/bacula/storage.d/write-01.conf
@/usr/local/etc/bacula/storage.d/write-02.conf
@/usr/local/etc/bacula/storage.d/write-03.conf
@/usr/local/etc/bacula/storage.d/write-04.conf
@/usr/local/etc/bacula/storage.d/write-05.conf
@/usr/local/etc/bacula/storage.d/write-06.conf
</pre>
<h1>Client Generation</h1>
<p>There are two components, the TEMPLATE file (there are three, TEMPLATE-unix, TEMPLATE-win32 and TEMPATE-mac) and the shell script.</p>
<h2>The Client TEMPLATE File</h2>
<p>Here is what one of the TEMPLATE files looks like:</p>
<pre>
#
# Client Definition, the Password here must match
#  the clients bacula-fd.conf Client definition.
#
# Using Vi/m, you can easily replaced HOSTNAME with
#  the short hostname of the client with:
#  %s/HOSTNAME/yourhostname/
#
#

Client {
    Name = HOSTNAME.llnl.gov
    Address = HOSTNAME.llnl.gov
    FDPort = 9102
    Catalog = Catalog001
    Password = "ItsASecret"
    File Retention = 40 days
    Job Retention = 1 months
    AutoPrune = yes
    Maximum Concurrent Jobs = 10
    Heartbeat Interval = 300
}

Console {
    Name = HOSTNAME.llnl.gov-acl
    Password = ItsASecret
    JobACL = "HOSTNAME.llnl.gov RestoreFiles", "HOSTNAME.llnl.gov"
    ScheduleACL = *all*
    ClientACL = HOSTNAME.llnl.gov
    FileSetACL = "HOSTNAME.llnl.gov FileSet"
    CatalogACL = Catalog001
    CommandACL = *all*
    StorageACL = *all*
    PoolACL = HOSTNAME.llnl.gov-File
}

Job {
    Name = "HOSTNAME.llnl.gov"
    Type = Backup
    Level = Incremental
    FileSet = "HOSTNAME.llnl.gov FileSet"
    Client = "HOSTNAME.llnl.gov"
    Storage = FileStorageD##
    Pool = HOSTNAME.llnl.gov-File
    Schedule = "@@"
    Messages = Standard
    Priority = 10
    Write Bootstrap = "/var/db/bacula/%c.bsr"
    Maximum Concurrent Jobs = 10
    Reschedule On Error = yes
    Reschedule Interval = 1 hour
    Reschedule Times = 1
    Max Wait Time = 30 minutes
    Cancel Lower Level Duplicates = yes
    Allow Duplicate Jobs = no
    RunScript {
        RunsWhen = Before
        FailJobOnError = no
        Command = "/etc/scripts/package_list.sh"
        RunsOnClient = yes
    }
}

Pool {
    Name = HOSTNAME.llnl.gov-File
    Pool Type = Backup
    Recycle = yes
    AutoPrune = yes
    Volume Retention = 1 months
    Maximum Volume Bytes = 10G
    Maximum Volumes = 100
    LabelFormat = "HOSTNAME.llnl.govFileVol"
    Maximum Volume Jobs = 5
}

Job {
    Name = "HOSTNAME.llnl.gov RestoreFiles"
    Type = Restore
    Client= HOSTNAME.llnl.gov
    FileSet="HOSTNAME.llnl.gov FileSet"
    Storage = FileStorageD##
    Pool = HOSTNAME.llnl.gov-File
    Messages = Standard
    #Where = /tmp/bacula-restores
}

FileSet {
    Name = "HOSTNAME.llnl.gov FileSet"
    Include {
        Options {
            signature = MD5
            compression = GZIP6
                        fstype = ext2
                        fstype = xfs
                        fstype = jfs
                        fstype = ufs
                        fstype = zfs
                        onefs = no
                        Exclude = yes
                        @/usr/local/etc/bacula/excludes.d/common.conf
        }
                File = /
                File = /usr/local
                Exclude Dir Containing = .excludeme
    }
    Exclude {
        @/usr/local/etc/bacula/excludes.d/unix.conf
    }
}
</pre>
<h2>The Create Client Script</h2>
<p>So here is what really makes creating clients easy for us, the create_client script.</p>
<p>I didn&#8217;t want to do it this way, really, so part of me is very ashamed of this tool. I would have preferred to re-write this in Python, or make a web page out of it, and let admins create clients from their desktop. Or, I would have loved to create a puppet module to handle this automagically (but that would exlcude everything that *isn&#8217;t* running Puppet, which is huge).</p>
<p>With that disclaimer, here is my create_client shell script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/env bash</span>
<span style="color: #666666; font-style: italic;"># usage: cclient -t unix -s 12am -h hostname</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">umask</span> 022
&nbsp;
<span style="color: #666666; font-style: italic;"># Variables</span>
<span style="color: #666666; font-style: italic;">## Randomize Schedule</span>
<span style="color: #007800;">SCHEDULES</span>=<span style="color: #ff0000;">&quot;4pm 5pm 6pm 7pm 8pm 9pm 10pm 11pm 12am 1am 2am 3am 4am 5am 6am 7am 8am 9am 10am&quot;</span>
<span style="color: #007800;">s</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$SCHEDULES</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">num_s</span>=<span style="color: #800000;">${#s[*]}</span>
<span style="color: #007800;">RAND_SCHED</span>=<span style="color: #800000;">${s[$((RANDOM%num_s))]}</span>
<span style="color: #666666; font-style: italic;"># Randomize which storage node we use</span>
<span style="color: #007800;">NODES</span>=<span style="color: #ff0000;">&quot;write-06 write-01 write-06 write-01 write-02 write-03 write-04 write-05&quot;</span>
<span style="color: #007800;">n</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$NODES</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">num_n</span>=<span style="color: #800000;">${#n[*]}</span>
<span style="color: #007800;">RAND_NODE</span>=<span style="color: #800000;">${n[$((RANDOM%num_n))]}</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DRIVE</span>=<span style="color: #000000; font-weight: bold;">`</span>jot <span style="color: #660033;">-r</span> <span style="color: #000000;">1</span> <span style="color: #000000;">1</span> <span style="color: #000000;">512</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">BDIR</span>=<span style="color: #ff0000;">&quot;/usr/local/etc/bacula&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">TYPE</span>=<span style="color: #ff0000;">&quot;unix&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">SCHEDULE</span>=<span style="color: #007800;">$RAND_SCHED</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HOSTNAME</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">STORAGE_NODE</span>=<span style="color: #007800;">$RAND_NODE</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_DIR</span>=<span style="color: #ff0000;">&quot;/usr/local/etc/bacula/.git&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLASS</span>=<span style="color: #ff0000;">&quot;desktop&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">whoami</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #ff0000;">&quot;root&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt; EOF
                Please do not run this as root. This script runs a
                git add/commit, which is how changes are managed and
                tracked. If you run this as root, then it shows up
                as carlson39 or root.
&nbsp;
                If you encounter a problem with your normal OUN account,
                please contact Mike Carlson, or submit a bug here:
                https://st-scm.llnl.gov/redmine/snt/projects/bacula/issues/new
EOF</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
usage<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt; EOF
&nbsp;
        Usage: $0 [OPTION]... -h HOSTNAME
&nbsp;
        This script will generate a bacula client definition.
&nbsp;
        OPTIONS:
        -s      schedule, (4pm|5pm|6pm|7pm|8pm|9pm|10pm|11pm|12am|1am|2am|3am|4am|5am|6am|7am|8am|9am). The default schedule is random.
        -t      type, (unix|win32|mac), unix is the default
        -n      storage node (write-01|write-02|...), the default is random.
        -h      hostname (use the short hostname)
EOF</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$BDIR</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">getopts</span> <span style="color: #ff0000;">'c:t:s:n:h:'</span> OPTION
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$OPTION</span> <span style="color: #000000; font-weight: bold;">in</span>
                c<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                        <span style="color: #007800;">CLASS</span>=<span style="color: #007800;">$OPTARG</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
                t<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                        <span style="color: #007800;">TYPE</span>=<span style="color: #007800;">$OPTARG</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
                s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                        <span style="color: #007800;">SCHEDULE</span>=<span style="color: #007800;">$OPTARG</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
                h<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                        <span style="color: #007800;">HOSTNAME</span>=<span style="color: #007800;">$OPTARG</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;(llnl.gov|ucllnl.org)&quot;</span>
                        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
                        <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #007800;">HOSTNAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/.llnl.gov//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/.ucllnl.org//'</span><span style="color: #000000; font-weight: bold;">`</span>
                        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
                        <span style="color: #000000; font-weight: bold;">;;</span>
                n<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                        <span style="color: #007800;">STORAGE_NODE</span>=<span style="color: #007800;">$OPTARG</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
                ?<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                        usage
                        <span style="color: #7a0874; font-weight: bold;">exit</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$CLASS</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$TYPE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$SCHEDULE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$HOSTNAME</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$STORAGE_NODE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
        usage
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-w</span> <span style="color: #007800;">$HOSTNAME</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'client '</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #ff0000;">'already exists...'</span>
<span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">RETRY_COUNT</span>=<span style="color: #ff0000;">&quot;2&quot;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STORAGE_NODE</span> == <span style="color: #ff0000;">&quot;write-01&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
        <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">DRIVE</span>=<span style="color: #000000; font-weight: bold;">`</span>jot <span style="color: #660033;">-r</span> <span style="color: #000000;">1</span> <span style="color: #000000;">33</span> <span style="color: #000000;">512</span><span style="color: #000000; font-weight: bold;">`</span>
                <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/HOSTNAME/'</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #ff0000;">'/g'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/FileStorageD##/FileStorageD'</span><span style="color: #007800;">$DRIVE</span><span style="color: #ff0000;">'/'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/\@\@/'</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #ff0000;">'/'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/RETRY_COUNT/'</span><span style="color: #007800;">$RETRY_COUNT</span><span style="color: #ff0000;">'/g'</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span>TEMPLATE-<span style="color: #007800;">$TYPE</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf
                <span style="color: #7a0874; font-weight: bold;">echo</span> \<span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
        <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">SN</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$STORAGE_NODE</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">7</span>-<span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">`</span>
                <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/HOSTNAME/'</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #ff0000;">'/g'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/FileStorageD##/W'</span><span style="color: #007800;">$SN</span><span style="color: #ff0000;">'FileStorageD'</span><span style="color: #007800;">$DRIVE</span><span style="color: #ff0000;">'/'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/\@\@/'</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #ff0000;">'/'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/RETRY_COUNT/'</span><span style="color: #007800;">$RETRY_COUNT</span><span style="color: #ff0000;">'/g'</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span>TEMPLATE-<span style="color: #007800;">$TYPE</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf
                <span style="color: #7a0874; font-weight: bold;">echo</span> \<span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #c20cb9; font-weight: bold;">chgrp</span> st-bacula-admins <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf
        <span style="color: #c20cb9; font-weight: bold;">git</span> add <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
        <span style="color: #c20cb9; font-weight: bold;">git</span> commit
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'created client definition: '</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SCHEDULE</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'for '</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #ff0000;">'.llnl.gov'</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>This is always a work in progress, but at the core, it is a simple sed wrapper with a lot of randomization and a git commit.</p>
<p>Why all the randomization?</p>
<p>Because I had to add around 1000 clients in a VERY short amount of time. We didn&#8217;t have a problem pushing the Bacula client to all of the platforms, nor the bacula-fd.conf file either. What I could not do was spend the time to create and manage all of the resources for each client. That is why I have so many devices/drives, so I can attempt to have a 1:1 without having to actually think about it.</p>
<p>So, I wrote ANOTHER script to wrap around this one when I need to do bulk client creations. I&#8217;m not going to post that, it just loops through the above command.</p>
<h2>Pre-Job command &#8211; Package List</h2>
<p>I only do this on the Unix/Linux clients, and I thought it was a cool idea. </p>
<p>Yeah, I will pat myself on the back a little bit for that :)</p>
<p>I exclude the Operating System from backups for two reasons, 1) to reduce backing up duplicate and reproducible data and 2) Our build/Imaging process is so quick and clean it is just faster to rebuild than restore everything.</p>
<p>Still, I needed a way to keep the state of installed packages/software.</p>
<p>This is where the pre-job command comes in handy. This part right here:</p>
<pre>
    RunScript {
        RunsWhen = Before
        FailJobOnError = no
        Command = "/etc/scripts/package_list.sh"
        RunsOnClient = yes
    }
</pre>
<p>That package_list.sh file looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">#!/usr/bin/env bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PLIST</span>=<span style="color: #ff0000;">&quot;/root/plist.txt&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`uname -s`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
Linux<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>lsb_release <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #007800;">DIST</span>=<span style="color: #000000; font-weight: bold;">`</span>lsb_release -d<span style="color: #000000; font-weight: bold;">`</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
                <span style="color: #666666; font-style: italic;"># RHEL</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>up2date <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                        rpm <span style="color: #660033;">-qa</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PLIST</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
                <span style="color: #666666; font-style: italic;"># RHEL 5</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>yum <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>yum.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Yum currently in use, exiting gracefully...&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
                        <span style="color: #000000; font-weight: bold;">else</span>
                        <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>yum list installed <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PLIST</span>
                        <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
                <span style="color: #666666; font-style: italic;"># Ubuntu</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">--get-selections</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PLIST</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
FreeBSD<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                pkg_info<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PLIST</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
SunOS<span style="color: #7a0874; font-weight: bold;">&#41;</span>
                pkginfo <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$PLIST</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<p>That file, /root/plist.txt, gets backed up.</p>
<p>Now we have a record of what was installed on our Unix platforms :)</p>
<p>That is it for now, see you at <a href="/#">Part 3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/07/bacula-in-the-enterprise-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bacula in the Enterprise &#8211; Part 1</title>
		<link>http://www.mywushublog.com/2011/07/bacula-in-the-enterprise-part-1/</link>
		<comments>http://www.mywushublog.com/2011/07/bacula-in-the-enterprise-part-1/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 00:45:21 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Bacula]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[ZFS]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1513</guid>
		<description><![CDATA[I&#8217;ve been using Bacula, the open source backup software, for over a year now. Things have been going well, and I would like to dedicate a post or two to the environment I built. Background Over a year ago, I took it upon myself to replace a single Legato Networker ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Bacula, the open source backup software, for over a year now. Things have been going well, and I would like to dedicate a post or two to the environment I built.</p>
<h2>Background</h2>
<p>Over a year ago, I took it upon myself to replace a single Legato Networker server with Bacula. One of our collaborators had decided to ship us (for no reason at all really, I think they were cleaning out their data center) a Sun X4200 AMD server, and two StorageTek/Sun NAS servers.</p>
<p>I had no reason for the NAS heads, but the JBOD was full of drives and the Sun X4200 was useful enough. So, I gutted them (Since the StoragTek NAS heads were identical in almost every way to a standard X4200), put as much memory and CPU&#8217;s as I could in one system. This was my first Bacula server. It had around 2TB of FC storage and it made a nice replacement backup server for the 50 or so clients that were on the Networker server. The OS was not Solaris, as you might guess since I was using Sun hardware, but FreeBSD.</p>
<p>Since was focusing only on disk based backups, and FreeBSD has two fantastic large file systems (UFS2 and ZFS), this was my underlying storage platform. Combine that with the current choice of software (in the case, Bacula 5.0.x and PostgreSQL 8/9) from the Ports tree, it really makes the perfect open source software and hardware stack.</p>
<p>After spending a good amount of time wrapping my head around Bacula, and really, just carelessly diving into it, I was very happy with how fast and stable it was shaping up to be.</p>
<p>Around the same time, I was asked to pick up the project that literally went no where for years: The dreaded Backup Project for all of the S&amp;T directorate. A mix of all OS&#8217;s, desktops, servers, laptops, etc&#8230; and around 3000 active machines online with lots of important data.</p>
<p>No small feat, and there are many reasons why this had been a difficult project to wrangle. One thing for sure, is we knew we had a lot of unique programmatic data.</p>
<p>I knew what software I wanted to use, and I was pretty set on using commodity hardware and reasonably priced storage. The next part was to define some constants in the environment.</p>
<h2>The Initial Concepts</h2>
<p>First up, I knew of the largest painful aspects of our computing environment:</p>
<ol>
<li>Budget constraints &#8211; We are not rich, and IT always seems to be underfunded. This project had to be as frugal as possible, yet still deliver.</li>
<li>Diverse platforms &#8211; We have Windows, OS X and a mix of RHEL and Ubuntu for desktops. Server platforms range all across the board: Windows, OSX, RHEL, Solaris, FreeBSD, AIX, etc&#8230;</li>
<li>Mission critical data &#8211; Lets face it, the Lab doesn&#8217;t make a car, or a VCR. We have a LOT of critical scientific knowledge that is only stored in bits and bytes. That is our product, scientific data that is truly unique.</li>
<li>A campus like geography &#8211;  the Lab is 1 sq. mile with a mixture of trailers, new buildings, and some buildings that are over 50 years old. The network backbone ranges from 10Gbps to 10Mbps. The poses a problem when it comes to backups.</li>
</ol>
<div>With this in mind, theses are some of the initial concepts I latched onto:</div>
<div>
<ul>
<li>A distributed <strong>disk</strong> based storage backend for Bacula</li>
<li>Smaller retention window &#8211; 1 month</li>
<li>Reduce the amount of data that has to even go over the network</li>
<ul style="padding-left: 30px;">
<li>Skip &#8220;reproducible data&#8221; such has installed programs like Office, and exclude the OS itself</li>
<li>Enable client side compression. The effectively distributes the compression for all clients. Saves a lot of disk space :)</li>
</ul>
<li>Skip virtual machine images, like vmdk and vmem files, and treat important virtual machines as separate clients.</li>
</ul>
<div>For Bacula itself, I had decided that each client would have its own resources. Very little is shared between each client, so for example client-001 would get all of these resources:</div>
<ul>
<li>Pool = &#8220;Client-001-File&#8221;</li>
<ul style="padding-left: 30px;">
<li>Storage = a randomly assigned drive on one of the storage nodes</li>
<li>Maximum Volume bytes = 10Gb</li>
<li>Maximum Volumes = 100</li>
<li>AutoPrune and Recycling enabled</li>
</ul>
<li>Job = &#8220;client-001&#8243; (one for backup and one for restore)</li>
<li>FileSet = &#8220;client-001 FileSet&#8221;</li>
</ul>
<p>What this prevents is cross-client data contamination. What is also prevented, and I found out later, was concurrent backups. More on that later though.</p>
<p>After feeling a bit more comfortable with a simple all-in-one server, I was ready to spec out new hardware. This was good, because at the same time it was our end of year budget crunch, and hardware had to be procured.</p>
<h2>The Hardware</h2>
<p>For storage, I had a few concepts I was floating around.</p>
<p>One, was to use MooseFS, a distributed filesystem , across a bunch of cheap node with a modest amount of storage.</p>
<p>The other, idea was to buy a handful of servers with a lot of internal storage, around 18TB or so. Them distribute them across the &#8220;campus&#8221; as a kind of Bacula storage node cloud.</p>
<p>The last idea was to take a more traditional backup server approach, and buy a server with as much expandable storage as possible and back everything up to that.</p>
<p>In the end, when a bunch of hardware showed up (I had *some* control over the hardware, but not all aspects since some of the managers took it upon themselves to purchase everything), I scrapped the MooseFS idea after talking it over with Jenny, and we took the last two: 4 HP servers with 17TB or RAID6 internal storage, and a large 140TB SAN array (Winchester Systems, great stuff!) as the primary backup node:</p>
<p><div id="attachment_1522" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.mywushublog.com/wp-content/uploads/2011/07/Overview.jpg"><img src="http://www.mywushublog.com/wp-content/uploads/2011/07/Overview-300x292.jpg" alt="" title="Overview" width="300" height="292" class="size-medium wp-image-1522" /></a><p class="wp-caption-text">Our Environment</p></div><br />
This model served us well for a while. We had a primary storage node that backed up a users primary desktop, and the smaller storage nodes were used to back up servers and infrastructure data.</p>
<p>There was room for improvement right away though. As soon as it was in production, I quickly mapped out what I felt were the next steps in making a robust backup environment.</p>
<p>More on that in another installment :)</p>
<p><a href="/2011/07/bacula-in-the-enterprise-part-2/">Continue to Part 2&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/07/bacula-in-the-enterprise-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Duplicity</title>
		<link>http://www.mywushublog.com/2011/07/using-duplicity/</link>
		<comments>http://www.mywushublog.com/2011/07/using-duplicity/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 05:04:40 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Duplicity]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1503</guid>
		<description><![CDATA[A while ago, I posted about how I backup my server with Duplicity to Amazon&#8217;s S3 storage. To follow up, here is a little guide I wrote on using Duplicity in the everyday work environment Overview Duplicity is a backup tool that will create compressed and encrypted (uses gnupg) backup ...]]></description>
			<content:encoded><![CDATA[<p>A while ago, I posted about <a href="http://www.mywushublog.com/2009/04/using-amazon-s3-for-backups/">how I backup my server with Duplicity to Amazon&#8217;s S3 storage</a>.</p>
<p>To follow up, here is a little guide I wrote on using Duplicity in the everyday work environment</p>
<h2>Overview</h2>
<p>Duplicity is a backup tool that will create compressed and encrypted (uses gnupg) backup archives. It can use a variety of protocols as the target (file, ftp, webdav, imap, ssh/scp, rsync, hsi, s3 and hsi).</p>
<p>Since it is aware of previous backup jobs, incremental backups from that last full, and some basic collection management, it is preferred over simpler tools like rsync.</p>
<p>Since Duplicity uses GnuPG to compress and encrypt the save sets, you&#8217;ll need to enter a passphrase. This make duplicity a little difficult to automate, you can do one of two things:</p>
<ul>
<li>embed the the gnupg passphrase in the backup job, or use a gnupg-agent</li>
<li>disable encryption and just compress the save set</li>
</ul>
<p>To only compress and not encrypt, use the &#8221;&#8217;&#8211;no-encryption&#8221;&#8217; option.</p>
<h2>Installation</h2>
<p>Duplicity is available in the EPEL channel, so on RHEL 5 systems just type</p>
<pre>yum install duplicity</pre>
<p>On Ubuntu, you can install it using aptitude:</p>
<pre>aptitude install duplicity</pre>
<p>On FreeBSD, you can install it using:</p>
<pre>pkg_add -r duplicity</pre>
<h2>Preparation</h2>
<p>You&#8217;ll need a location to store your archives. Lets assume it is a locally mounted volume at /backups.</p>
<h2>Usage</h2>
<p>The syntax is pretty simple:</p>
<p>duplicity [full|incr|collection-status|list-current-files] source target-url</p>
<p>The &#8216;target-url&#8217; can be one of many protocols:</p>
<ul>
<li>file:///backups</li>
<li>scp://user@host/backups</li>
<li>webdav://user@backup-server/backups/</li>
</ul>
<p>Since we are assuming a locally mounted device, we&#8217;ll use the &#8221;&#8217;file:///&#8221;&#8217; url.</p>
<h3>Full Backups</h3>
<pre>duplicity full ~/ file:///backups/

GnuPG passphrase:
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: none
Retype passphrase to confirm: 

--------------[ Backup Statistics ]--------------
StartTime 1274121911.36 (Mon May 17 11:45:11 2010)
EndTime 1274126391.50 (Mon May 17 12:59:51 2010)
ElapsedTime 4480.14 (1 hour 14 minutes 40.14 seconds)
SourceFiles 53369
SourceFileSize 43240385480 (40.3 GB)
NewFiles 53369
NewFileSize 43240385480 (40.3 GB)
DeletedFiles 0
ChangedFiles 0
ChangedFileSize 0 (0 bytes)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 53369
RawDeltaSize 43219504708 (40.3 GB)
TotalDestinationSizeChange 37539659285 (35.0 GB)
Errors 0
-------------------------------------------------</pre>
<h3>Incremental Backup</h3>
<p>Incremental backups are easy, just replace &#8216;full&#8217; with &#8216;incr&#8217;, and here, we also upped the Gzip compression level to &#8217;9&#8242;</p>
<pre>duplicity incr --gpg-options "-z 9" /home/mcarlson file:///media/0654-E203/backups
GnuPG passphrase:
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Mon May 17 11:45:04 2010
--------------[ Backup Statistics ]--------------
StartTime 1274130893.40 (Mon May 17 14:14:53 2010)
EndTime 1274131032.77 (Mon May 17 14:17:12 2010)
ElapsedTime 139.36 (2 minutes 19.36 seconds)
SourceFiles 53437
SourceFileSize 43628122482 (40.6 GB)
NewFiles 172
NewFileSize 434867245 (415 MB)
DeletedFiles 96
ChangedFiles 58
ChangedFileSize 1175654577 (1.09 GB)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 326
RawDeltaSize 444524537 (424 MB)
TotalDestinationSizeChange 442395156 (422 MB)
Errors 0
-------------------------------------------------</pre>
<h3>Restore</h3>
<p>You can either restore the entire archive with the &#8221;&#8217;restore&#8221;&#8217; option, or a set of files with &#8221;&#8217;files-to-restore&#8221;&#8217;:</p>
<p>Lets assume we did something like this:</p>
<pre>rm -rf FreeBSD</pre>
<p>This was obviously a mistake and we quickly need those files back:</p>
<pre>duplicity --file-to-restore src/FreeBSD file:///backups/ FreeBSD
GnuPG passphrase:
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Mon May 17 11:45:04 2010</pre>
<p>Lets verify that our files are in fact there again:</p>
<pre>ls -al FreeBSD
total 24
drwxr-xr-x  6 mcarlson mcarlson 4096 2009-08-31 15:51 .
drwxrwxr-x 65 mcarlson mcarlson 4096 2010-05-17 16:23 ..
drwxr-xr-x  2 mcarlson mcarlson 4096 2009-08-31 15:51 6.4
drwxr-xr-x  2 mcarlson mcarlson 4096 2009-08-31 15:25 7.0
drwxr-xr-x  2 mcarlson mcarlson 4096 2009-08-31 15:50 8.0
drwxr-xr-x  6 mcarlson mcarlson 4096 2009-08-31 15:52 i386</pre>
<h2>Managing your Archive(s)</h2>
<p>Duplicity does not store any policy or retention details, so it is up the the individual to remove older save sets.</p>
<h3>Collection Status</h3>
<p>First thing you can do is run get a status of your save sets. Duplicity will scan your target-url, in this case &#8216;file:///backups&#8217; and print a simple report on what backups types have ran, the date it was ran at, and the number of files:</p>
<pre>duplicity collection-status file:///media/0654-E203/backups

Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Mon May 17 11:45:04 2010
Collection Status
-----------------
Connecting with backend: LocalBackend
Archive dir: /home/mcarlson/.cache/duplicity/0e6da04424dcfd02a2dae71879be23fa

Found 0 secondary backup chains.

Found primary backup chain with matching signature chain:
-------------------------
Chain start time: Mon May 17 11:45:04 2010
Chain end time: Mon May 17 14:14:48 2010
Number of contained backup sets: 2
Total number of contained volumes: 1447
 Type of backup set:                            Time:      Num volumes:
                Full         Mon May 17 11:45:04 2010              1430
         Incremental         Mon May 17 14:14:48 2010                17
-------------------------
No orphaned or incomplete backup sets found.</pre>
<h3>Collection Pruning</h3>
<p>You can remove older backup archives with &#8221;&#8217;remove-older-than&#8221;&#8217; or &#8221;&#8217;remove-all-but-n-full&#8221;&#8217;, and you can clean out failed save sets with the &#8221;&#8217;cleanup&#8221;&#8217; options.</p>
<p>All of these require the target-url as the 2nd argument.</p>
<p>Here, we will remove any archive that is older than 1 month (1M).</p>
<pre>duplicity remove-older-than 1M file:///backups/

Last full backup date: Sat May  1 00:20:02 2010
There are backup set(s) at time(s):
Thu Apr  1 00:15:17 2010
Sun Apr  4 00:01:23 2010
Sun Apr 11 00:01:29 2010
Which can't be deleted because newer sets depend on them.
Deleting backup sets at times:
Sun Apr 26 12:15:33 2009
Sun Apr 26 14:45:25 2009
Sun Apr 26 14:58:38 2009
Sun May  3 00:01:37 2009
Sun May 10 00:00:39 2009
Sun May 17 00:00:42 2009
Sun May 24 00:00:53 2009
Sun May 31 00:00:50 2009
Sun Jun  7 00:01:04 2009
Sun Jun 14 00:00:55 2009
Sun Jun 21 00:01:17 2009
Sun Jun 28 00:01:10 2009
Sun Jul  5 00:03:09 2009
Sun Jul 12 00:01:10 2009
Sun Jul 19 00:01:18 2009
Sun Jul 26 00:01:52 2009
Sun Aug  2 00:01:27 2009
Sun Aug  9 00:02:39 2009
Sun Aug 16 00:01:52 2009
Sun Aug 23 00:01:33 2009
Sun Aug 30 00:01:42 2009
Sat Sep  5 17:23:02 2009
Sun Sep  6 00:00:41 2009
Sun Sep 13 00:00:47 2009
Sun Mar  7 00:04:47 2010
Sun Mar 14 00:07:12 2010
Sun Mar 21 00:01:36 2010
Sun Mar 28 00:02:14 2010</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/07/using-duplicity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheap Two-Factor Authentication with Google</title>
		<link>http://www.mywushublog.com/2011/07/cheap-two-factor-authentication-with-google/</link>
		<comments>http://www.mywushublog.com/2011/07/cheap-two-factor-authentication-with-google/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 05:29:27 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Google Authenticator]]></category>
		<category><![CDATA[PAM]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1489</guid>
		<description><![CDATA[I can be a glutton for punishment for a nearly trivial amount of gain. So lets bring on the two-factor authentication for my personal FreeBSD server. I&#8217;ve been using Google&#8217;s 2-step verification since Jenny told me about it, along with my android powered phone. What is nice about Google&#8217;s Authenticator ...]]></description>
			<content:encoded><![CDATA[<p>I can be a glutton for punishment for a nearly trivial amount of gain. So lets bring on the two-factor authentication for my personal FreeBSD server.</p>
<p>I&#8217;ve been using Google&#8217;s 2-step verification since <a href="http://jettagirl.workpress.com/">Jenny</a> told me about it, along with my android powered phone.</p>
<p>What is nice about Google&#8217;s Authenticator app is its availability for multiple smartphone platforms:</p>
<ul>
<li>Android version 1.5 or later</li>
<li>BlackBerry OS 4.2 &#8211; 4.7</li>
<li>iPhone iOS 4 or later</li>
</ul>
<p>How it works is pretty simple. First, you have to install the GAuthenticator app form whatever market your smartphone uses. Once you convert your Google account, you are presented with a <a href="http://en.wikipedia.org/wiki/QR_code">QR code</a>, which you can scan with your smart phone. This ties your phone&#8217;s GAuth app to your account.</p>
<p>I&#8217;ve been doing this for the last month or so, and everything has been working out just fine. There are a lot of cool things you can do with this extra layer of authentication. Since not all web services or applications support the verification code generated from your phone, you can have backup passwords (which are only usable once, but great if you don&#8217;t have your phone with you), as well as application passwords. These static and randomly generated passwords are revoke-able.</p>
<p>Alright, so, how does this apply as a cheap way to do two-factor authentication?</p>
<p>Okay, I know, a phone isn&#8217;t exactly cheap. I&#8217;m sure a RSA token, or (expecially) a Gooze token or far more economical if you don&#8217;t already have a iPhone, Android or BB.</p>
<p>A lot of people in IT do have one of these phones, and the app is free. Hence me calling this cheap&#8230;</p>
<p>Anyway, the <a href="http://code.google.com/p/google-authenticator/source/browse/#hg%2Flibpam">Google Authenticator project</a> also has a PAM module, it is really simple and easy to compile/install. Simple check out the mercurial repository and use gmake to compile:</p>
<pre>[server]-[mcarlson] 9:40pm: ~/projects/google-authenticator/libpam&gt;gmake
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o google-authenticator.o google-authenticator.c
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o base32.o base32.c
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o hmac.o hmac.c
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o sha1.o sha1.c
gcc -g   \
              -o google-authenticator google-authenticator.o base32.o hmac.o sha1.o
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o pam_google_authenticator.o pam_google_authenticator.c
pam_google_authenticator.c: In function 'log_message':
pam_google_authenticator.c:69: warning: implicit declaration of function 'pam_get_item'
gcc -shared -g  -o pam_google_authenticator.so pam_google_authenticator.o base32.o hmac.o sha1.o
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o demo.o demo.c
gcc -DDEMO --std=gnu99 -Wall -O2 -g -fPIC -c  -o pam_google_authenticator_demo.o pam_google_authenticator.c
pam_google_authenticator.c: In function 'log_message':
pam_google_authenticator.c:69: warning: implicit declaration of function 'pam_get_item'
gcc -g  -rdynamic                                         \
               -o demo demo.o pam_google_authenticator_demo.o base32.o hmac.o sha1.o
gcc -DTESTING --std=gnu99 -Wall -O2 -g -fPIC -c  -o pam_google_authenticator_testing.o pam_google_authenticator.c
pam_google_authenticator.c: In function 'log_message':
pam_google_authenticator.c:69: warning: implicit declaration of function 'pam_get_item'
gcc -shared -g  -o pam_google_authenticator_testing.so pam_google_authenticator_testing.o base32.o hmac.o sha1.o
gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -o pam_google_authenticator_unittest.o pam_google_authenticator_unittest.c
gcc -g  -rdynamic -lc                                     \
                             \
              -o pam_google_authenticator_unittest pam_google_authenticator_unittest.o base32.o hmac.o sha1.o</pre>
<p><br/>At this point, as root, you can install the two important files:</p>
<pre>[server]-[mcarlson] 9:42pm: ~/projects/google-authenticator/libpam&gt;sudo gmake install
Password:
cp pam_google_authenticator.so /usr/lib
cp google-authenticator /usr/local/bin</pre>
<p><br/>After I did all of this by hand I though &#8220;I should make another Port!!&#8221;</p>
<p>Turns out, I just missed it. On a FreeBSD system, you can install this with a simple:</p>
<pre>$ portinstall security/pam_google_authenticator</pre>
<p><br/>Silly me&#8230;</p>
<p>I decided to only add the PAM object to /etc/pam.d/sshd (here is the diff):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #660033;">---</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pam.d<span style="color: #000000; font-weight: bold;">/</span>sshd     <span style="color: #000000;">2010</span>-06-<span style="color: #000000;">13</span> <span style="color: #000000;">19</span>:09:<span style="color: #000000;">06.000000000</span> <span style="color: #660033;">-0700</span>
+++ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pam.d<span style="color: #000000; font-weight: bold;">/</span>sshd     <span style="color: #000000;">2011</span>-07-<span style="color: #000000;">17</span> <span style="color: #000000;">22</span>:05:<span style="color: #000000;">18.000000000</span> <span style="color: #660033;">-0700</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">9</span>,<span style="color: #000000;">6</span> +<span style="color: #000000;">9</span>,<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">@@</span>
 auth           requisite       pam_opieaccess.so       no_warn allow_local
 <span style="color: #666666; font-style: italic;">#auth          sufficient      pam_krb5.so             no_warn try_first_pass</span>
 <span style="color: #666666; font-style: italic;">#auth          sufficient      pam_ssh.so              no_warn try_first_pass</span>
+auth           required        pam_google_authenticator.so noskewadj
 auth           required        pam_unix.so             no_warn try_first_pass
&nbsp;
 <span style="color: #666666; font-style: italic;"># account</span></pre></div></div>

<p><br/>This PAM plugin is pretty forgiving, if a user has not ran the <strong>/usr/local/bin/google-authenticator</strong> tool, it will gracefully fail and allow for a normal authentication conversation.</p>
<p>When I ran the google-authenticator tool, I was presented a URL (to a QR Code image), and a list of backup codes. I scanned the QR image with my smart phone&#8217;s Google Authenticator app, which tied mcarlson@server.m87-blackhole.org to the one time passcode that my phone now generates.</p>
<p>When I log in to my server now, I get this:</p>
<div id="attachment_1492" class="wp-caption aligncenter" style="width: 620px"><a href="http://www.mywushublog.com/wp-content/uploads/2011/07/pam-google.jpg"><img class="size-full wp-image-1492" title="pam-google" src="http://www.mywushublog.com/wp-content/uploads/2011/07/pam-google.jpg" alt="" width="610" height="246" /></a><p class="wp-caption-text">This server is public facing, so two factor is legitimately safer</p></div>
<p>And my phone has something similar to this:<br />
<div id="attachment_1500" class="wp-caption aligncenter" style="width: 330px"><a href="http://www.mywushublog.com/wp-content/uploads/2011/07/google_authenticator_2.png"><img src="http://www.mywushublog.com/wp-content/uploads/2011/07/google_authenticator_2.png" alt="" title="google_authenticator_2" width="320" height="480" class="size-full wp-image-1500" /></a><p class="wp-caption-text">I&#039;m not alice... or am I?</p></div><br />
Other users are not bothered with this, unless they choose to do so.</p>
<h3>Final Thoughts</h3>
<p>This is a good tool, and more people should consider taking advantage of protecting their identity with really easy tools like this. I started using this because it really hit my how much I rely on my Google account. Not just email, but the calendar, the Music service, plus all of my other online activities like Amazon and domain registration all end up terminating at my gmail account. It would be devastating if it was compromised.</p>
<p>I&#8217;m also a big fan of open source security tools that use well understood approaches and well documented algorithms. That means there are more eyes on it, good and bad, but at least it is out there in the open for everyone to evaluate.</p>
<p>I&#8217;d like to test out a few more things, like can I use the same ~/.google_authenticator file on multiple systems, or do I need one on each system (and therefore, a 1:1 identity mapping on my phone). How well would this work in an environment with a central home directory NFS server?</p>
<p>Chris logged in using ssh keys without being prompted, and that makes also want to test out if this can play alongside ssh keys as well.</p>
<p>I think companies, such as the one I work for, should consider a cheap service like this to help protect public facing servers. If you can provide Blackberrys and iPhones to your employees, it would be nice if they could actually use it for work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/07/cheap-two-factor-authentication-with-google/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.mywushublog.com/author/mike/feed/ ) in 0.88796 seconds, on Feb 5th, 2012 at 11:04 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 5th, 2012 at 12:04 pm UTC -->
