{"id":338,"date":"2017-06-28T18:13:59","date_gmt":"2017-06-28T09:13:59","guid":{"rendered":"http:\/\/shinke1987.net\/?p=338"},"modified":"2018-03-03T21:09:55","modified_gmt":"2018-03-03T12:09:55","slug":"post-338","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=338","title":{"rendered":"CentOS7.3\u3067Apache + mod_ssl + CertBot"},"content":{"rendered":"<h2>\u74b0\u5883<\/h2>\n<p>CentOS\uff1a7.3<br \/>\nApache\uff1a2.4.6<br \/>\nmod_ssl\uff1a2.4.6<br \/>\nopenssl\uff1a1.0.1e<br \/>\nSSL\/TLS\u8a3c\u660e\u66f8\u306e\u8a8d\u8a3c\u5c40\uff1aLet&#8217;s Encrypt ( CertBot )<\/p>\n<p>\u5168\u3066yum\u3092\u4f7f\u3063\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>Apache\u3068mod_ssl\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# httpd\u3068mod_ssl\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\n$ sudo yum install httpd mod_ssl\r\n# \u6b21\u306bhttpd.conf\u3084\u3001ssl.conf\u3001conf.modules.d\u306e\u4e2d\u8eab\u7b49\u3092\u8a2d\u5b9a\u3059\u308b\u3002\r\n# 80\u756a\u30dd\u30fc\u30c8\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3053\u3068\u306f\u78ba\u8a8d\u3057\u305f\u3002\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>CertBot\u3092yum\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# yum-config-manager\u3092\u4f7f\u3046\u305f\u3081\u306b\u3001yum-utils\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\r\n$ sudo yum install yum-utils\r\n# \u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3002\r\n$ sudo yum-config-manager --enable rhui-REGION-rhel-extras rhui-REGION-rhel-server-optional\r\n\r\n# \u4e0a\u306e\u3084\u308a\u65b9\u304c\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067\u8ffd\u8a18\uff082018\u5e743\u67083\u65e5\uff09\r\n# EPEL\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3088\u3046\u306b\u3059\u308c\u3070\u826f\u3044\u3002\r\n$ sudo yum -y install epel-release\r\n# CertBot\u3092yum\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\r\n$ sudo yum install certbot-apache\r\n# httpd\u3092\u8d77\u52d5\u3002\r\n$ sudo systemctl start httpd\r\n# CertBot\u5b9f\u884c\u3002\uff08httpd\u3092\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\uff09\r\n$ sudo certbot --apache\r\n<\/pre>\n<blockquote><p><span class=\"bold-red\">httpd\u3092\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u3068\u3053\u3093\u306a\u30a8\u30e9\u30fc\u304c\u51fa\u305f<\/span><br \/>\n[user@srv ~]$ sudo certbot &#8211;apache<br \/>\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log<br \/>\nEnter email address (used for urgent renewal and security notices) (Enter &#8216;c&#8217; to<br \/>\ncancel):E\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9<br \/>\nStarting new HTTPS connection (1): acme-v01.api.letsencrypt.org<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nPlease read the Terms of Service at<br \/>\nhttps:\/\/letsencrypt.org\/documents\/LE-SA-v1.1.1-August-1-2016.pdf. You must agree<br \/>\nin order to register with the ACME server at<br \/>\nhttps:\/\/acme-v01.api.letsencrypt.org\/directory<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n(A)gree\/(C)ancel: A<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nWould you be willing to share your email address with the Electronic Frontier<br \/>\nFoundation, a founding partner of the Let&#8217;s Encrypt project and the non-profit<br \/>\norganization that develops Certbot? We&#8217;d like to send you email about EFF and<br \/>\nour work to encrypt the web, protect its users and defend digital rights.<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n(Y)es\/(N)o: N<\/p>\n<p>Which names would you like to activate HTTPS for?<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n1: \u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nSelect the appropriate numbers separated by commas and\/or spaces, or leave input<br \/>\nblank to select all options shown (Enter &#8216;c&#8217; to cancel):1<br \/>\nObtaining a new certificate<br \/>\nPerforming the following challenges:<br \/>\ntls-sni-01 challenge for \u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info<br \/>\nError while running apachectl graceful.<\/p>\n<p>Job for httpd.service invalid.<\/p>\n<p>Cleaning up challenges<br \/>\nError while running apachectl graceful.<\/p>\n<p>Job for httpd.service invalid.<\/p>\n<p>Encountered exception during recovery<br \/>\nError while running apachectl graceful.<\/p>\n<p>Job for httpd.service invalid.<br \/>\nTraceback (most recent call last):<br \/>\nFile &#8220;\/usr\/lib\/python2.7\/site-packages\/certbot\/error_handler.py&#8221;, line 99, in _call_registered<br \/>\nself.funcs[-1]()<br \/>\nFile &#8220;\/usr\/lib\/python2.7\/site-packages\/certbot\/auth_handler.py&#8221;, line 284, in _cleanup_challenges<br \/>\nself.auth.cleanup(achalls)<br \/>\nFile &#8220;\/usr\/lib\/python2.7\/site-packages\/certbot_apache\/configurator.py&#8221;, line 1908, in cleanup<br \/>\nself.restart()<br \/>\nFile &#8220;\/usr\/lib\/python2.7\/site-packages\/certbot_apache\/configurator.py&#8221;, line 1797, in restart<br \/>\nself._reload()<br \/>\nFile &#8220;\/usr\/lib\/python2.7\/site-packages\/certbot_apache\/configurator.py&#8221;, line 1808, in _reload<br \/>\nraise errors.MisconfigurationError(str(err))<br \/>\nMisconfigurationError: Error while running apachectl graceful.<\/p>\n<p>Job for httpd.service invalid.<\/p>\n<p>Error while running apachectl graceful.<\/p>\n<p>Job for httpd.service invalid.<\/p>\n<p>IMPORTANT NOTES:<br \/>\n&#8211; Your account credentials have been saved in your Certbot<br \/>\nconfiguration directory at \/etc\/letsencrypt. You should make a<br \/>\nsecure backup of this folder now. This configuration directory will<br \/>\nalso contain certificates and private keys obtained by Certbot so<br \/>\nmaking regular backups of this folder is ideal.<\/p><\/blockquote>\n<blockquote><p><span class=\"bold-red\">httpd\u8d77\u52d5\u5f8c<\/span><br \/>\n[user@srv]$ sudo certbot &#8211;apache<br \/>\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log<br \/>\nStarting new HTTPS connection (1): acme-v01.api.letsencrypt.org<\/p>\n<p>Which names would you like to activate HTTPS for?<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n1: \u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nSelect the appropriate numbers separated by commas and\/or spaces, or leave input<br \/>\nblank to select all options shown (Enter &#8216;c&#8217; to cancel):1<br \/>\nObtaining a new certificate<br \/>\nPerforming the following challenges:<br \/>\ntls-sni-01 challenge for \u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info<br \/>\nWaiting for verification&#8230;<br \/>\nCleaning up challenges<br \/>\nDeploying Certificate for \u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info to VirtualHost \/etc\/httpd\/conf.d\/ssl.conf<\/p>\n<p>Please choose whether HTTPS access is required or optional.<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n1: Easy &#8211; Allow both HTTP and HTTPS access to these sites<br \/>\n2: Secure &#8211; Make all requests redirect to secure HTTPS access<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nSelect the appropriate number [1-2] then [enter] (press &#8216;c&#8217; to cancel): 1<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nCongratulations! You have successfully enabled https:\/\/\u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info<\/p>\n<p>You should test your configuration at:<br \/>\nhttps:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=\u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>IMPORTANT NOTES:<br \/>\n&#8211; Congratulations! Your certificate and chain have been saved at<br \/>\n\/etc\/letsencrypt\/live\/\u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d.info\/fullchain.pem. Your<br \/>\ncert will expire on 2017-09-26. To obtain a new or tweaked version<br \/>\nof this certificate in the future, simply run certbot again with<br \/>\nthe &#8220;certonly&#8221; option. To non-interactively renew *all* of your<br \/>\ncertificates, run &#8220;certbot renew&#8221;<br \/>\n&#8211; If you like Certbot, please consider supporting our work by:<\/p>\n<p>Donating to ISRG \/ Let&#8217;s Encrypt: https:\/\/letsencrypt.org\/donate<br \/>\nDonating to EFF: https:\/\/eff.org\/donate-le<\/p><\/blockquote>\n<p>\u305d\u308c\u304b\u3089https:\/\/\u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/www.ssllabs.com\/ssltest\/analyze.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.ssllabs.com\/ssltest\/analyze.html<\/a>\u3053\u306e\u30b5\u30a4\u30c8\u3067\u3001<br \/>\n\u8a55\u4fa1\u3092\u4e0a\u3052\u308b\u305f\u3081\u306bssl.conf\u3092\u8a2d\u5b9a\u3059\u308b\u3002<br \/>\n\u4f55\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\u306f\u3001Overall Rating\u306fB\u3060\u3063\u305f\u3002<br \/>\nVirtualHost\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u3001<br \/>\n\u305d\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u5185\u306b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Include \/etc\/letsencrypt\/options-ssl-apache.conf<\/pre>\n<p>\u3092\u8ffd\u52a0\u3057\u305f\u3089\u3001Overall Rating\u306fA\u306b\u306a\u3063\u305f\u3002<br \/>\nGrade\u306fA\u304c80\u70b9\u4ee5\u4e0a\u3089\u3057\u3044\u306e\u3067\u3001\u3053\u308c\u3067\u826f\u3057\u3068\u3059\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>CertBot\u3067TLS\u8a3c\u660e\u66f8\u3092\u66f4\u65b0\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a<\/h2>\n<p><a href=\"https:\/\/certbot.eff.org\/#centosrhel7-apache\" target=\"_blank\" rel=\"noopener\">https:\/\/certbot.eff.org\/#centosrhel7-apache<\/a><br \/>\n\u3053\u3053\u306b\u3088\u308b\u30681\u65e52\u56de\u3001\u66f4\u65b0\u306e\u305f\u3081\u306bCertBot\u3092\u8d70\u3089\u305b\u308b\u3068\u826f\u3044\u3068\u66f8\u304b\u308c\u3066\u3044\u308b\u304c\u3001<br \/>\n\u6709\u52b9\u671f\u9593\u306f90\u65e5\u3060\u304b\u3089\u6bce\u6708\u3067\u3082\u826f\u3044\u306e\u304b\u306a\u30fc\u3063\u3066\u601d\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ sudo certbot renew --dry-run<\/pre>\n<p>\u3068\u3084\u3063\u3066\u3001\u4f55\u3082\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3089\u3001<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ sudo certbot renew<\/pre>\n<p>\u3092cron\u3068\u304b\u3067\u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308c\u3070\u826f\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883 CentOS\uff1a7.3 Apache\uff1a2.4.6 mod_ssl\uff1a2.4.6 openssl\uff1a1.0.1e SSL\/TLS\u8a3c\u660e\u66f8\u306e\u8a8d\u8a3c\u5c40\uff1aLet&#8217;s Encrypt ( CertBot ) \u5168\u3066yum\u3092\u4f7f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[32,34,48],"class_list":["post-338","post","type-post","status-publish","format-standard","hentry","category-apache","tag-apache","tag-centos","tag-ssltls"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338"}],"version-history":[{"count":10,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/338\/revisions"}],"predecessor-version":[{"id":387,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/338\/revisions\/387"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}