<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[How to recompile OpenSSL with increased value of file descriptors larger than FD_SETSIZE (1024) on FreeBSD system?]]></title>
<link>http://kb.parallels.com/en/1177</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">How to recompile OpenSSL with increased value of file descriptors larger than FD_SETSIZE (1024) on FreeBSD system?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 1177&nbsp;</div>
					<div>Last Review: Mar,21 2009</div>
					<tr>
						<td>Author: </td>
						<td>Vitaly Malakhov</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>system</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Plesk 7.0.x</li>
							<li>Plesk 7.5.x Reloaded</li>
							<li>Plesk 7.1.x Reloaded</li>
							<li>Plesk 8.0 for Linux/Unix</li>
							<li>Plesk 6.x</li>
							<li>Plesk 5.x</li>
						</ul>
					</div>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Resolution</h2>
					Apache and apache modules come with Plesk for FreeBSD versions <strong>prior v8.1.0</strong> and are already compiled with FD_SETSIZE = 16384 and if you have problem with file descriptors lack then the reason is in some non-Plesk system application. The most probably it is related to standard system OpenSSL libraries which are dynamically loaded by Plesk's apache. To have the system OpenSSL library files be recompiled with increased FD_SETSIZE value, please do the following.<br /><br />- obtain FreeBSD sources for your FreeBSD version, for example using `<strong>cvsup</strong>` utility. See &quot;Obtaining FreeBSD&quot; in the FreeBSD HandBook for details. We would recommend that you obtain not original sources for exactly the same FreeBSD release that you are currently running, but updated sources from STABLE branch for your FreeBSD version.<br /><br />- edit <strong>/usr/src/sys/sys/select.h</strong> and <strong>/usr/include/sys/select.h</strong> files and modify there <strong>FD_SETSIZE</strong> value from 1024U to to 16384U:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>#ifndef FD_SETSIZE</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>#define FD_SETSIZE 16384U</span><br /><br />File <strong>/usr/include/sys/select.h</strong> is used for third-party software compilations, for example from ports collection, we will not use it at current moment, but it may be useful for you in the future. The file <strong>/usr/src/sys/sys/select.h</strong> will be used by us during our compilations from FreeBSD sources.<br /><br />- run the following commands to recompile all the system files including OpenSSL libraries:<br /><div class="commandline"><code># rm -rf /usr/obj/usr<br /># cd /usr/src<br /># make clean ; make cleandepend<br /># make buildworld</code></div><br />- now actually it is a good chance to update not only OpenSSL libraries but also system binaries and libraries and also update/modify the kernel. If you wish to do this and continue with system/kernel update, please follow &quot;The Cutting Edge&quot; chapter in FreeBSD HandBook for the rest of details.<br /><br />- if your system/kernel is up-to-date or you don't need to update anything except OpenSSL libraries for other reason, you can find what files are used by apache and replace them manually with new copies. Below is example for FreeBSD 6.0:<br /><div class="commandline"><code># ldd /usr/local/psa/apache/bin/httpd<br />/usr/local/psa/apache/bin/httpd:<br />libaprutil-0.so.9 =&gt; /usr/local/psa/apache/lib/libaprutil-0.so.9 (0x281cb000)<br />libapr-0.so.9 =&gt; /usr/local/psa/apache/lib/libapr-0.so.9 (0x281dd000)<br />libm.so.4 =&gt; /lib/libm.so.4 (0x281f8000)<br />libcrypt.so.3 =&gt; /lib/libcrypt.so.3 (0x28211000)<br />libssl.so.4 =&gt; /usr/lib/libssl.so.4 (0x28229000)<br />libcrypto.so.4 =&gt; /lib/libcrypto.so.4 (0x28257000)<br />libz.so.3 =&gt; /lib/libz.so.3 (0x2834e000)<br />libc.so.6 =&gt; /lib/libc.so.6 (0x2835e000)</code></div><br />So that in our FreeBSD 6.0 case these files are<br /><br />/lib/libcrypt.so.3<br />/lib/libcrypto.so.4<br />/usr/lib/libssl.so.4<br /><br />make backup copies of them just in case:<br /><div class="commandline"><code># cp -p /lib/libcrypt.so.3 /lib/libcrypt.so.3.back ; \<br />cp -p /lib/libcrypto.so.4 /lib/libcrypto.so.4.back ; \<br />cp -p /usr/lib/libssl.so.4 /usr/lib/libssl.so.4.back</code></div><br />And replace them with copy newly compiled copies (they are located in /usr/obj/usr/src/ subfolders). If you use remote connection to server console, execute the below commands as a single command (as shown in the example below) as your current ssh connection may be dropped or hang:<br /><div class="commandline"><code># cd /usr/obj/usr/src/ ; \<br />cp ./secure/lib/libcrypto/libcrypto.so.4 /lib/libcrypto.so.4 ; \<br />cp ./secure/lib/libssl/libssl.so.4 /usr/lib/libssl.so.4 ; \<br />chflags noschg /lib/libcrypt.so.3 ; \<br />cp ./lib/libcrypt/libcrypt.so.3 /lib/libcrypt.so.3 ; \<br />chflags schg /lib/libcrypt.so.3</code></div><br />- then reboot the server
				</div>
				<div class="keywords"><strong>Keywords:</strong> FD_SETSIZE apache php freebsd recompile openssl</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1177&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1177&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '1177',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Vitaly Malakhov</author>
<guid isPermaLink="false">821 LastUpdated: 2009-03-21 14:21:21</guid>
<pubDate>2008-10-06 09:11:08</pubDate>
</item>
</channel>
</rss>



