{"id":2837,"date":"2016-02-26T11:20:16","date_gmt":"2016-02-26T16:20:16","guid":{"rendered":"https:\/\/antipaucity.com\/?p=2837"},"modified":"2016-02-26T11:20:16","modified_gmt":"2016-02-26T16:20:16","slug":"automated-lets-encrypt-ssl-certificate-renewal-on-centos-7","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=2837","title":{"rendered":"automated let&#8217;s encrypt ssl certificate renewal on centos 7"},"content":{"rendered":"<p>In my <a href=\"https:\/\/antipaucity.com\/2016\/01\/06\/lets-encrypt-centos-6-truly-free-ssl\">how-to for Let&#8217;s Encrypt<\/a>, I gave an example script that can be called via cron (or manually) which will renew <a href=\"http:\/\/letsencrypt.org\">Let&#8217;s Encrypt<\/a> {{SSL}} certificates under {{CentOS}} 6.<\/p>\n<p>If you want to do it on {{CentOS}} 7 (which is what I am now <a href=\"https:\/\/antipaucity.com\/2016\/02\/24\/its-been-4-5-years\">running<\/a>), use the following:<\/p>\n<p><code>cd ~\/letsencrypt<br \/>\ngit pull<br \/>\nsystemctl stop httpd.service<br \/>\n~\/letsencrypt\/letsencrypt-auto --agree-tos --keep --rsa-key-size 2048 --standalone certonly -m user@domain.tld -d domain.tld [-d sub.domain.tld [-d ...]]<br \/>\nsystemctl start httpd.service<br \/>\n<\/code><\/p>\n<p>Now, what does this script do? Step by step:<\/p>\n<ol>\n<li>clear-out the last grab of the Let&#8217;s Encrypt git repo (there&#8217;s probably a better way to do this, but I don&#8217;t know what it is)<\/li>\n<li>go to root&#8217;s home (<code>\/root<\/code>)<\/li>\n<li>clone-down the <a href=\"https:\/\/letsencrypt.readthedocs.org\/en\/latest\">Let&#8217;s Encrypt<\/a> toolset<\/li>\n<li>stop httpd ({{Apache}} in my case, though you might be running {{nginx}} or something else<\/li>\n<li>run the cert tool in automated form:\n<ol>\n<li>agree to terms of service<\/li>\n<li>keep current cert if it doesn&#8217;t need to be updated<\/li>\n<li>key size of <a href=\"http:\/\/danielpocock.com\/rsa-key-sizes-2048-or-4096-bits\">2048 bits<\/a><\/li>\n<li>run the standalone webserver to verify &#8220;ownership&#8221; of the domain<\/li>\n<li>generate just the cert<\/li>\n<li>administrative email (optional, but &#8220;encouraged&#8221;)<\/li>\n<li>domain(s) to issue cert for (must be individually identified with successive -d flags; LE does not support <a href=\"https:\/\/en.wikipedia.org\/wiki\/Wildcard_certificate\">wildcard certs<\/a>)<\/li>\n<\/ol>\n<\/li>\n<li>restart httpd<\/li>\n<\/ol>\n<p>I set mine to run <code>@weekly<\/code> in <a href=\"http:\/\/serverfault.com\/q\/135906\/2321\">cron<\/a> &#8211; <code>@monthly<\/code> is <em>likely<\/em> good enough, but since it&#8217;s &#8220;free&#8221; to run, running slightly more than is necessary seems good to me. Plus, if you&#8217;re getting {{SSL}} certs for many domains all being served from the same server, they may have different expiration dates, so running more often is better.<\/p>\n<p>My crontab entry for renewing certs:<\/p>\n<p><code>@weekly \/root\/renew-le-ssl.sh<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my how-to for Let&#8217;s Encrypt, I gave an example script that can be called via cron (or manually) which will renew Let&#8217;s Encrypt {{SSL}} certificates under {{CentOS}} 6. If you want to do it on {{CentOS}} 7 (which is what I am now running), use the following: cd ~\/letsencrypt git pull systemctl stop httpd.service &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=2837\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">automated let&#8217;s encrypt ssl certificate renewal on centos 7<\/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":[41,45],"tags":[166,390,713],"keyring_services":[],"class_list":["post-2837","post","type-post","status-publish","format-standard","hentry","category-technical","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\/2837","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=2837"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2837\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2837"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=2837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}