{"id":1506,"date":"2016-04-28T22:30:29","date_gmt":"2016-04-29T02:30:29","guid":{"rendered":"https:\/\/lowtek.ca\/roo\/?p=1506"},"modified":"2016-04-28T22:31:04","modified_gmt":"2016-04-29T02:31:04","slug":"letsencrypt","status":"publish","type":"post","link":"https:\/\/lowtek.ca\/roo\/2016\/letsencrypt\/","title":{"rendered":"SSL for everybody"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1507\" src=\"https:\/\/lowtek.ca\/roo\/wp-content\/uploads\/2016\/04\/letsencrypt.jpg\" alt=\"letsencrypt\" width=\"300\" height=\"168\" \/><\/p>\n<p>SSL certificates are a great way to\u00a0ensure that the website you&#8217;re\u00a0connected to is really the one you think you&#8217;re connected to, and it also keeps the traffic between your client and the server secure. The <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTPS\">HTTPS protocol<\/a> uses SSL certificates. The main problem with the SSL infrastructure was that you needed to get one that was signed by one of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Certificate_authority\">central trusted authorities<\/a> &#8211; and generally if you wanted one of these you had to pay for one. There were a few places that would give you <a href=\"https:\/\/lowtek.ca\/roo\/2012\/ubuntu-apache2-trusted-ssl-certificate-from-startssl\/\">a free certificate for personal use<\/a>,\u00a0the other alternative was to use a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Self-signed_certificate\">self signed certificate<\/a> but there were usability issues because it isn&#8217;t signed by a trusted authority.<\/p>\n<p>This all changed recently with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Let%27s_Encrypt\">Let&#8217;s Encrypt<\/a> &#8211; you can now get a free certificate with very little effort. If\u00a0you maintain a website or host an app, you should check <a href=\"https:\/\/letsencrypt.org\/\">letsencrypt.org<\/a> out. The remainder of this post is a cleaned up set of notes on what I did.<\/p>\n<p>I started out here\u00a0<a href=\"https:\/\/letsencrypt.org\/getting-started\/\">https:\/\/letsencrypt.org\/getting-started\/<\/a> &#8211; which seemed to be a good starting point. Then I figured I&#8217;d make sure my server met the criteria they had for support, the <a href=\"https:\/\/letsencrypt.readthedocs.org\/en\/latest\/intro.html\">documentation<\/a> had some details covering this. I was happy to see Ubuntu 12.04+ and Apache 2.x support, so this made me fairly confident my server was\u00a0supported.<\/p>\n<p>But.. my Ubuntu\u00a0doesn&#8217;t seem to have a letsencrypt package<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">$ sudo apt-get install letsencrypt\r\nReading package lists... Done\r\nBuilding dependency tree\r\nReading state information... Done\r\nE: Unable to locate package letsencrypt<\/pre>\n<p>No problem, we&#8217;ll just follow\u00a0along with <a href=\"https:\/\/letsencrypt.org\/getting-started\/\">https:\/\/letsencrypt.org\/getting-started\/<\/a><\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">$ git clone https:\/\/github.com\/letsencrypt\/letsencrypt\r\n$ cd letsencrypt\r\n$ .\/letsencrypt-auto --help<\/pre>\n<p>The last command, while asking for help &#8211; will do some bootstrapping of let&#8217;s encrypt. So don&#8217;t skip it. The scripts include calls to\u00a0sudo, so you don&#8217;t have to be root to run them but it will ask for root access.<\/p>\n<p><em>[Security note &#8211; it is always a little bit\u00a0scary running random scripts, always worth looking at them. There is a\u00a0growing trend of having &#8220;wget -O &#8211; \u00a0http:\/\/randomscript.com\u00a0| bash&#8221; be normal, but you should be afraid]<\/em><\/p>\n<p>Some exciting updates to my server from doing just the bootstrap. My \/etc\/ca-certificates got updated (it was probably way overdue), it also dragged me up to date for libssl. It took a while to finish, but we finally got the help screen.<\/p>\n<p>At this point, I have the let&#8217;s encrypt tools installed on my server, so time to try them out.<\/p>\n<p>Hopefully the following command is going to register us and get a new certificate for my old expired one.<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">$ .\/letsencrypt-auto --apache<\/pre>\n<p>Well that didn&#8217;t work, it picked up some &#8216;other&#8217; domains I host &#8212; but not my main lowtek.ca one. Weird, but probably due to my non-standard configuration of Apache due to years of\u00a0hacking it. It was easy to bail out so\u00a0no harm done.\u00a0Let&#8217;s try this then:<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">$ .\/letsencrypt-auto --apache --domains lowtek.ca<\/pre>\n<p>Ok &#8211; much better, email sign up and an agreement (which yes, I took the time to read &#8211; it was only 6 pages). \u00a0It seems as I don&#8217;t have a virtual host setup for lowtek.ca and needed to manually pick the apache config file (not a big deal), this was why the first try didn&#8217;t work.<\/p>\n<p>Visiting <a href=\"https:\/\/lowtek.ca\/\">https:\/\/lowtek.ca\/<\/a> shows no more certificate error (woot!) and all looks good. It was really this easy.<\/p>\n<p>The end of the script even suggests you visit: <a href=\"https:\/\/www.ssllabs.com\/ssltest\">https:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=lowtek.ca<\/a> to check for issues. \u00a0These SSL Labs tests, show that my certificate from letsencrypt will expire in just under 3 months, so I&#8217;ll want to add a cron job to do a renew. They also gave me a B rating, with lots of gorpy details on why.<\/p>\n<p>To renew, I just need to run this command from time to time<\/p>\n<pre class=\"nums:false show-plain-default:true lang:default decode:true\">$ .\/letsencrypt-auto renew<\/pre>\n<p>That&#8217;s really easy to do with cron &#8211; so I added an entry to my root user crontab to run this once a month.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSL certificates are a great way to\u00a0ensure that the website you&#8217;re\u00a0connected to is really the one you think you&#8217;re connected to, and it also keeps the traffic between your client and the server secure. The HTTPS protocol uses SSL certificates. The main problem with the SSL infrastructure was that you needed to get one that &hellip; <a href=\"https:\/\/lowtek.ca\/roo\/2016\/letsencrypt\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SSL for everybody&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12],"tags":[],"class_list":["post-1506","post","type-post","status-publish","format-standard","hentry","category-computing","category-how-to"],"_links":{"self":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/1506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/comments?post=1506"}],"version-history":[{"count":10,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/1506\/revisions"}],"predecessor-version":[{"id":1518,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/1506\/revisions\/1518"}],"wp:attachment":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/media?parent=1506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/categories?post=1506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/tags?post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}