<?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>Masterzen's Blog &#187; Uncategorized</title>
	<atom:link href="http://www.masterzen.fr/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masterzen.fr</link>
	<description>Journey in a software world...</description>
	<lastBuildDate>Sat, 31 Jul 2010 15:48:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Puppet and JRuby a love story!</title>
		<link>http://www.masterzen.fr/2009/05/24/puppet-and-jruby-a-love-story/</link>
		<comments>http://www.masterzen.fr/2009/05/24/puppet-and-jruby-a-love-story/#comments</comments>
		<pubDate>Sun, 24 May 2009 21:55:54 +0000</pubDate>
		<dc:creator>masterzen</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Puppet]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.masterzen.fr/?p=52</guid>
		<description><![CDATA[As announced in my last edit of my yesterday post Puppet and JRuby a love and hate story, I finally managed to run a webrick puppetmaster under JRuby with a MRI client connecting and fetching it&#8217;s config.
The Recipe
Puppet side
Unfortunately Puppet creates its first certificate with a serial number of 0, which JRuby-OpenSSL finds invalid (in [...]]]></description>
			<content:encoded><![CDATA[<p>As announced in my last edit of my yesterday post <a href="http://www.masterzen.fr/2009/05/23/puppet-and-jruby-a-love-and-hate-story/" >Puppet and JRuby a love and hate story</a>, I finally managed to run a <a href="http://www.webrick.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.webrick.org');">webrick</a> puppetmaster under <a href="http://www.jruby.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.jruby.org');">JRuby</a> with a MRI client connecting and fetching it&#8217;s config.</p>
<h2>The Recipe</h2>
<h3>Puppet side</h3>
<p>Unfortunately Puppet creates its first certificate with a <strong>serial number of 0</strong>, which <a href="http://github.com/jruby/jruby-openssl/tree/master" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">JRuby-OpenSSL</a> finds invalid (in fact that&#8217;s <a href="http://www.bouncycastle.org/java.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.bouncycastle.org');">Bouncy Castle JCE Provider</a>). So the first thing is to check if you already have some certificate generated with a serial of 0. If you have none, then everything is great you can skip this.</p>
<p>You can see a certificate content with openssl:</p>
<pre class="syntax-highlight:sh">

% openssl x509 -text -in /path/to/my/puppet/ssl/ca/ca_cert.pem

Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: sha1WithRSAEncryption
Issuer: CN=ca
Validity
Not Before: May 23 18:38:19 2009 GMT
Not After : May 22 18:38:19 2014 GMT
Subject: CN=ca
...
</pre>
<p>If no certificate has a serial of 0, then it&#8217;s OK, otherwise I&#8217;m afraid you&#8217;ll have to start the PKI from scratch (which means rm -rf $vardir/ssl and authenticate clients again), after applying the following Puppet patch:</p>
<pre class="syntax-highlight:ruby">

JRuby fix: make sure certificate serial &gt; 0

JRuby OpenSSL implementation is more strict than real ruby one and
requires certificate serial number to be strictly positive.

Signed-off-by: Brice Figureau &lt;brice-puppet@daysofwonder.com&gt;

diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index 08feff0..4a7d461 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -184,7 +184,7 @@ class Puppet::SSL::CertificateAuthority
# it, but with a mode we can&#039;t actually read in some cases.  So, use
# a default before the lock.
unless FileTest.exist?(Puppet[:serial])
-            serial = 0x0
+            serial = 0x1
end

Puppet.settings.readwritelock(:serial) { |f|
</pre>
<p>I&#8217;ll post this patch to <a href="http://groups.google.com/group/puppet-dev" onclick="javascript:pageTracker._trackPageview('/outbound/article/groups.google.com');">puppet-dev</a> soon, so I hope it&#8217;ll eventually get merged soon in mainline.</p>
<h3>JRuby</h3>
<p>You need the freshest JRuby available at this time. My test were conducted with latest JRuby as of commit &#8220;3aadd8a&#8221;. The best is to clone the <a href="http://github.com/jruby/jruby/tree/master" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">github jruby repository</a>, and build it (it requires of course a JDK and Ant, but that&#8217;s pretty much all).</p>
<p>Then install jruby in your path (if you need assistance for this, I&#8217;m not sure this blog post is for you <img src='http://www.masterzen.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
<h3>JRuby-OpenSSL</h3>
<p>As I explained in my previous blog post about the same subject, Puppet exercises a lot the Ruby OpenSSL subsystem. During this experiment, I found a few shortcomings in the current JRuby-OpenSSL 0.5, including missing methods, or missing behaviors needed by Puppet to run fine.</p>
<p>So to get a fully Puppet enabled JRuby-OpenSSL you need either to get the very latest <a href="http://github.com/jruby/jruby-openssl/tree/master" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">JRuby-OpenSSL from its own github repository </a>(or checkout the <a href="http://github.com/masterzen/jruby-openssl/tree/puppet-fixes" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">puppet-fixes branch of my fork of said repository on github</a>) and or apply manually the following patches on top of the 0.5 source tarballs:</p>
<ul>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3689" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3689</a>: OpenSSL::X509::CRL can&#8217;t be created with PEM content</li>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3690" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3690</a>: OpenSSL::X509::Request can&#8217;t be created from PEM content</li>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3691" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3691</a>: Implement OpenSSL::X509::Request#to_pem</li>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3692" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3692</a>: Implement OpenSSL::X509::Store#add_file</li>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3693" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3693</a>: OpenSSL::X509::Certificate#check_private_key is not implemented</li>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3556" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3556</a>: Webrick doesn&#8217;t start in https</li>
<li><a href="http://jira.codehaus.org/browse/JRUBY-3694" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');">JRUBY-3694</a>: Webrick HTTPS produces some SSL stack trace</li>
</ul>
<p>Then rebuild JRuby-OpenSSL which is a straightforward process (copy build.properties.SAMPLE to build.properties, adjust jruby.jar path, and then issue ant jar to build the jopenssl.jar).</p>
<p>Once done, install the 0.5 JRuby-OpenSSL gem in your jruby install, and copy other the built jar in lib/ruby/gems/1.8/gems/jruby-openssl-0.5/lib.</p>
<h2>Let&#8217;s try it!</h2>
<p>Then it&#8217;s time to run your puppetmaster, just start it with <em>jruby</em> instead of ruby. Of course you need the puppet dependencies installed (Facter).</p>
<p>My next try will be to run Puppet on Jruby and mongrel (or what replaces it in JRuby world), then try with storeconfig on&#8230;</p>
<p>Hope that helps, and for any question, please post in the <a href="http://groups.google.com/group/puppet-dev" onclick="javascript:pageTracker._trackPageview('/outbound/article/groups.google.com');">puppet-dev</a> list.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masterzen.fr/2009/05/24/puppet-and-jruby-a-love-story/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>First post!</title>
		<link>http://www.masterzen.fr/2009/01/11/first-post/</link>
		<comments>http://www.masterzen.fr/2009/01/11/first-post/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 13:24:03 +0000</pubDate>
		<dc:creator>masterzen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.masterzen.fr/?p=4</guid>
		<description><![CDATA[Hi,
Welcome to my personal blog!
What will you find here, might you ask?
Yes, that&#8217;s simple, I intend to post regurlarly about:

Programming
System Administration
Photography
Boardgames
My current Rumblings  

I hope you&#8217;ll enjoy the journey in my universe.
Thanks
]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Welcome to my personal blog!</p>
<p>What will you find here, might you ask?</p>
<p>Yes, that&#8217;s simple, I intend to post regurlarly about:</p>
<ul>
<li>Programming</li>
<li>System Administration</li>
<li>Photography</li>
<li>Boardgames</li>
<li>My current Rumblings <img src='http://www.masterzen.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>I hope you&#8217;ll enjoy the journey in my universe.</p>
<p>Thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masterzen.fr/2009/01/11/first-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.137 seconds -->
