<?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>Web Development Advice and Tips &#187; dos</title>
	<atom:link href="http://blog.smartlogicsolutions.com/tag/dos/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>SmartLogic Solutions Blog</description>
	<lastBuildDate>Thu, 09 May 2013 14:52:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Shell Script to Upgrade Ruby Enterprise Edition while Maintaining Directory Naming Sanity</title>
		<link>http://blog.smartlogicsolutions.com/2009/06/10/shell-script-to-upgrade-ruby-enterprise-edition-while-maintaining-directory-naming-sanity/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/06/10/shell-script-to-upgrade-ruby-enterprise-edition-while-maintaining-directory-naming-sanity/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 01:24:28 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[Passenger]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby Enterprise Edition]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[dos]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=685</guid>
		<description><![CDATA[<p>As you&#8217;re likely already aware, a denial of service (DoS) vulnerability in Ruby&#8217;s BigDecimal library was uncovered, fixed and reported on June 9, 2009. Patching options include: Replacing your current ruby installation with a patched version Installing a gem to patch the code and then updating your application to load the patch. The latter approach [...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2012/07/12/curlin-for-docs/"     class="crp_title">cURLin’ for Docs</a></li><li><a href="http://blog.smartlogicsolutions.com/2013/01/15/guide-to-application-development-infrastructure-pairing-and-ci-servers/"     class="crp_title">Guide to Application Development Infrastructure: Pairing and</a></li><li><a href="http://blog.smartlogicsolutions.com/2012/11/03/rubyconf-2012-links-to-follow-up-on/"     class="crp_title">RubyConf 2012: Links to Follow Up On</a></li><li><a href="http://blog.smartlogicsolutions.com/2013/05/03/4-links-from-railsconf-2013-day-4/"     class="crp_title">4 Links from RailsConf 2013 Day 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2012/09/27/automate-away-the-pain-of-multiple-database-yml-files/"     class="crp_title">Automate Away the Pain of Multiple Database.yml Files</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/" rel="nofollow">Contextual Related Posts</a></li></ul></div></p><p>The post <a href="http://blog.smartlogicsolutions.com/2009/06/10/shell-script-to-upgrade-ruby-enterprise-edition-while-maintaining-directory-naming-sanity/">Shell Script to Upgrade Ruby Enterprise Edition while Maintaining Directory Naming Sanity</a> appeared first on <a href="http://blog.smartlogicsolutions.com">Web Development Advice and Tips</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>As you&#8217;re likely already aware, a denial of service (DoS) vulnerability in Ruby&#8217;s BigDecimal library was <a href="http://blog.phusion.nl/2009/06/10/ruby-enterprise-edition-186-20090610-released-fixes-bigdecimal-dos-vulnerability/">uncovered, fixed and reported on June 9, 2009</a>.  Patching options include:</p>
<ul>
<li>Replacing your current ruby installation with a <a href="http://rubyforge.org/frs/download.php/58677/ruby-enterprise-1.8.6-20090610.tar.gz">patched version</a></li>
<li><a href="http://github.com/NZKoz/bigdecimal-segfault-fix/tree/master">Installing a gem</a> to patch the code and then updating your application to load the patch.</li>
</ul>
<p><span id="more-685"></span></p>
<p>The latter approach only postpones the inevitable, so I opted for the former.  If you&#8217;re using the <a href="http://blog.phusion.nl/2009/06/10/ruby-enterprise-edition-186-20090610-released-fixes-bigdecimal-dos-vulnerability/">debian packages</a>, it&#8217;s a simple call to aptitude update.  However, if you&#8217;ve installed from source, this presents a few challenges.</p>
<p>The upgrade is actually quite straightforward.  According to the <a href="http://www.rubyenterpriseedition.com/documentation.html#_upgrading">REE Documentation</a>, you simply need to run the <a href="http://www.rubyenterpriseedition.com/ruby-enterprise-1.8.6-20090610.tar.gz">new installer</a> over top of your previous installation.  This includes specifying the exact same directory name that you used to install the previous version.</p>
<p>As you may know, REE installs by default into /opt/ruby-enterprise-1.8.6-&lt;year_month_day_release&gt;.  However, after completing this, you&#8217;re left with a directory name that doesn&#8217;t reflect what&#8217;s actually installed in there.  If you&#8217;ve a little neurotic like I am, you&#8217;re going to want to rename that directory.  However, be careful.  Your <a href="http://www.modrails.com/">Passenger</a> configuration is likely pointing to the directory that you want to rename, so you&#8217;ll have to remember to update your apache/nginx configuration to reflect this.</p>
<p>When we install REE we create a symlink at /opt/ruby which points to the version of ruby that we want passenger to run.  This allows us to quickly swap in/out different versions of ruby for testing/upgrading/etc.</p>
<p>Considering we have dozens of client applications running on distinct servers each with their own versions of REE installed, I decided to write a script to minimize the manual effort required to upgrade several production servers.</p>
<pre class="wp-code-highlight prettyprint">
#!/bin/sh
# Author: John Trupiano
# Script to upgrade an REE installation on a hot server and maintain sane directory names

if [ &quot;$(whoami)&quot; != &quot;root&quot; ]; then
  echo &quot;You need to be root to run this!&quot;
  exit 2
fi

RF_RELEASE=58677
REE_VERSION=20090610
REE=ruby-enterprise-1.8.6-$REE_VERSION
URL=http://rubyforge.org/frs/download.php/$RF_RELEASE/$REE.tar.gz

# Determine what the most recent version of REE is that is installed
MOST_RECENT_REE_VERSION=`ls /opt | awk -F&quot;-&quot; &#039;$4 &gt; max &amp;&amp; $2 == &quot;enterprise&quot; { max=$4; maxline=$0 }; END { print max }&#039;`
MOST_RECENT_REE=ruby-enterprise-1.8.6-$MOST_RECENT_REE_VERSION

WORKING_DIR=/root/src

echo &quot;Going to update $MOST_RECENT_REE to $REE&quot;

echo &quot;Back up previous release&quot;
cp -R /opt/$MOST_RECENT_REE /opt/$MOST_RECENT_REE.bak

echo &quot;Download new release&quot;
mkdir -p $WORKING_DIR
cd $WORKING_DIR &amp;&amp; wget $URL

echo &quot;Untar and install over the previous release for &#039;upgrade&#039; according to REE manual&quot;
tar xzf $REE.tar.gz
./$REE/installer --auto /opt/$MOST_RECENT_REE

echo &quot;Shuffle folder names to remain sane&quot;
mv /opt/$MOST_RECENT_REE /opt/$REE &amp;&amp; mv /opt/$MOST_RECENT_REE.bak /opt/$MOST_RECENT_REE

echo &quot;Actually symlink in the new version of REE&quot;
rm /opt/ruby &amp;&amp; ln -s /opt/$REE /opt/ruby

echo &quot;Clean up after ourselves&quot;
rm -f $WORKING_DIR/$REE
</pre>
<p>Simply upload this script to your server, su &#8211; up to root and run it.  Then restart apache/nginx so that passenger will pick up the new version of ruby.  All of your gems will be maintained, and your most recent version of REE will remain in tact at /opt/ruby-enterprise-1.8.6-&lt;old_version&gt; in case you need it again.</p>
<p><a href="http://gist.github.com/127636">View the script on github</a></p>
<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2012/07/12/curlin-for-docs/"     class="crp_title">cURLin’ for Docs</a></li><li><a href="http://blog.smartlogicsolutions.com/2013/01/15/guide-to-application-development-infrastructure-pairing-and-ci-servers/"     class="crp_title">Guide to Application Development Infrastructure: Pairing and</a></li><li><a href="http://blog.smartlogicsolutions.com/2012/11/03/rubyconf-2012-links-to-follow-up-on/"     class="crp_title">RubyConf 2012: Links to Follow Up On</a></li><li><a href="http://blog.smartlogicsolutions.com/2013/05/03/4-links-from-railsconf-2013-day-4/"     class="crp_title">4 Links from RailsConf 2013 Day 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2012/09/27/automate-away-the-pain-of-multiple-database-yml-files/"     class="crp_title">Automate Away the Pain of Multiple Database.yml Files</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/" rel="nofollow">Contextual Related Posts</a></li></ul></div><p>The post <a href="http://blog.smartlogicsolutions.com/2009/06/10/shell-script-to-upgrade-ruby-enterprise-edition-while-maintaining-directory-naming-sanity/">Shell Script to Upgrade Ruby Enterprise Edition while Maintaining Directory Naming Sanity</a> appeared first on <a href="http://blog.smartlogicsolutions.com">Web Development Advice and Tips</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/06/10/shell-script-to-upgrade-ruby-enterprise-edition-while-maintaining-directory-naming-sanity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
