{"id":223,"date":"2010-03-27T10:59:04","date_gmt":"2010-03-26T23:59:04","guid":{"rendered":"http:\/\/howden.net.au\/thowden\/?p=223"},"modified":"2010-03-27T10:59:04","modified_gmt":"2010-03-26T23:59:04","slug":"sme-server-7-4-and-ca-ssl-certificate","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2010\/03\/sme-server-7-4-and-ca-ssl-certificate\/","title":{"rendered":"SME Server 7.4 and CA SSL Certificate"},"content":{"rendered":"<p>This topic kicked off as a simple &#8216;here&#8217;s how&#8230;&#8217; but the more I worked the more I ending up revising the content and the topic name.<\/p>\n<p>So the topic should be &#8220;SMEServer 7.4: Installing a CA authorised certificate for an external facing hostname that is not the same as the internal facing hostname!!&#8221;<\/p>\n<p>I started by not finding any information in the SMEServer Wiki so I rolled my own.<\/p>\n<p>Having now had the ability to reflect on the last day and a half of effort I wish I had searched harder on the Wiki yesterday. So I am writing this with the benefit of hind-sight and having already got this working the long way around.<\/p>\n<p>Read all of this <em>before<\/em> starting!<\/p>\n<p>I followed the <a href=\"http:\/\/www.sme-server.de\/download\/Howtos\/ssl.html\">SMEServer v6.0 instructions<\/a> for a external certificate as distinct from the self-issued ones. I got my certificate from my preferred supplier at <a href=\"http:\/\/www.rapidssl.com\">RapidSSL<\/a>.<\/p>\n<p>After doing apparently all the right things with setup I found that I could not get Apache to start after the changes.<\/p>\n<p>The errors were many but mostly this every 2 seconds:<\/p>\n<blockquote><p>No space left on device: mod_rewrite: could not create rewrite_log_lock<\/p><\/blockquote>\n<p>This was related to using a passphrase with the private key. While I tried a number of options to get it working in the end it was pointless as the only method to have this working other than a manual launch of Apache after every reboot was to have a plain text file injecting the passphrase when Apache needed it. Makes the passphrase security redundant. So I removed the passphrase:<\/p>\n<blockquote><p>openssl rsa -in keyfilewithpassphrase.key keyfilenopassphrase.key<\/p><\/blockquote>\n<p>Backup your files as per normal risk management before doing this and then swap the nopassphrase key into the live file so that Apache is no longer needing a passphrase.<\/p>\n<p>Once that was done Apache was loading ok, but I still had an error:<\/p>\n<blockquote><p>RSA server certificate CommonName (CN) `myexternalhostname&#8217; does NOT match server name!?<\/p><\/blockquote>\n<p>On SMEServer this relates to the ServerName setting in the VirtualHosts.  I also changed the default setting one first without success and then the VirtualHost with success.<\/p>\n<p>To do this you need to create copies of the template scripts as follows:<\/p>\n<blockquote><p>mkdir -p \/etc\/e-smith\/templates-custom\/etc\/httpd\/conf\/httpd.conf\/VirtualHosts<\/p>\n<p>cd \/etc\/e-smith\/templates-custom\/etc\/httpd\/conf\/httpd.conf\/VirtualHosts<\/p>\n<p>cp \/etc\/e-smith\/templates\/etc\/httpd\/conf\/httpd.conf\/VirtualHosts\/02ServerName .<\/p><\/blockquote>\n<p>(Dont forget the &#8216;.&#8217; at the end!)<\/p>\n<p>and then edit the contents of 02ServerName<\/p>\n<blockquote><p>ServerName your.server.name<br \/>\n#ServerName {$virtualHost}<\/p><\/blockquote>\n<p>This will remark out the automated setting and configure it to use your certified ServerName<\/p>\n<p>Prepare the resulting template with<\/p>\n<blockquote><p>\/sbin\/e-smith\/expand-template \/etc\/httpd\/conf\/httpd.conf<\/p><\/blockquote>\n<p>and restart apache<\/p>\n<blockquote><p>apachectl restart<\/p><\/blockquote>\n<p>This should clear all the errors and leave you with a working SSL certificate for web access to the server and no issues with self-issued certificates.<\/p>\n<p>And it Works !\u00a0 But&#8230;..\u00a0 the secure imap and the pptp connections now fail. I had only covered the web server access with all the above.<\/p>\n<p>Then I searched the SMEServer Wiki again and this time found a document on <a href=\"http:\/\/wiki.contribs.org\/Custom_CA_Certificate\">installing a CA signed certificate<\/a>. The only issue with this is that it also assumes that your internal hostname and domain will also be the external hostname and domain.<\/p>\n<p>So by the time I found this the only bits I really need were the last few instructions:<\/p>\n<blockquote>\n<pre>config setprop modSSL crt \/home\/e-smith\/ssl.crt\/{domain}.crt\nconfig setprop modSSL key \/home\/e-smith\/ssl.key\/{domain}.key<\/pre>\n<\/blockquote>\n<p>And then restart<\/p>\n<blockquote>\n<pre>signal-event post-upgrade\nsignal-event reboot<\/pre>\n<\/blockquote>\n<p>And it&#8217;s all really working! At last!<\/p>\n<p>So whats the correct \/ short way around ?<\/p>\n<p>I think the sequence is to use this Custom CA Certificate instructions however if you want to have the certificate for a hostname.domainname combination that is not the same as the internal hostname.domainname then it needs some work.<\/p>\n<p>I have not tested this but I think it needs to be like this:<\/p>\n<blockquote><p>Do the certificate request as a manual process on your server.<\/p>\n<p>Get the certificate organised and copied to your server in the appropriate directories\/home\/e-smith\/ssl.key, ssl.crt, etc<\/p>\n<p>Make the changes for the Apache host stuff as per above<\/p>\n<p>Make the config setprop changes and signal the events<\/p><\/blockquote>\n<p>This should address the use of an inconsistent external hostname and keep the IMAP and PPTP connections consistent with Apache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This topic kicked off as a simple &#8216;here&#8217;s how&#8230;&#8217; but the more I worked the more I ending up revising the content and the topic name. So the topic should be &#8220;SMEServer 7.4: Installing a CA authorised certificate for an external facing hostname that is not the same as the internal facing hostname!!&#8221; I started [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-linux-servers-and-software"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=223"}],"version-history":[{"count":0,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/223\/revisions"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}