<?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 do I set SSL certificate for Plesk installed inside a Virtuozzo container?]]></title>
<link>http://kb.parallels.com/en/1090</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">How do I set SSL certificate for Plesk installed inside a Virtuozzo container?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 1090&nbsp;</div>
					<div>Last Review: Sep,1 2009</div>
					<tr>
						<td>Author: </td>
						<td>Kolomoets Alexey</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>Kolomoets Alexey</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Virtuozzo Containers for Linux 4.0</li>
							<li>Virtuozzo for Linux 3.x</li>
							<li>Plesk 7.5.x Reloaded</li>
							<li>Plesk 8.x for Linux/Unix</li>
							<li>Plesk 9.x for Linux/Unix</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>
					<p><strong>NOTE: This article is for Virtuozzo 2.6x/3.x/4.x systems with Parallels Plesk Control Panel 7x./8.x/9.x Containers.</strong><br /><br /><strong>For the details on&nbsp; Virtuozzo 3.x/2.6.x version please follow <a href="http://kb.parallels.com#VZ3">this procedure</a>.</strong><br /><strong>For the details on&nbsp; Virtuozzo 3.x/4.x version and Plesk 7.x/8.x/9.x please follow<a href="http://kb.parallels.com#VZ4PLSK7x8x9x"> this </a></strong><a href="http://kb.parallels.com#VZ4PLSK7x8x9x"><strong>procedure</strong></a><strong>.</strong><br /><br />If Parallels Plesk Panel (hereafter Plesk) is installed inside a Parallels Virtuozzo Containers (hereafter Virtuozzo) container and offline management is turned on for that container then all requests to Plesk Panel port 8443 are being intercepted by a Virtuozzo Service Container. So that if you set your own SSL certificate for Plesk Panel with &quot;Secure Control Panel&quot; option, this certificate will not be used but a default SSL certificate installed inside a Virtuozzo Service Container will be used.<br /><br />If you want to set up a separate SSL certificate into a container with Plesk:<br /><br /><br /><a name="VZ3"><strong>For Virtuozzo 3.x/2.6.x version</strong> you may use the following instructions:</a><br /><br />Let assume we have the container #101 with IP address '192.168.1.1' and hostname &quot;plesk.example.com&quot;.<br /><br />1. Take SSL certificate from the container #101, it is accessible as <strong>/vz/root/101/usr/local/psa/admin/conf/httpsd.pem</strong> file on a hardware node and split it to separate files <strong>192.168.1.1.crt</strong> and <strong>192.168.1.1.key</strong> files which contain certificate and private key parts accordingly. Place these files into a Service Container in <strong>/vz/root/1/etc/vzcp</strong> directory.<br /><br />2. Add the following section in the end of <strong>/vz/root/1/etc/vzcp/httpd.conf</strong> file for the Virtuozzo 3.x:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>&lt;VirtualHost 192.168.1.1:8443></span><br /><span style='font-family: courier new,courier;font-size: 12px;'>ServerName &quot;plesk.example.com&quot;</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>ProxyPreserveHost On</span><br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_API_VERSION 30000</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PROXY_MODE 1</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PSA_PORT 8443</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PSA_PROTO https</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PSA_BASE_URL /vz/cp/psa/frameset</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PSA_NOSERV_URL /vz/cp/psa/noservice</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PSA_RESTORE_URL /vz/cp/psa/restore_session</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_PSA_PASSWD_URL /vz/cp/restore-password</span><br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>SSLEngine on</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RewriteEngine on</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RewriteRule ^/?$ /vz/cp/psa/frameset [R]</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RewriteRule ^/vz/cp/?$ /vz/cp/psa/frameset [R]</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RewriteRule ^/login\.php3.*$ /vz/cp/psa/frameset [R]</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RewriteRule ^/(vz|psa|favicon.ico) - [L]</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>RewriteRule ^(/.*)$ http://%{SERVER_ADDR}:8880$1 [P,QSA]</span><br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>SSLCertificateFile &quot;/etc/vzcp/192.168.1.1.crt&quot;</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>SSLCertificateKeyFile &quot;/etc/vzcp/192.168.1.1.key&quot;</span><br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>SetEnv VZCP_PORT 8443</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>SetEnv VZCP_MODE_PLESK yes</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>SetEnv VZCP_PSA_BASE_URL /vz/cp/psa/frameset</span><br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>ErrorDocument 502 &quot;/vz/cp/psa/noservice&quot;</span><br /><span style='font-family: courier new,courier;font-size: 12px;'>&lt;/VirtualHost></span><br /><br />If you need to use CA Certificate, also add SSLCACertificatePath directive and specify the path to the file that contains CA Certificate.<br /><br /><strong>NOTE:</strong> if you have Virtuozzo 2.6.2 installed please change <strong>X_VZCP_API_VERSION</strong> to 20602 so that the corresponding line looks like this:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>RequestHeader set X_VZCP_API_VERSION 20602</span><br /><br />3. You may set the ServerName or check that it is possible to resolve hostname by IP from inside a Service Container. You may add this line into <strong>/etc/hosts</strong> inside a Service Container if needed:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>192.168.1.1 plesk.example.com</span><br /><br />4. Restart the 'vzcp' service inside a Service Container:<br /><div class="commandline"><code># vzctl exec 1 service vzcp restart</code></div><br /><br /><br /><a name="VZ4PLSK7x8x9x"><strong>For Virtuozzo 3.x and 4.x version and Plesk 7.x, 8.x and 9.x</strong>:</a> please download attached <strong><a href="http://kb.parallels.comhttp://kb.parallels.com/Attachments/735/Attachments/ssl_cert_vzplesk.pl.gz">ssl_cert_vzplesk.pl.gz</a></strong> file (see attachments in the bottom of article), extract and run it on Virtuozzo node and follow its instructions:<br /><br /><div class="commandline"><code># gunzip ssl_cert_vzplesk.pl.gz<br /># ./ssl_cert_vzplesk.pl -h</code></div><br /><strong>NOTE: the attached script is working correctly for Parallels Plesk Control Panel 7.x, 8.x, and 9.x. </strong><br /><strong><br /><br /><br />For Virtuozzo 4.x version and Plesk 9.x</strong> you may also use this manual procedure:<br /><br />In this example we assume that we have Virtuozzo Container #101 with hostname &quot;plesk9.example.com&quot; (where Plesk is installed), and with IP addresses &quot;10.0.0.1&quot; and &quot;10.0.0.2&quot;.</p><p>1. It is necessary to obtain first SSL Certificate and Key for the Plesk Container #101, then please save them as file <strong>/etc/vzcp/plesk-$CTID.pem </strong>inside Service Container #1.</p><p>Example of its&nbsp;content:<br /><span style='font-family: courier new,courier;font-size: 12px;'><br /><span style="font-family: Courier New;">[root@HW_NODE ~]# cat /vz/root/1/etc/vzcp/plesk-101.pem<br />-----BEGIN RSA PRIVATE KEY-----<br />...<br />key body here<br />...<br />-----END RSA PRIVATE KEY-----</span></p><p><span style="font-family: Courier New;">-----BEGIN CERTIFICATE-----<br />...<br />certificate body here<br />...<br />-----END CERTIFICATE-----<br /><font face="Arial"></span></font></span></p><p>2. <strong><span style="font-family: Courier New;">/etc/vzcp/addon_httpd_conf/plesk9-ssl.conf</span></strong> file should be created inside Service Container with content like:</p><p><span style="font-family: Courier New;"><font face="Arial"><span style='font-family: courier new,courier;font-size: 12px;'></font><br /># cat /vz/root/1/etc/vzcp/addon_httpd_conf/plesk9-ssl.conf<br />&lt;VirtualHost 10.0.0.1:8443 10.0.0.2:8443><br />&nbsp; ServerName plesk9.example.com</span></p><p><span style="font-family: Courier New;"># mod_proxy must&nbsp; send Host: field from client request to backend as-is<br /># This header used by psa apache for calculate some significant varibles like<br /># server_name<br />&nbsp; ProxyPreserveHost On</span></p><p><span style="font-family: Courier New;"># when turn SSLEnginge OFF, remember correct redirect cookie:<br /># VZCP_PSA_PROTO:http</span></p><p><span style="font-family: Courier New;">&nbsp;RequestHeader set X_VZCP_PROXY_MODE 1<br /># take care about sync &quot;API&quot; and functionality in xsl code.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RequestHeader set X_VZCP_API_VERSION&nbsp;&nbsp;&nbsp; 30000<br />&nbsp; RequestHeader set X_VZCP_PSA_PORT 8443<br />&nbsp; RequestHeader set X_VZCP_PSA_PROTO https<br />&nbsp; RequestHeader set X_VZCP_PSA_BASE_URL&nbsp;&nbsp;&nbsp; /vz/cp/panel/plesk/frameset<br />&nbsp; RequestHeader set X_VZCP_PSA_NOSERV_URL&nbsp; /vz/cp/panel/plesk/noservice<br />&nbsp; RequestHeader set X_VZCP_PSA_RESTORE_URL /vz/cp/panel/plesk/restore_session<br />&nbsp; RequestHeader set X_VZCP_PSA_PASSWD_URL&nbsp; /vz/cp/restore-password</span></p><p><span style="font-family: Courier New;">&nbsp;SSLEngine on<br />&nbsp; SSLCertificateFile &quot;/etc/vzcp/plesk-101.pem&quot;<br />&nbsp; SSLCertificateKeyFile &quot;/etc/vzcp/plesk-101.pem&quot;</span></p><p><span style="font-family: Courier New;">&nbsp;RewriteEngine on<br />&nbsp; RewriteRule ^/?$ /vz/cp/panel/plesk/frameset [R]<br />&nbsp; RewriteRule ^/vz/cp/?$ /vz/cp/panel/plesk/frameset [R]<br />&nbsp; # For correct SSO work the next rule must be replaced by:<br />&nbsp; # RewriteCond %{QUERY_STRING}&nbsp; ^previous_page=login_up<br />&nbsp; # RewriteRule ^/index\.php /vz/cp/panel/plesk/frameset [R]<br />&nbsp; RewriteRule ^/login\.php3.*$ /vz/cp/panel/plesk/frameset [R]<br />&nbsp; RewriteRule ^/(vz|psa|favicon.ico) - [L]<br />&nbsp; RewriteRule ^(/.*)$ </span><a href="http://kb.parallels.comhttp://%{SERVER_ADDR}:8880$1"><span style="font-family: Courier New;">http://%{SERVER_ADDR}:8880$1</span></a><span style="font-family: Courier New;"> [P,QSA]</span></p><p><span style="font-family: Courier New;">&nbsp;SetEnv VZCP_PORT 8443<br />&nbsp; SetEnv VZCP_MODE_PLESK yes<br />&nbsp; SetEnv VZCP_PSA_BASE_URL /vz/cp/panel/plesk/frameset</span></p><p><span style="font-family: Courier New;">&nbsp;ErrorDocument 502 /vz/cp/panel/plesk/noservice<br />&lt;/VirtualHost><br /><font face="Arial"></span></font></span></p><p><br />3. This config file<span style="font-family: Times New Roman;"> </span><span style="font-family: Courier New;"><strong>'plesk9-ssl.conf' </strong></span>should be included in <strong><span style="font-family: Courier New;">/vz/root/1/etc/vzcp/httpd.conf </span></strong>by the following line after including <strong><span style="font-family: Courier New;">'plesk.conf'</span></strong>:<br /><br />&nbsp;<span style="font-family: Courier New;">&nbsp;<font face="Arial"><span style='font-family: courier new,courier;font-size: 12px;'></font>Include /etc/vzcp/addon_httpd_conf/plesk9-ssl.conf<font face="Arial"></span></font><br /></span></p><p>4. Restart Virtuozzo Control Panel service in order to apply changes:</p><p><div class="commandline"><code># vzctl exec2 1 service vzcp restart</code></div></p>
				</div>
				<div class="keywords"><strong>Keywords:</strong> VZPP Plesk SSL offline management Service Container</div>
			</div>
		</div><!-- article-container -->

			<h2>Attachments:</h3>
			<ul class="AttachedFiles">
					<li><a href="http://kb.parallels.com/Attachments/735/Attachments/ssl_cert_vzplesk.pl.gz">ssl_cert_vzplesk.pl.gz</a>(3Kb)</li>
			</ul>

			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1090&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=1090&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' : '1090',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





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

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


]]></description>
<author>Kolomoets Alexey</author>
<guid isPermaLink="false">735 LastUpdated: 2009-09-01 09:12:51</guid>
<pubDate>2008-10-06 09:11:02</pubDate>
</item>
</channel>
</rss>



