{"id":2726,"date":"2016-01-06T08:51:16","date_gmt":"2016-01-06T13:51:16","guid":{"rendered":"http:\/\/antipaucity.com\/?p=2726"},"modified":"2016-01-06T08:51:16","modified_gmt":"2016-01-06T13:51:16","slug":"lets-encrypt-centos-6-truly-free-ssl","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=2726","title":{"rendered":"let&#8217;s encrypt centos 6 &#8211; truly free ssl"},"content":{"rendered":"<p>There&#8217;s been quite a bit of <a href=\"https:\/\/www.eff.org\/deeplinks\/2015\/12\/lets-encrypt-project-comes-fruition-2015-review\">excitement<\/a> <a href=\"http:\/\/www.infoworld.com\/article\/3014182\/security\/lets-encrypt-because-we-really-ought-to.html\">surrounding<\/a> <a href=\"https:\/\/letsencrypt.org\/about\">Let&#8217;s Encrypt<\/a> recently &#8211; a truly 100% free {{SSL}} issuer.<\/p>\n<p>Last week I helped a friend of mine get his first Let&#8217;s Encrypt certificate generated and configured for his website. One of the things I found incredibly frustrating is that Let&#8217;s Encrypt does not have a package for {{Red Hat}}\/{{CentOS}}\/{{Fedora}}! Ignoring such a massive installed base seems monumentally dumb &#8211; so I hope that they correct it soon. Until they do, however, here&#8217;s a tutorial that should cover the gotchas for getting Let&#8217;s Encrypt to work on a {{CentOS}} 6 server with {{Apache 2}}.<\/p>\n<p>The <a href=\"https:\/\/letsencrypt.readthedocs.org\/en\/latest\">documentation<\/a>\u00a0(as of 06 Jan 2015)\u00a0on the Let&#8217;s Encrypt website is in error in a few places (or, at least, not as correct as is could\/should be). One big thing to note, for example, is that it says {{Python}} <a href=\"https:\/\/docs.python.org\/release\/2.6.9\">2.6<\/a> is <a href=\"https:\/\/letsencrypt.readthedocs.org\/en\/latest\/intro.html#system-requirements\">supported<\/a> (the current release for {{RHEL}}\/{{CentOS}} 6). If you run the certificate generator without the <code>--debug<\/code> flag, though, it will error-out saying {{Python 2.6}} is <em>not<\/em> supported.<\/p>\n<p>While I used an existing {{CentOS 6}} server, I&#8217;ll start this tutorial as I have many others &#8211; by telling you to go get a {{CentOS 6}} server from <a href=\"https:\/\/www.digitalocean.com\/?refcode=d197a961987a\">Digital Ocean<\/a>\u00a0or <a href=\"https:\/\/chunkhost.com\/r\/wmadg\">Chunk Host<\/a>.<\/p>\n<h3>Preliminaries<\/h3>\n<p>Login as root (or a sudo-privileged account &#8211; but root is easier), and install {{Apache}}, {{Python}}, and {{SSL}} &#8211; <code>yum install httpd python mod_ssl<\/code>.<\/p>\n<p>Also enable the <a href=\"https:\/\/fedoraproject.org\/wiki\/EPEL\">EPEL<\/a> repository: <code>yum install epel-repository<\/code> (<a href=\"https:\/\/fedoraproject.org\/wiki\/EPEL#How_can_I_use_these_extra_packages.3F\">available<\/a> from the {{CentOS}} <a href=\"https:\/\/wiki.centos.org\/AdditionalResources\/Repositories\">Extras<\/a> repository. I&#8217;m going to assume you are familiar with configuring {{Apache}}, and will only provide the relevant snippets from <code>ssl.conf<\/code> herein.<\/p>\n<p>Now that the basics are done, let&#8217;s move to Let&#8217;s Encrypt. I ran the tool in interactive mode (which is going to require {{ncurses}} to be available &#8211; it&#8217;s probably already installed on your system) &#8211; but you&#8217;ll want to add a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cron\">crontab<\/a> entry since Let&#8217;s Encrypt certs expire after 90 days, so I&#8217;ll compact the interactive session into a single command-line call at the end, which you&#8217;ll need to &#8220;know&#8221; how to do, since the <code>--help<\/code> argument doesn&#8217;t do anything yet (that I could find).<\/p>\n<h3>Initial Certificate Creation<\/h3>\n<p>First, grab the latest Let&#8217;s Encrypt from {{GitHub}}:<br \/>\n<code>git clone https:\/\/github.com\/letsencrypt\/letsencrypt &amp;&amp;\u00a0cd letsencrypt<\/code><\/p>\n<p>Stop {{Apache}}: <code>service httpd stop<\/code>. Let&#8217;s Encrypt is going to try to bind to ports 80 and 443 to ensure you have control the domain.<\/p>\n<p>Now run the <code>letsencrypt-auto<\/code> tool &#8211; in debug mode so it&#8217;ll work with {{Python 2.6}}: <code>.\/letsencrypt-auto --debug certonly<\/code>.<\/p>\n<p>Use <code>certonly<\/code> because the plugins to automate installing for {{Apache}} and {{Nginx}} don&#8217;t work on {{CentOS}} yet.<\/p>\n<p>Enter your domain name(s) for which you want to issue a certificate. If you accept incoming connections to www.domain.tld and domain.tld, be sure to put both in the list (likewise, if you have, say, blog.domain.tld that you want included).<\/p>\n<p>Enter an administrative email address.<\/p>\n<p>When the tool finishes, it&#8217;ll put symlinks in <code>\/etc\/letsencrypt\/live\/domain.tld<\/code>, with the &#8220;actual&#8221; certs in <code>\/etc\/letsencrypt\/archive\/domain.tld<\/code>. We&#8217;re going to reference the symlinks in <code>\/etc\/letsencrypt\/live\/domain.tld<\/code> next.<\/p>\n<p>Edit <code>\/etc\/httpd\/conf.d\/ssl.conf<\/code> (I prefer {{emacs}} &#8211; but use whatever you prefer), and add the following lines in your VirtualHost directive:<br \/>\n<code>SSLCertificateFile \/etc\/letsencrypt\/live\/domain.tld\/fullchain.pem<br \/>\nSSLCertificateKeyFile \/etc\/letsencrypt\/live\/domain.tld\/privkey.pem<br \/>\nSSLCACertificateFile \/etc\/letsencrypt\/live\/domain.tld\/cert.pem<br \/>\n<\/code><\/p>\n<p>Restart {{Apache}} &#8211; <code>service httpd start<\/code>.<\/p>\n<p>Try hitting <code>https:\/\/domain.tld<\/code> in your web browser &#8211; and you should be golden!<\/p>\n<h3>Automating Renewal<\/h3>\n<p>Create a small shell script called <code>renew-LE-certs.sh<\/code> somewhere you&#8217;ll remember where it is &#8211; like <code>\/root<\/code>:<br \/>\n<code>service httpd stop<br \/>\n# add additional '-d' entries for more subdomains<br \/>\n\/path\/to\/letsencrypt\/letsencrypt-auto --debug --keep --agree-tos --rsa-key-size 2048 certonly -m ssladmin@domain.tld -d domain.tld -d www.domain.tld<br \/>\nservice httpd start<\/code><\/p>\n<p>For your crontab entry, do the following to setup <a href=\"https:\/\/letsencrypt.readthedocs.org\/en\/latest\/using.html#renewal\">monthly<\/a> cert renewal:<br \/>\n<code>@monthly \/path\/to\/renew-LE-certs.sh<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&#8217;s been quite a bit of excitement surrounding Let&#8217;s Encrypt recently &#8211; a truly 100% free {{SSL}} issuer. Last week I helped a friend of mine get his first Let&#8217;s Encrypt certificate generated and configured for his website. One of the things I found incredibly frustrating is that Let&#8217;s Encrypt does not have a package &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=2726\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">let&#8217;s encrypt centos 6 &#8211; truly free ssl<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[45],"tags":[166,390,713],"keyring_services":[],"class_list":["post-2726","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-centos","tag-how-to","tag-ssl"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2726"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2726\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2726"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=2726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}