<?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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"><channel><title>Disruptive Library Technology Jester &#187; Gentoo</title> <atom:link href="http://dltj.org/tag/gentoo/feed/" rel="self" type="application/rss+xml" /><link>http://dltj.org</link> <description>We&#039;re Disrupted, We&#039;re Librarians, and We&#039;re Not Going to Take It Anymore</description> <lastBuildDate>Mon, 06 Feb 2012 20:04:22 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <cloud domain='dltj.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' /> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/us/</creativeCommons:license> <item><title>DLTJ In a State of Flux</title><link>http://dltj.org/article/migrated-to-ec2/</link> <comments>http://dltj.org/article/migrated-to-ec2/#comments</comments> <pubDate>Tue, 28 Dec 2010 16:45:54 +0000</pubDate> <dc:creator>Peter Murray</dc:creator> <category><![CDATA[Meta Category]]></category> <category><![CDATA[Amazon EC2]]></category> <category><![CDATA[Gentoo]]></category><guid isPermaLink="false">http://50.16.230.151/?p=1927</guid> <description><![CDATA[DLTJ is in a bit of flux now. After updating some underlying packages on my 9-year-old Gentoo-based personal server, I&#8217;m finding that I can&#8217;t start the web server process without the 1-minute load average climbing to roughly 60 in the &#8230; <a href="http://dltj.org/article/migrated-to-ec2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<abbr class="unapi-id ignore noPrint" title="http://50.16.230.151/?p=1927"></abbr><p><i><acronym title="Disruptive Library Technology Jester">DLTJ</acronym></i> is in a bit of flux now.  After updating some underlying packages on my 9-year-old <a href="http://www.gentoo.org/" title="Gentoo Linux -- Gentoo Linux News">Gentoo</a>-based personal server, I&#8217;m finding that I can&#8217;t start the web server process without the 1-minute load average climbing to roughly 60 in the span of about 5 minutes.  (Translation: the machine is working very hard but getting nowhere fast.)  Increasingly, the server has also been hard to update &#8212; lots of strange errors, etc. &#8212; so after 9 years, it is clearly time to rebuild it.  In the interim, I&#8217;m in the process of moving the blog over to an <a href="http://aws.amazon.com/ec2/" title="Amazon Elastic Compute Cloud (Amazon EC2)">Amazon EC2</a> cloud computing instance.  If you see this post, you are reading it on that virtual server.  The DNS entries should catch up with the migration in a couple of hours.</p><p>Because this wasn&#8217;t necessarily planned, you&#8217;ll see things change a lot.  I&#8217;m still working on theme changes, for instance.  But all the content is migrated over.  If this goes well, perhaps I&#8217;ll leave <i><acronym title="Disruptive Library Technology Jester">DLTJ</acronym></i> in the cloud&#8230;</p>]]></content:encoded> <wfw:commentRss>http://dltj.org/article/migrated-to-ec2/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Gentoo Abandons WordPress in Portage</title><link>http://dltj.org/article/gentoo-abandons-wordpress-in-portage/</link> <comments>http://dltj.org/article/gentoo-abandons-wordpress-in-portage/#comments</comments> <pubDate>Tue, 07 Aug 2007 14:43:05 +0000</pubDate> <dc:creator>Peter Murray</dc:creator> <category><![CDATA[Raw Technology]]></category> <category><![CDATA[Gentoo]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://dltj.org/2007/08/gentoo-abandons-wordpress-in-portage/</guid> <description><![CDATA[I don&#8217;t think this has been widely announced, but while waiting for an update to Gentoo&#8216;s portage entry for WordPress to cover the latest security and bug fixes, I discovered in the comments of a bug in Gentoo&#8217;s bugzilla database &#8230; <a href="http://dltj.org/article/gentoo-abandons-wordpress-in-portage/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<abbr class="unapi-id ignore noPrint" title="http://dltj.org/2007/08/gentoo-abandons-wordpress-in-portage/"></abbr><p>I don&#8217;t think this has been widely announced, but while waiting for an update to <a href="http://www.gentoo.org/" title="Gentoo Linux homepage">Gentoo</a>&#8216;s portage entry for <a href="http://wordpress.org/" title="WordPress homepage">WordPress</a> to cover <a href="http://wordpress.org/development/2007/08/wordpress-222-and-2011/" title="WordPress 2.2.2 and 2.0.11 announcement">the latest security and bug fixes</a>, I discovered in the comments of <a href="http://bugs.gentoo.org/show_bug.cgi?id=168529" title="Gentoo Bug 168529 - www-apps/wordpress" &amp;lt;="2.1.1 AdminPanel CSRF/XSS">a bug in Gentoo&#8217;s bugzilla database</a> that they are making no effort to support WordPress on Gentoo.  I think this is really a poor move on Gentoo&#8217;s part.  As one of the bug commenters noted, &#8220;WordPress is, in general, a good product with an extremely active user community and good upstream maintenance.&#8221; <sup><a href="http://dltj.org/article/gentoo-abandons-wordpress-in-portage/#footnote_0_269" id="identifier_0_269" class="footnote-link footnote-identifier-link" title="Comment  #16 on bug #168529 from Stephen Ulmer dated 2007-03-17 16:09:26 0000 ">1</a></sup></p><p>A <a href="http://www.gentoo.org/security/en/glsa/glsa-200703-23.xml" title="Gentoo Linux Security Advisory -- WordPress: Multiple vulnerabilities"><abbr title="Gentoo Linux Security Advisory">GLSA</abbr> was issued for WordPress vulnerabilities in March</a> &#8212; problems that have since been fixed &#8212; with this &#8216;resolution&#8217;:</p><blockquote><p>Due to the numerous recently discovered vulnerabilities in WordPress, this package has been masked in the portage tree. All WordPress users are advised to unmerge it.</p></blockquote><p>Now I&#8217;ll admit that I should not be expecting updates to packages that have been hard masked, but really &#8212; is this any way to treat the world&#8217;s most popular blogging software?  In any case, I&#8217;ve abandoned Gentoo&#8217;s ebuild for WordPress and have reverted to the <a href="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion" title="Installing/Updating WordPress with Subversion">Subversion method for updating a WordPress installation</a>.  So here is a heads-up to do something similar should you find yourself in the same situation.</p><p>[20070812T2046 update:  The portage keepers <a href="http://bugs.gentoo.org/show_bug.cgi?id=168529#c31" title="Gentoo Bug 168529 - www-apps/wordpress" &lt;="2.1.1 AdminPanel CSRF/XSS">bumped the version of WordPress to 2.2.2</a> in Portage yesterday.]</p><h2>Footnotes</h2><ol class="footnotes"><li id="footnote_0_269" class="footnote"><a href="http://bugs.gentoo.org/show_bug.cgi?id=168529#c16" title="Gentoo Bug 168529 - www-apps/wordpress" &lt;="2.1.1 AdminPanel CSRF/XSS">Comment  #16</a> on bug #168529 from Stephen Ulmer dated 2007-03-17 16:09:26 0000</li></ol>]]></content:encoded> <wfw:commentRss>http://dltj.org/article/gentoo-abandons-wordpress-in-portage/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Killing Off Runaway Apache Processes</title><link>http://dltj.org/article/die-apache-die/</link> <comments>http://dltj.org/article/die-apache-die/#comments</comments> <pubDate>Mon, 26 Feb 2007 22:03:10 +0000</pubDate> <dc:creator>Peter Murray</dc:creator> <category><![CDATA[Meta Category]]></category> <category><![CDATA[Raw Technology]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[Gentoo]]></category> <category><![CDATA[system administration]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://dltj.org/2007/02/die-apache-die/</guid> <description><![CDATA[Well, something is still going wrong on dltj.org &#8212; despite previous performance tuning efforts, I&#8217;m still running into cases where machine performance grinds to a halt. In debugging it a bit further, I&#8217;ve found that the root cause is an &#8230; <a href="http://dltj.org/article/die-apache-die/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<abbr class="unapi-id ignore noPrint" title="http://dltj.org/2007/02/die-apache-die/"></abbr><p>Well, something is still going wrong on <i>dltj.org</i> &mdash; despite <a href="http://dltj.org/2007/02/wordpress-mysql-tuning/">previous performance tuning efforts</a>, I&#8217;m still running into cases where machine performance grinds to a halt.  In debugging it a bit further, I&#8217;ve found that the root cause is an apache httpd process which wants to consume nearly all of real memory which then causes the rest of the machine to <a href="http://en.wikipedia.org/wiki/Thrash_%28computer_science%29" title="Wikipedia: Thrash">thrash</a> horribly.  The problem is that I haven&#8217;t figured out what is causing that one thread to want to consume so much RAM &mdash; nothing unusual appears in either the access or the error logs and I haven&#8217;t figured out a way to debug a running apache thread.  (Suggestions anyone?)</p><div style="border: 1px solid black; color black; background: #EEE"><strong>Found it!</strong> It was a WordPress plug-in plus a change to the PHP configuration that was causing the problem.  The fix for the fundamental cause of the problem came from a comment timestamped February 8th, 2007 at 3:55 pm on the <a href="http://www.elvery.net/drzax/2006/02/10/footnotes-0-9-plugin-for-wordpress-2-0-x/" title="http://www.elvery.net/drzax/2006/02/10/footnotes-0-9-plugin-for-wordpress-2-0-x/">Footnotes 0.9 Plugin for WordPress 2.0.x</a> page.  An infinite loop was consuming both CPU cycles and RAM, and this was exacerbated by a change I made to the maximum CPU execution time for PHP scripts that was required in order to play with the <a href="http://blog.vimagic.de/ip-city-cluster-wordpress-plugin/" title="WordPress &amp;rsaquo; Error">IP City Cluster plug-in</a>.  With the patch to the Footnotes plug-in, <i>dltj.org</i> has gone 12 hours without a run-away apache process.</div><p>In any case, I whipped up this little ditty that is running every five minutes in cron as a way to gloss over the problem for the moment.  Running as root, it looks into all of the processes in the <a href="http://en.wikipedia.org/wiki/Procfs" title="Wikipedia: procfs">virtual /proc file system</a>, specifically in the &#8216;stat&#8217; file, and using <a href="http://en.wikipedia.org/wiki/AWK_%28programming_language%29" title="Wikipedia: AWK">awk</a> looks to see if the second space-delimited value is the name of the httpd process (this is the <a href="http://www.gentoo.org/" title="Gentoo Linux -- Gentoo Linux News">Gentoo Linux</a> distribution, so the name of the process is <tt>apache2</tt>) and the 23rd space-delimited value (the virtual size of the process) is bigger than 800MB.  If so, it prints out the PID of the process (the first value in the <tt>stat</tt> file) at which the bash script unceremoniously sends it a <tt>kill</tt> (&#8216;-9&#8242;) signal.  The script looks like this:</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;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>-<span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">*`</span>; <span style="color: #000000; font-weight: bold;">do</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: #007800;">$i</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">stat</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">pid</span>=<span style="color: #000000; font-weight: bold;">`/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ if ($2 == &quot;(apache2)&quot; &amp;amp;&amp;amp; $23 &amp;gt; 800000000) print $1}'</span> <span style="color: #007800;">$i</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">stat</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: #ff0000;">&quot;<span style="color: #007800;">$pid</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</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;">&quot;Killing <span style="color: #007800;">$pid</span> because of load average: <span style="color: #780078;">`awk '{print $1}' /proc/loadavg`</span>&quot;</span>
                        <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #007800;">$pid</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div><p>If anyone has any suggestions as to how to narrow down what the problem might be, I&#8217;d appreciate hearing from you.  I&#8217;ve tried eliminating WordPress plugins, recompiling WordPress and Apache, and attempted to catch the behavior with a network traffic sniffer, but have come up empty so far.</p>]]></content:encoded> <wfw:commentRss>http://dltj.org/article/die-apache-die/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>WordPress/MySQL Tuning</title><link>http://dltj.org/article/wordpress-mysql-tuning/</link> <comments>http://dltj.org/article/wordpress-mysql-tuning/#comments</comments> <pubDate>Thu, 22 Feb 2007 18:56:45 +0000</pubDate> <dc:creator>Peter Murray</dc:creator> <category><![CDATA[Meta Category]]></category> <category><![CDATA[Raw Technology]]></category> <category><![CDATA[Gentoo]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[system administration]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://dltj.org/2007/02/wordpress-mysql-tuning/</guid> <description><![CDATA[dltj.org runs on a relatively tiny box &#8212; a Pentium III with 512MB of RAM. I&#8217;m running a Gentoo Linux distribution, so I actually have a prayer of getting useful work out of the machine (it server is actually a &#8230; <a href="http://dltj.org/article/wordpress-mysql-tuning/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<abbr class="unapi-id ignore noPrint" title="http://dltj.org/2007/02/wordpress-mysql-tuning/"></abbr><p><i>dltj.org</i> runs on a relatively tiny box &mdash; a Pentium III with 512MB of RAM.  I&#8217;m running a <a href="http://www.gentoo.org/" title="Gentoo Linux homepage">Gentoo</a> Linux distribution, so I actually have a prayer of getting useful work out of the machine (it server is actually a recycled Windows desktop), but the performance just wasn&#8217;t great.  As it turns out, there are several easy things one can do to dramatically improve life.</p><p><h2>The Configuration</h2><br />The box is both a mail server (IMAP) and a WordPress server.  A rough eyeball at the process accounting on the server shows that it spends about 40% of the time doing mail (mostly taken up by Clamscan virus scanning and spam checking) and another 40% doing MySQL and web stuff.  Since there isn&#8217;t much dynamic content on the box and nothing else using the database but WordPress, I&#8217;m fairly confident that blog traffic is almost all of that 40%.  I&#8217;m using MySQL 5.0.x, Apache 2.0.x and WordPress 2.0.x with about two dozen plugins.</p><p><h2>Taking PHP Up A Notch</h2><br />PHP is an interpreted programming language, meaning that each time a script runs it needs to be translated into something closer to machine code (called the &#8216;opcode&#8217;).  (As opposed to compiler languages like C and Java where you compile the source code into an executable in one step and then run that executable in a second step.)  For an application like WordPress, where the source code is not changing, this translation causes a lot of overhead.  Fortunately, there is a PHP plug-in called the <a href="http://php.net/apc" title="Alternative PHP Cache home page">Alternative PHP Cache</a> that will saved the translated opcode the first time the script runs and use it for subsequent invocations.  Getting this set up is pretty easy (these are Gentoo-specific commands, your Linux distribution will vary and I am glossing over a number of distribution-specific details like how to install packages and where the configuration files will reside):</p><ol><li><code>emerge -aDNtuv pecl-apc</code> will download and install PHP APC and its dependencies (yep &#8212; that easy&#8230;I <em>love</em> Gentoo)</li><li>Change the configuration defaults in <code>/etc/php/apache2-php5/ext/apc.ini</code>.  I&#8217;ve found that one shared segment of 20MB is enough, so I set <code>apc.shm_size="20"</code>.  The rest of the settings are as they came in the distribution.</li><li>Restart your web server: <code>/etc/init.d/apache2 restart</code></li></ol><p>APC comes with a nifty PHP page that will give you cache statistics and details.  If you copy <code>/usr/share/php5/apc/apc.php</code> into your &#8216;htdocs&#8217; somewhere and execute that page from a browser, you&#8217;ll see what I mean.  (This is how I learned that 20MB of opcode cache space was fine for my application.)</p><p><h2>Kicking MySQL Into Gear</h2><br />Database tuning focuses a great deal on memory management.  Your RAM will always be an order of magnitude faster than reading blocks off a disk.  RAM, of course, costs more per MB than disk, though, so you have to select memory management strategies carefully.  WordPress is, of course, a read-intensive operation.  In other words, the majority of SQL statements are SELECTs rather than INSERTs, UPDATEs, or DELETEs.  With that in mind, we tune MySQL with a read-intensive strategy.  I found some of the best guidance in <a href="http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/" title="What to tune in MySQL Server after installation from MySQL Performance Blog"> Peter Zaitsev&#8217;s &#8220;What to tune in MySQL Server after installation&#8221;</a> and the ez.no documentation on <a href="http://ez.no/community/articles/tuning_mysql_for_ez_publish/optimizing_for_read_performance" title="">Optimizing for read performance</a>.</p><p>The changes I made to my MySQL configuration file, in the <code>[mysqld]</code> section are:</p><pre>key_buffer = 6M ; (Actually, a decrease from the default since I didn't seem to need as much)table_cache = 512max_connections = 25thread_cache = 16query_cache_type = 1query_cache_limit = 1Mquery_cache_size = 20M</pre><p>The 20MB query cache limit seems to be just about the right size for me.  I seem to get very close to the edge of that buffer, but never seem to go over.</p><p><h2>Finishing Up with a WordPress Plug-in</h2><br />One more thing is needed to make this all come together: Mark Jaquith&#8217;s <a href="http://txfx.net/code/wordpress/post-query-accelerator/" title="Post Query Accelerator WordPress Plug-in Homepage">Post Query Accelerator</a>.  As Mark points out on his blog, WordPress &#8220;always ask[s] for posts with post_date_gmt &lt;= &#8216;$now&#8217; where $now is set to the current time, to prevent posts in the future from showing up.&#8221;  If one turns on cache querying as described above, the &#8220;problem with $now is that it changes [with each query], so the query is never exactly the same again and the cache doesn’t help.&#8221;  Mark&#8217;s plug-in &#8220;freezes&#8221; the value of $now to 15 minute increments or to whenever a post is added/updated, which ever comes first.  That makes the query cache useful again and all is well.</p><p>Simply download the plug-in from Mark&#8217;s page and enable it in WordPress.  Note that this plug-in is not needed for WordPress 2.1 and higher as the core developers have solved the &#8220;$now&#8221; problem with the &#8220;future&#8221; post status.</p>]]></content:encoded> <wfw:commentRss>http://dltj.org/article/wordpress-mysql-tuning/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Managing a Gentoo Linux Server Configuration with Subversion, GLCU, and Trac</title><link>http://dltj.org/article/gentoo-config-subversion-glcu-trac/</link> <comments>http://dltj.org/article/gentoo-config-subversion-glcu-trac/#comments</comments> <pubDate>Fri, 22 Dec 2006 17:49:00 +0000</pubDate> <dc:creator>Peter Murray</dc:creator> <category><![CDATA[DRC]]></category> <category><![CDATA[Raw Technology]]></category> <category><![CDATA[Gentoo]]></category> <category><![CDATA[Subversion]]></category> <category><![CDATA[system administration]]></category><guid isPermaLink="false">http://dltj.org/2006/12/gentoo-config-subversion-glcu-trac/</guid> <description><![CDATA[Keeping track of configuration changes to servers is a tough job made tougher when some of the sysadmins work from home. Questions of who did what when and why can be exacerbated by the lack of physical proximity &#8212; in &#8230; <a href="http://dltj.org/article/gentoo-config-subversion-glcu-trac/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<abbr class="unapi-id ignore noPrint" title="http://dltj.org/2006/12/gentoo-config-subversion-glcu-trac/"></abbr><p>Keeping track of configuration changes to servers is a tough job made tougher when some of the sysadmins work from home.  Questions of who did what when and why can be exacerbated by the lack of physical proximity &mdash; in other words, I can&#8217;t simply yell over the cubical wall to the colleague down the hall to ask him about the new package installed on the server.  Besides, that oral history tradition is difficult to maintain and harder to sustain as the number of machines grows.  This essay describes a practice for maintaining a <a href="http://www.gentoo.org/" title="Gentoo Linux distribution homepage">Gentoo Linux distribution</a> using GLCU, Subversion, and Trac that is lightweight (doesn&#8217;t impose a large burden on the sysadmin staff), effective (although it is lightweight it better documents and makes accessible the state of our systems over the oral history tradition), and cheap (no operating budget dollars were harmed in the creation of this process &mdash; only staff time overhead).</p><p><h2>Create an All-Encompassing Configurations Directory</h2><br />The first step is to put the system configuration files into a revision control system (RCS).  An RCS allows us to track the history of files by storing information about changes such as the date/time a change was made, what the change was, who made it, and a free-text field explaining why the change was made.  RCS systems are common for software development shops as a way to track changes to source code.  In this circumstance we are tracking changes to the text configuration files that make up the operating system and its components.  We are using the <a href="http://subversion.tigris.org/" title="Subversion RCS homepage">Subversion</a> RCS, but the same concepts apply whether you are using other systems (such as CVS or Arch).</p><p>The RCS will want to act on a single directory tree, but in most cases our configuration files are spread out over the file system.  Most are in /etc, but others exist elsewhere.  (The portage &#8220;world&#8221; file, a record of everything installed on your system, for instance, is in /var/lib/portage.)  What we do is create a directory called /server-rcs that will be managed by the RCS, and in that directory is copies or links to all of the configuration files on the system.</p><p><h3>Putting /etc (or any other directory) Under Version Control</h3><br />One of the things we&#8217;re going to want to do, obviously, is put the entire /etc directory into the RCS.  Ideally, we would simply put a link to /etc in /server-rcs.  Unfortunately, we can&#8217;t use the simple filesystem-based linking methods (soft links and hard links) because a) our RCS is smart enough to see the soft link and <a href="http://subversion.tigris.org/faq.html#symlinks" title="Subversion FAQ">records it as a soft link in the revision control database</a> rather than following the link to the contents of that directory; and b) one cannot make a hard link to a directory:</p><div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">/server-rcs # ln ../etc .
