<?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>LosByers- Interesting Musings Helpful Hints from a Unix System Administrator &#187; apache</title>
	<atom:link href="http://losbyers.com/wordpress/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://losbyers.com/wordpress</link>
	<description>All the info I need</description>
	<lastBuildDate>Wed, 01 Sep 2010 19:48:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Exporting Tomcat SSL keys to Apache httpd</title>
		<link>http://losbyers.com/wordpress/2009/12/exporting-tomcat-ssl-keys-to-apache-httpd/</link>
		<comments>http://losbyers.com/wordpress/2009/12/exporting-tomcat-ssl-keys-to-apache-httpd/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 20:41:37 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Web Related]]></category>
		<category><![CDATA[Windows OS]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=98</guid>
		<description><![CDATA[<p>Apache Tomcat SSL keys created with keytool are, by default, in der format. These keys cannot be used in Apache httpd since httpd, be default, expects the keys in pem(X509) format. Using the below steps you can export the tomcat&#8217;s keys to Apache httpd format and use it for Apache.</p>
<p>I assume that you already have [...]]]></description>
			<content:encoded><![CDATA[<p>Apache Tomcat SSL keys created with keytool are, by default, in <strong>der</strong> format. These keys cannot be used in Apache httpd since httpd, be default, expects the keys in <strong>pem(X509)</strong> format. Using the below steps you can export the tomcat&#8217;s keys to Apache httpd format and use it for Apache.</p>
<p>I assume that you already have a working copy of tomcat with SSL.</p>
<p>If Not follow Verisign&#8217;s instructions on requesting an SSL certificate, then:</p>
<ul>
<li>Create a keystore:   $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA</li>
<li>Import the Intermediate CA Certificate:   keytool -import -alias root -keystore &lt;your_keystore_filename&gt; -trustcacerts -file &lt;filename_of_the_chain_certificate&gt;</li>
<li>Import your SSL Certificate:  keytool -import -alias &lt;your_alias&gt; -keystore &lt;your_keystore_filename&gt; -trustcacerts -file &lt;your_certificate_filename&gt;</li>
</ul>
<p>You will need a copy of the tomcat&#8217;s keystore file and the keystore password.</p>
<p>Let us start&#8230;.</p>
<p>First copy the existing tomcat&#8217;s keystore file to a new directory so that we don&#8217;t break anything that is working.</p>
<p>List the key and verify you know the passphrase.<br />
<span style="color: #008000;"><strong># keytool -list -keystore your.key </strong></span></p>
<p>Now we will export the key in DER format<br />
<span style="color: #008000;"><strong># keytool -export -alias tomcat -keystore tomcat.keystore -file exported-der.crt </strong></span><br />
Enter keystore password:<br />
Output will be: Certificate stored in file</p>
<p>The certificate will be stored in the file called exported-der.crt</p>
<p>Verify the certificate with this command:<br />
<span style="color: #008000;"><strong># openssl x509 -noout -text -in exported-der.crt -inform der </strong></span><br />
Output will be: The whole certificate saying &#8211; who issued it  and other info like your company name etc.</p>
<p>Now Convert the key to PEM format so that apache can understand it:<br />
<span style="color: #008000;"><strong># openssl x509 -out exported-pem.crt -outform pem -in exported-der.crt -inform der </strong></span></p>
<p>The exported key will be in the file exported-pem.crt.</p>
<p>We have exported the public key and now are going to export the private key.</p>
<p>Download a  file called (ExportPrivateKey.zip) from <a href="http://www.anandsekar.com/wp-content/uploads/2006/01/ExportPrivateKey.zip" target="_blank">Anandsekar.com</a></p>
<p>Extract the key<br />
<span style="color: #008000;"><strong># java -jar ExportPrivateKey.zip {keystore_path} JKS {keystore_password} {alias} exported-pkcs8.key </strong></span></p>
<p>The key is in PKCS #8 PEM format. Now run openssl to convert it to the format apache modssl expects the file.<br />
Use a cygwin shell to get a good version of OpenSSL without having to install another application.<br />
# openssl pkcs8 -inform PEM -nocrypt -in exported-pkcs8.key -out exported.key</p>
<p>The Private key is now exported to the file exported.key.</p>
<p>Edit the httpd.conf/httpd-ssl.conf file<br />
<span style="color: #000080;">SSLCertificateFile /root/SSL_export/exported-pem.crt  -&gt; I used the cert from Verisign instead.<br />
SSLCertificateKeyFile /root/SSL_export/exported.key<br />
SSLCertificateChainFile /root/SSL_export/&lt;intermediate&gt;</span></p>
<p>Example:<br />
#Verisign Certificate<br />
SSLCertificateFile &#8220;C:/Program Files/Apache Software Foundation/Apache2.2/conf/cmmssl/cert/cert.crt&#8221;<br />
# Our new key<br />
SSLCertificateKeyFile &#8220;C:/Program Files/Apache Software Foundation/Apache2.2/conf/cmmssl/private/exported.key&#8221;<br />
# The Verisign Intermediary cert file.<br />
SSLCertificateChainFile &#8220;C:/Program Files/Apache Software Foundation/Apache2.2/conf/cmmssl/intermediate/intermediate.crt&#8221;</p>
<p>Restart Apache, with fingers crossed, pixie dust in the air, while the rooster crows, on a full moon, and a live sacrificial chicken waiting on standby.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fexporting-tomcat-ssl-keys-to-apache-httpd%2F&amp;linkname=Exporting%20Tomcat%20SSL%20keys%20to%20Apache%20httpd"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/exporting-tomcat-ssl-keys-to-apache-httpd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Force Tomcat to HTTPS</title>
		<link>http://losbyers.com/wordpress/2009/12/force-tomcat-to-https/</link>
		<comments>http://losbyers.com/wordpress/2009/12/force-tomcat-to-https/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 17:51:30 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Related]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=79</guid>
		<description><![CDATA[<p>Need to have http redirect to https within Tomcat.
Here is a good page on setting up SSL for Tomcat tomcat-6.0-doc/ssl-howto.html</p>
<p>1. Change Tomcat&#8217;s server.xml.
(&#60;application&#62;/tomcat/conf/server.xml)
Edit the non-SSL &#60;Connector&#62; entry listening on port 80 and add or
edit the redirectPort atribute to point to the port on which the SSL
&#60;Connector&#62; is listening. By default, the redirectPort was pointing
to port [...]]]></description>
			<content:encoded><![CDATA[<p>Need to have http redirect to https within Tomcat.<br />
Here is a good page on setting up SSL for Tomcat <a href="http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html" target="_blank">tomcat-6.0-doc/ssl-howto.html</a></p>
<p><span style="font-weight: bold;">1.</span> Change Tomcat&#8217;s server.xml.<br />
(&lt;application&gt;/tomcat/conf/server.xml)<br />
Edit the non-SSL &lt;Connector&gt; entry listening on port 80 and add or<br />
edit the redirectPort atribute to point to the port on which the SSL<br />
&lt;Connector&gt; is listening. By default, the redirectPort was pointing<br />
to port 443.  Note: if you have an internal system running SSL on port 21101, for example, and your site uses a global load balancer, then you need to redirect to port 443.  Otherwise, the URL would be rewritten as <a href="https://your.site.com:21101/" target="_blank">https://your.site.com:21101</a> which would fail at the loadbalancer.</p>
<p><span style="font-weight: bold;">Was:</span><br />
<span style="color: #008000;">Connector port=&#8221;80&#8243;<br />
enableLookups=&#8221;false&#8221;<br />
redirectPort=&#8221;8443&#8243;<br />
maxThreads=&#8221;100&#8243;<br />
minSpareThreads=&#8221;100&#8243;<br />
maxSpareThreads=&#8221;100&#8243;</span></p>
<p><span style="font-weight: bold;">Changed to:</span><br />
<span style="color: #008000;">Connector port=&#8221;80&#8243;<br />
enableLookups=&#8221;false&#8221;<br />
redirectPort=&#8221;443&#8243;<br />
maxThreads=&#8221;100&#8243;<br />
minSpareThreads=&#8221;100&#8243;<br />
maxSpareThreads=&#8221;100&#8243; </span></p>
<p><span style="font-weight: bold;">2.</span> Setup a security constraint in the Tomcat web.xml file.<br />
In the Tomcat web.xml file the following &lt;security&gt; has<br />
to be added within the &lt;web&gt; element. This new element must be<br />
added after the &lt;servlet&gt; element: Note: The Tomcat documentation states that https will only be redirected to the Port listed if there is a &lt;security&gt; listed for some path.  I found the best location to add the info is just prior to the last line in the web.xml</p>
<p>Place the following code just above the last line (&lt;/web&gt;) in the web.xml file<br />
(&lt;application&gt;/tomcat/conf/web.xml)</p>
<p><span style="color: #008000;">&lt;pre&gt;&lt;security&gt;<br />
&lt;web&gt;<br />
&lt;web&gt;Application Name&lt;/web&gt;<br />
&lt;url&gt;/*&lt;/url&gt;<br />
&lt;/web&gt;<br />
</span><span style="color: #008000;"> </span><span style="color: #008000;">&lt;user&gt;<br />
&lt;transport&gt;CONFIDENTIAL&lt;/transport&gt;<br />
&lt;/user&gt;<br />
&lt;/security&gt;<br />
</span></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 729px; width: 1px; height: 1px;">
<p>Need to have http redirect to https within Tomcat.<br />
Here is a good page on setting up SSL for Tomcat <a href="http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html" target="_blank">tomcat-6.0-doc/ssl-howto.html</a></p>
<p><span style="font-weight: bold;">1.</span> Change Tomcat&#8217;s server.xml.<br />
(&lt;application&gt;/tomcat/conf/server.xml)<br />
Edit the non-SSL &lt;Connector&gt; entry listening on port 80 and add or<br />
edit the redirectPort atribute to point to the port on which the SSL<br />
&lt;Connector&gt; is listening. By default, the redirectPort was pointing<br />
to port 443.  Note: if you have an internal system running SSL on port 21101, for example, and your site uses a global load balancer, then you need to redirect to port 443.  Otherwise, the URL would be rewritten as <a href="https://your.site.com:21101/" target="_blank">https://your.site.com:21101</a> which would fail at the loadbalancer.</p>
<p><span style="font-weight: bold;">Was:</span><br />
<span style="color: #008000;">Connector port=&#8221;80&#8243;<br />
enableLookups=&#8221;false&#8221;<br />
redirectPort=&#8221;8443&#8243;<br />
maxThreads=&#8221;100&#8243;<br />
minSpareThreads=&#8221;100&#8243;<br />
maxSpareThreads=&#8221;100&#8243;</span></p>
<p><span style="font-weight: bold;">Changed to:</span><br />
<span style="color: #008000;">Connector port=&#8221;80&#8243;<br />
enableLookups=&#8221;false&#8221;<br />
redirectPort=&#8221;443&#8243;<br />
maxThreads=&#8221;100&#8243;<br />
minSpareThreads=&#8221;100&#8243;<br />
maxSpareThreads=&#8221;100&#8243; </span></p>
<p><span style="font-weight: bold;">2.</span> Setup a security constraint in the Tomcat web.xml file.<br />
In the Tomcat web.xml file the following &lt;security&gt; has<br />
to be added within the &lt;web&gt; element. This new element must be<br />
added after the &lt;servlet&gt; element: Note: The Tomcat documentation states that https will only be redirected to the Port listed if there is a &lt;security&gt; listed for some path.  I found the best location to add the info is just prior to the last line in the web.xml</p>
<p>Place the following code just above the last line (&lt;/web&gt;) in the web.xml file<br />
(&lt;application&gt;/tomcat/conf/web.xml)</p>
<pre>
<span style="color: #008000;"> </span>
&lt;security&gt;
    &lt;web&gt;
        &lt;web&gt;Application Name&lt;/web&gt;
        &lt;url&gt;/*&lt;/url&gt;
    &lt;/web&gt;
<span style="color: #008000;"> </span><span style="color: #008000;">   &lt;user&gt;
        &lt;transport&gt;CONFIDENTIAL&lt;/transport&gt;
    &lt;/user&gt;
&lt;/security&gt;
</span></pre>
</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fforce-tomcat-to-https%2F&amp;linkname=Force%20Tomcat%20to%20HTTPS"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/force-tomcat-to-https/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