ln: `../etc': hard link not allowed for directory</pre></div></div><p>What we need to do instead is a trick using the &#8216;<span class="removed_link" title="http://gentoo-wiki.com/MAN_mount_8">mount</span>&#8216; command to <i>bind</i> one portion of the file system to another part.  From the mount MAN page:</p><blockquote><p>Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is</p><pre>mount --bind olddir newdir</pre><p>After this call the same contents is accessible in two places. One can also remount a single file (on a single file).</p></blockquote><p>So we can bind the entire /etc directory into our RCS space with this command:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">--bind</span> <span style="color: #000000; font-weight: bold;">/</span>etc <span style="color: #000000; font-weight: bold;">/</span>server-rcs<span style="color: #000000; font-weight: bold;">/</span>etc</pre></div></div><p>Better yet, we put this in our /etc/fstab file (also adding the /var/spool/cron directory as well):</p><pre>/etc                            /system-rcs/etc                         none    bind/var/spool/cron/crontabs        /system-rcs/var-spool-cron-crontabs     none    bind</pre><p>Since the /etc directory (and other directories) already exist, we&#8217;re going to have to play some games to get them into the repository.  For the trick do to this with Subversion, see <a href="http://subversion.tigris.org/faq.html#in-place-import" title="Subversion FAQ">the FAQ entry on in-place imports</a>.</p><p><h3>Handling Individual Files Under Version Control</h3><br />Not everything we want to track is in /etc or neatly packaged into directories.  Some application-specific configuration files, most notably web applications, exist somewhere else in the directory structure.  We want to track things like the &#8216;phpmyadmin&#8217; configuration file, for instance.</p><p>We could use the mount &#8216;bind&#8217; trick to put individual files into the /server-rcs space, but that seems overly complicated.  Our servers are generally configured with few filesystems, so in many cases the files we need to track in the RCS are within the same filesystem and we can use hard links to put them into the /server-rcs directory.  Another alternative is to write a cron job to copy configuration files into the /server-rcs directory, but then realize that this kind of revision control is one way &mdash; if we restore a previous version of a file from the RCS, we need to manually copy it back to the original location.</p><p>(On the other hand, using the mount &#8216;bind&#8217; method is a form of self-documenting the otherwise invisible hard links to files in the same filesystem.  For that reason, it might be worth considering that option.)</p><p><h3>Special Case:  /var/lib/portage/world</h3><br />One special case is the portage &#8216;<span class="removed_link" title="http://gentoo-wiki.com/MAN_emerge#lbAN">world</span>&#8216; file.  This file records all of the user-specified (e.g. non-profile) packages that have been installed on your Gentoo system.  Unfortunately, each time &#8216;<span class="removed_link" title="http://gentoo-wiki.com/MAN_emerge_1">emerge</span>&#8216; runs, the world file is rewritten and the order of package names is seemingly random.  This wrecks havoc with the &#8216;diff&#8217; function of the RCS &mdash; it seems like a lot more has changed than just the addition or removal of a package or two.</p><p>What we do instead is patch into a hook of the &#8216;emerge&#8217; command that will save a sorted copy of the world file into /server-rcs.  This patch goes into <code>/etc/portage/profile/profile.bashrc</code>:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${EBUILD_PHASE}</span>&quot;</span> == <span style="color: #ff0000;">&quot;setup&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;">sort</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>portage<span style="color: #000000; font-weight: bold;">/</span>world <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>server-rcs<span style="color: #000000; font-weight: bold;">/</span>misc<span style="color: #000000; font-weight: bold;">/</span>var-lib-portage-world
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div><p>Every time &#8216;emerge&#8217; goes through the &#8216;setup&#8217; mode when installing a package, it will run this sort command.  Note that there is no file locking going on here, so there is a remote chance that the /server-rcs version (but not the /var/lib/portage version) could get corrupted.  Such a problem is minor, though, and easily fixed.</p><p><h3>Importing into Subversion</h3><br />With the /server-rcs directory prepared, we now just need to get it into the RCS.  These are Subversion commands:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> add <span style="color: #660033;">--force</span> <span style="color: #000000; font-weight: bold;">/</span>server-rcs
<span style="color: #c20cb9; font-weight: bold;">svn</span> checkin <span style="color: #660033;">--message</span> <span style="color: #ff0000;">&quot;Importing the configuration files for the server&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>server-rcs https:<span style="color: #000000; font-weight: bold;">//</span>svn.repository.url<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>configurations<span style="color: #000000; font-weight: bold;">/</span>server</pre></div></div><p>Because of the in-place import problem for pre-existing directories (described earlier), we likely had to create some of the repository directory structure already.  (In this example, we would have executed a <code>svn mkdir https://svn.repository.url/svn/configurations/server/etc</code> command already to &#8220;prime the pump&#8221; for adding /etc to the repository.)  In line #1, the &#8211;force option makes the &#8216;svn add&#8217; command continue the recursive directory parse to add files and directories to the RCS structure even if some component of those paths were already in the RCS structure.  Line #2 checks in our completed /server-rcs directory.</p><p><h2>Daily Usage</h2><br />With all of this setup done, it is finally time to make use of this configuration management infrastructure.  Doing so is pretty easy &mdash; work as you normally do when installing packages and making changes to configuration files.  (As you do so, you also have the added safety net of <code>svn revert <i>filename</i></code> should you make a mistake and want to go back to the previous version of a file.)  When you&#8217;ve done a defined chunk of work, simply run this command:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> status <span style="color: #000000; font-weight: bold;">/</span>server-rcs
<span style="color: #c20cb9; font-weight: bold;">svn</span> checkin <span style="color: #000000; font-weight: bold;">/</span>server-rcs <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Free-text description of why you made the changes.&quot;</span></pre></div></div><p>The first line will show you the files modified since the last check-in &#038;mdash hopefully only the files you intended to modify, although this is a good point to check to make sure an inadvertent change didn&#8217;t happen.  The second line will copy changes to the /server-rcs directory into the RCS along with the free-text note describing why you made the change.</p><p>Isn&#8217;t this great?  It is sort of self-documenting.  Not only to you have your brief description of what you did but you also have the exact changes made to the configuration files.  If a change doesn&#8217;t work out, you have easy access to past configurations that allow you to revert back to a previous state.  (Note, though, that we&#8217;re not saving actual applications in the RCS &mdash; you may have to recompile and install older versions of applications to get back to the previous state.)</p><p><h3>Portage Updates with GLCU</h3><br />We can make our system management lives even easier by using the semi-automated tool <a href="http://glcu.sourceforge.net/" title="Gentoo Linux Cron Update (GLCU) hompage">Gentoo Linux Cron Update</a> (GLCU).  This script breaks up the process of updating packages into two pieces.  The first that runs in the off-hours via cron that syncs the local portage copy, download and compiles updated packages, and stages ready-to-install binary distributions of those updates.  The second piece has the human interface:  seeing the list of updated packages in the staging area, selecting which to install, and prompting the sysadmin to install any updates as a result of Gentoo Linux Security Announcements (GLSAs).</p><p>See the <a href="http://glcu.sourceforge.net/" title="Gentoo Linux Cron Update (GLCU) hompage">project on SourceForge</a> for all of the details on installing, configuring and running GLCU.  We make one tweak to the GLCU configuration to prompt the sysadmin to complete all of the housekeeping chores:  running <code>dispatch-conf</code> to merge changes to configuration files and <code>revdep-rebuild</code> to make sure all of the applications using updated linked libraries are properly recompiled.  To do this, add a line to <code>/etc/conf.d/glcu</code>:</p><pre>updatetc: dispatch-conf &#038;&#038; revdep-rebuild -X -pv</pre><p>A typical update for us looks like:</p><pre># glcu /tmp/glcuUpdate-23112****************************************&gt;&gt; Welcome to glcu's easy update featurePrebuilt packages:------------------(  1 ) [binary     U ] app-editors/nano-2.0.1 [1.3.12-r1] USE="ncurses nls spell unicode  -debug -justify -minimal -slang"(  2 ) [binary     U ] media-libs/libsdl-1.2.11 [1.2.8-r1] USE="X esd* -aalib -alsa -arts  -dga -directfb -fbcon -ggi -libcaca -nas -noaudio -noflagstrip -nojoystick -novideo  -opengl -oss -svga -xinerama -xv (-pic%)" Do you want to install the prebuilt package(s) [Y/n]   (or you can either install only specified package number(s) #,     or NOT install package with -# and use i# for injecting)&gt; y[...pre-compiled packages are installed...]&gt;&gt;&gt; Auto-cleaning packages...&gt;&gt;&gt; No outdated packages were found on your system. * GNU info directory index is up-to-date.* IMPORTANT: 1 config files in /etc need updating.* Type emerge --help config to learn how to update config files.glsa's:  ['200612-03'](  1 ) 200612-03 [N] GnuPG: Multiple vulnerabilities ( app-crypt/gnupg ) Do you want to fix all glsa's now? [Y/n]    (or you can either install only specified glsa number(s) #,     or NOT install glsa with -# and use i# for injecting)&gt; y[...packages related to the GLSA are downloaded, compiled and installed...] Do you want to run dispatch-conf &#038;&#038; revdep-rebuild -X -pv now? [Y/n] &gt; y[...dispatch-conf and revdep-rebuild are run...]</pre><p>With the system nicely updated, we can check in all of the changes to the RCS with a note about what we did:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;After running 'glcu' to update app-editors/nano, media-libs/libsdl, and GLSA for app-crypt/gnupg&quot;</span></pre></div></div><p><h3>Tracking Configuration Changesets and Trouble Tickets with Trac</h3><br />So far we&#8217;ve done quite a lot to document changes to the configuration of our server.  What we&#8217;re missing is a nice way to view and track those changes over time.  Since everything is in the Subversion RCS, one way to accomplish this is to put a web interface (like ) on top of Subversion repository.  For just a little bit more effort and complexity, though, we can have a very nice documentation and issue tracking system bundled with the display of our configuration changes repository by using <a href="http://trac.edgewall.org/" title="The Trac Project - Trac">Trac</a>.</p><p>Trac is an open source wiki and issue tracking system for software development projects.  Its stated mission is to  &#8220;help developers write great software while staying out of the way.&#8221;  In this case we&#8217;ll be using it to help sysadmins manage complex systems while staying out of the way.  Trac is a web-based tool that &#8220;allow wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all &#8230; events in order, making the acquisition of an overview of the [state of the system] and tracking progress very easy.&#8221;</p><p>Trac is synchronized with our Subversion source code repository, so the <a href="http://trac.edgewall.org/wiki/TracTimeline" title="TracTimeline help page from the Trac project">timeline of changes</a> (<a href="http://trac.edgewall.org/timeline" title="Timeline help page from the Trac project">demo</a>) shows each <a href="http://trac.edgewall.org/wiki/TracChangeset" title="TracChangeset help page from the Trac project">check in to the Subversion RCS</a> (<a href="http://trac.edgewall.org/changeset/4501" title="Demonstration of Trac Changesets">demo</a>), which can be tied to an <a href="http://trac.edgewall.org/wiki/TracTickets" title="TracTickets help page from the Trac project">issue ticket</a> (<span class="removed_link" title="Demonstration of Trac Issue Tickets">demo</span>) for a problem or task that is requested, worked on, then closed via simple wiki-like markup.  One can also <a href="http://trac.edgewall.org/wiki/TracBrowser" title="TracBrowser help page from the Trac project">browse through the stored changes</a> (<a href="http://trac.edgewall.org/browser/trunk/htdocs/css/trac.css?rev=4501" title="Demonstration of Trac RCS Browser">demo</a>) and look at a <a href="http://trac.edgewall.org/wiki/TracRevisionLog#InspectingChangesBetweenRevisions" title="TracRevisionLog - The Trac Project - Trac">graphical difference between any two revisions of a file</a> (<span class="removed_link" title="http://trac.edgewall.org/changeset?new=trunk%2Fhtdocs%2Fcss%2Ftrac.css%404501&amp;old=trunk%2Fhtdocs%2Fcss%2Ftrac.css%404390">demo</span>) but also review the <a href="http://trac.edgewall.org/wiki/TracRevisionLog" title="TracRevisionLog help page from the Trac project">log of check in messages</a> (<a href="http://trac.edgewall.org/log/trunk/htdocs/css/trac.css?rev=4501" title="Demonstration of Trac Revision Logs">demo</a>) associated with that file over time.</p><p><h2>Conclusion</h2><br />With a few tools and some modest changes to current system maintenance practices, the history of the configuration of machines can be documented and the changes viewed over time.  The changes in practices are designed to be very minimal and simple yet return a large payoff over time if consistently followed.  The practices also enhance communication between geographically dispersed staff tasked with managing the same platforms by regularly creating snapshots of the configuration state and documenting who did what changes and why.<p style="padding:0;margin:0;font-style:italic;" class="removed_link">The text was modified to remove a link to Demonstration of Trac Issue Tickets on December 30th, 2010.</p><p style="padding:0;margin:0;font-style:italic;" class="removed_link">The text was modified to remove a link to http://gentoo-wiki.com/MAN_emerge_1 on January 19th, 2011.</p><p style="padding:0;margin:0;font-style:italic;" class="removed_link">The text was modified to remove a link to http://gentoo-wiki.com/MAN_mount_8 on January 19th, 2011.</p><p style="padding:0;margin:0;font-style:italic;" class="removed_link">The text was modified to remove a link to http://gentoo-wiki.com/MAN_emerge#lbAN on January 19th, 2011.</p><p style="padding:0;margin:0;font-style:italic;" class="removed_link">The text was modified to remove a link to http://trac.edgewall.org/changeset?new=trunk%2Fhtdocs%2Fcss%2Ftrac.css%404501&#038;old=trunk%2Fhtdocs%2Fcss%2Ftrac.css%404390 on January 19th, 2011.</p>]]></content:encoded> <wfw:commentRss>http://dltj.org/article/gentoo-config-subversion-glcu-trac/feed/</wfw:commentRss> <slash:comments>15</slash:comments> </item> <item><title>OpenLDAP with a Go Daddy &#8220;Turbo SSL Secure Certificate&#8221;</title><link>http://dltj.org/article/openldap-with-intermediary-cert/</link> <comments>http://dltj.org/article/openldap-with-intermediary-cert/#comments</comments> <pubDate>Sat, 09 Sep 2006 03:16:23 +0000</pubDate> <dc:creator>Peter Murray</dc:creator> <category><![CDATA[Raw Technology]]></category> <category><![CDATA[Gentoo]]></category> <category><![CDATA[Go Daddy]]></category> <category><![CDATA[openldap]]></category> <category><![CDATA[ssl]]></category> <category><![CDATA[tls]]></category><guid isPermaLink="false">http://dltj.org/2006/09/openldap-with-intermediary-cert/</guid> <description><![CDATA[Okay &#8212; this seemed like a lot harder than it should have been. At the very least, it took piecing together information from a number of places in order to make it happen. The goal is to use a Go &#8230; <a href="http://dltj.org/article/openldap-with-intermediary-cert/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<abbr class="unapi-id ignore noPrint" title="http://dltj.org/2006/09/openldap-with-intermediary-cert/"></abbr><p>Okay &#8212; this seemed like a lot harder than it should have been.  At the very least, it took piecing together information from a number of places in order to make it happen.  The goal is to use a Go Daddy <a href="https://www.godaddy.com/gdshop/ssl/turbo.asp?se=%2B&#038;app%5Fhdr=&#038;ci=1858">Turbo SSL Secure Certificate</a> (the $19.95/year one) to secure an OpenLDAP server.  On the surface, this shouldn&#8217;t be so hard.  The tricky part comes because the requested SSL cert is not signed by a recognized Certificate Authority root; instead, Go Daddy uses an <em>intermediary certificate</em> and the tricky part is making sure the whole chain of SSL certificates line up properly.  There is a wealth of documentation for using intermediary certificates with web servers, but I found very little for OpenLDAP servers.  I hope by posting this into the blogosphere you will find it useful someday, too.</p><p><br /><h2>Environment</h2><br />The servers are running the <a href="http://www.gentoo.org/" title="Gentoo Linux -- Gentoo Linux News">Gentoo</a> distribution of Linux.  The critical bits out of portage are <a href="http://gentoo-portage.com/net-nds/openldap" title="Gentoo-Portage - net-nds/openldap">OpenLDAP</a> (version 2.3.24-r1), <a href="http://gentoo-portage.com/dev-libs/openssl" title="Gentoo-Portage - dev-libs/openssl">OpenSSL</a> (version 0.9.8c), <a href="http://gentoo-portage.com/sys-auth/nss_ldap" title="Gentoo-Portage - sys-auth/nss_ldap">nss_ldap</a> (version 249), and <a href="http://gentoo-portage.com/sys-auth/pam_ldap" title="Gentoo-Portage - sys-auth/pam_ldap">pam_ldap</a> (version 180).  On Monday I&#8217;m going to ask OhioLINK&#8217;s resident Redhat Fedora Core expert to try the equivalent on that distribution.  (I&#8217;ve put him through so much trouble already that I hope this process goes smoothly from here on out.)  You&#8217;ll need to get all of those and their prerequisites installed and configured on your machine.  There is a <span class="removed_link" title="http://gentoo-wiki.com/HOWTO_LDAPv3">HOWTO LDAPv3 on the Gentoo Wiki</span> and <a href="http://wiki.debian.org/LDAP/OpenLDAPSetup" title="OpenLDAPSetup - Debian Wiki">another on the Debian Wiki</a> plus <a href="http://www.saas.nsw.edu.au/solutions/ldap-auth-pam.html" title="LDAP authentication using pam_ldap and nss_ldap" class="broken_link" rel="nofollow">numerous</a> <a href="http://www.howtoforge.com/linux_ldap_authentication" title="LDAP Authentication In Linux | HowtoForge - Linux Howtos and Tutorials">other</a> <a href="http://www.ofb.net/~jheiss/krbldap/howto.html" title="Replacing NIS with Kerberos and LDAP HOWTO">documents</a> out there to help you get started.  When you&#8217;ve had enough fun beating your head up against that wall and have got basic LDAP-based account management to work, you can come back here.</p><p><h2>The Certificate</h2><br />I picked the Go Daddy <a href="https://www.godaddy.com/gdshop/ssl/turbo.asp?se=%2B&#038;app%5Fhdr=&#038;ci=1858">Turbo SSL Secure Certificate</a> because, well, it&#8217;s cheap.  As their own marketing literature says &#8212; why pay a couple hundred dollars for something when Go Daddy will give you the equivalent thing for $19.95?  To be completely fair, Go Daddy offers two types of certificates:  the Turbo SSL one that we&#8217;ll be using and the <a href="https://www.godaddy.com/gdshop/ssl/high.asp?se=%2B&#038;app%5Fhdr=&#038;ci=1859">High-Assurance Secure Certificate</a>.  The difference is in the verification process.  The former verifies only the domain name and control of that domain name by sending e-mail to the WHOIS administrative contact to confirm that the certificate request is legitimate.  The latter is a manual verification process that looks at the domain name and control of that domain name as well as verifies identity of requesting person or company and the authority to make request.  The latter is probably overkill for our uses and costs $89.99.</p><p>So go through the modestly convoluted process of generating the Certificate Signing Request (CSR), giving Go Daddy your $19.95, requesting the certificate, have the request approved by your DNS zone administrator, receive the e-mail of the signed certificate from Go Daddy, and then come back here.</p><p><h2>OpenLDAP&#8217;s &#8216;slapd.conf&#8217; Server Setup</h2><br />So here is the really tricky part (where &#8220;tricky&#8221; is defined as the piece that took me the longest to figure out).  As I said in the introduction, Go Daddy uses an intermediary certificate to form a chain from one of the highly-trusted root certificates.  The key to making this work becomes getting the intermediary certificate into the evaluation chain at the right time so the client can see it an trust the server.  It is possible to install the intermediary certificate on all of the clients who might someday make use of our server&#8217;s certificate, but we would, ideally, like the server to offer the client the certificate and let the client do all of the cryptology to determine whether the server can be trusted.  This section describes what it takes to make that happen.</p><p>First, one has to go to the <a href="https://certificates.godaddy.com/Repository.go">Go Daddy Secure Certificate Services Repository</a>.  Many of the directions I found for getting the intermediary certificate working with web servers said to download the intermediate certificate alone (or, as Go Daddy calls it, the <code>sf_issuing.crt</code> file).  I found this didn&#8217;t work &mdash; rather, the &#8220;Root Bundle&#8221; (or <code>ca_bundle.crt</code> file) is what is needed.</p><p>[Updated 20070904T1104 : It looks like Go Daddy changed their certificate chain last month.  What you need now is called "gd_bundle.crt" from the Go Daddy certificate repository -- you'll find it under the heading "New Go Daddy Certificate Chain" (at least that is where you'll find it today).]</p><p>Then add this to your <code>slapd.conf</code> file:</p><pre>TLSCipherSuite HIGH:MEDIUM:+SSLv2# Your signed CSR that you got back from Go DaddyTLSCertificateFile /etc/ssl/certs/ldap.ohiolink.crt# The private key file for the certificateTLSCertificateKeyFile /etc/ssl/certs/ldap.ohiolink.key# The "Root Bundle" file from Go Daddy's Certificates RepositoryTLSCACertificateFile /etc/ssl/certs/ca_bundle.crt</pre><p>Next, move onto the client side.  (Your LDAP server also has the client libraries installed &#8212; you&#8217;ll likely want to start there.)</p><p><h2>OpenLDAP&#8217;s &#8216;ldap.conf&#8217; Client Setup</h2><br />In case you haven&#8217;t discovered it by now, there are two &mdash; count &#8216;em, <em>two</em> &mdash; <code>ldap.conf</code> files on your box.  One is read by tools derived from the OpenLDAP package and the other is for the pam_ldap/nss_ldap combination.  And to make things even more interesting &#8212; the syntax of the files are not the same!  Boy, sometimes I really dislike the profession I&#8217;m in&#8230;</p><p>So let&#8217;s start with OpenLDAP&#8217;s <code>ldap.conf</code> file; you&#8217;ll likely find this in the <code>/etc/openldap</code> directory.  (At least that is where you&#8217;ll find it with Gentoo &#8212; YMMV.)  In that file, you&#8217;ll want to put these pieces:<br />[code]<br />BASE            dc=ohiolink,dc=edu<br />URI             ldap://ldap.ohiolink.edu/<br />TLS_CACERTDIR   /etc/ssl/certs<br />TLS_REQCERT     demand<br />[/code]<br />You&#8217;ll, of course, want to replace the BASE and URI parameters with the ones most appropriate for your installation.  I&#8217;ve found that third line to be somewhat unexpectedly important, however.  The OpenLDAP libraries need to know where to go to find the trusted root certificates, and so you need to specify the path where they exist on your system.  These got installed with OpenSSL, which you needed back in &#8220;The Certificate&#8221; stage when you generated the CSR.  Again, these are in <code>/etc/ssl/certs</code> on a typically-configured Gentoo box; you might find them elsewhere in other distributions.</p><p><h2>NSS/PAM&#8217;s &#8216;ldap.conf&#8217; Client Setup</h2><br />This is the <em>other</em> <code>ldap.conf</code> file, and on a Gentoo system you&#8217;re likely to find it in the <code>/etc</code> directory.  Remember &mdash; the file name is the same but the directives are different.  You&#8217;ll use much of the knowledge from the previous section here&#8230;you&#8217;ll just need to change the preceding labels:<br />[code]<br />suffix "dc=ohiolink,dc=edu"<br />uri ldap://ldap.ohiolink.edu<br />sslpath /etc/ssl/certs<br />ssl start_tls<br />[/code]<br />See the similarity? <code>base</code> becomes <code>suffix</code>, <code>tls_cacertdir</code> becomes <code>sslpath</code>, and so forth.  There will likely be much more in this file &#8212; <code>pam_login_attribute</code>, <code>nss_base_passwd</code>, and more.  Follow a more comprehensive set of directions to get those pieces right.</p><p><h2>Testing</h2><br />To test to see if the SSL certificate is really securing the connection, you can use the <code>-ZZ</code> parameter (to force an SSL/TLS interaction with the server) on <code>ldapsearch</code> with the debugging level set in order to see some of the protocol interaction.  I find that this command is most instructive:<br />[code]<br />ldapsearch -d 9 -ZZ -h ...ldap.server.address.net...<br />[/code]<br />You can scroll back and make sure that the SSL/TLS-secured connection was, in fact being used.  You can also turn up debugging on the server and look at the server log files to verify the same thing.</p><p><h2>Conclusion</h2><br />So there you go.  I hope you find this useful.  I also hope that if you find it in error, you&#8217;ll let me know.  (Although, at the moment, this does seem to be working for us.  Perhaps it only works because I have faith that it will work.  If so, please be gentle when you tell me I&#8217;ve made an error&#8230; <img src='http://cdn.dltj.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )<p style="padding:0;margin:0;font-style:italic;" class="removed_link">The text was modified to remove a link to http://gentoo-wiki.com/HOWTO_LDAPv3 on January 19th, 2011.</p><p style="padding:0;margin:0;font-style:italic;">The text was modified to update a link from http://wiki.debian.org/OpenLDAPSetup to http://wiki.debian.org/LDAP/OpenLDAPSetup on January 19th, 2011.</p>]]></content:encoded> <wfw:commentRss>http://dltj.org/article/openldap-with-intermediary-cert/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> </channel> </rss>
<!-- Served from: dltj.org @ 2012-02-11 09:39:48 by W3 Total Cache -->
