{"id":862,"date":"2017-02-07T10:38:02","date_gmt":"2017-02-07T02:38:02","guid":{"rendered":"https:\/\/www.houquner.com\/?p=862"},"modified":"2017-05-04T14:34:54","modified_gmt":"2017-05-04T06:34:54","slug":"cloudxns-dns-%e9%aa%8c%e8%af%81%e6%96%b9%e5%bc%8f%e5%bf%ab%e9%80%9f%e8%8e%b7%e5%8f%96-lets-encrypt-%e8%af%81%e4%b9%a6%e7%9a%84-shell-%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/www.houquner.com\/index.php\/archives\/862","title":{"rendered":"cloudxns DNS \u9a8c\u8bc1\u65b9\u5f0f\u5feb\u901f\u83b7\u53d6 lets-encrypt \u8bc1\u4e66\u7684 shell \u811a\u672c"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/xdtianyu\/scripts\/tree\/master\/le-dns\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/xdtianyu\/scripts\/tree\/master\/le-dns<\/a><\/p>\n<p>\u811a\u672c\u57fa\u4e8e <a href=\"https:\/\/github.com\/lukas2511\/letsencrypt.sh\" target=\"_blank\" rel=\"noopener noreferrer\">letsencrypt.sh<\/a>\uff0c\u901a\u8fc7\u8c03\u7528 cloudxns API \u66f4\u65b0 TXT \u8bb0\u5f55\u7528\u4e8e\u8ba4\u8bc1\uff0c\u5b9e\u73b0\u5feb\u901f\u83b7\u53d6 lets-encrypt \u8bc1\u4e66\u3002\u65e0\u9700 root \u6743\u9650\uff0c\u65e0\u9700\u6307\u5b9a\u7f51\u7ad9\u76ee\u5f55\u53ca DNS \u89e3\u6790<\/p>\n<hr \/>\n<p><strong>\u4e0b\u8f7d<\/strong><\/p>\n<pre><code><span style=\"font-family: 'times new roman', times, serif; font-size: 20px;\">wget https:\/\/github.com\/xdtianyu\/scripts\/raw\/master\/le-dns\/le-cloudxns.sh<\/span>\r\n\r\n<span style=\"font-family: 'times new roman', times, serif; font-size: 20px;\">wget https:\/\/github.com\/xdtianyu\/scripts\/raw\/master\/le-dns\/cloudxns.conf<\/span>\r\n\r\n<span style=\"font-family: 'times new roman', times, serif; font-size: 20px;\">chmod +x le-cloudxns.sh <\/span>\r\n\r\n<span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\"><span style=\"font-size: 20px;\">\u6ce8\u610f\uff1a<span style=\"color: #ff0000;\">le-cloudxns.sh \u6700\u540e\u7b2c\u4e8c\u884c \u4fee\u6539\u4e3a \uff1a.\/letsencrypt.sh --accept-terms -c -k .\/cloudxns-hook.sh -t dns-01<\/span><\/span> <\/span><\/code><\/pre>\n<hr \/>\n<p><strong>\u914d\u7f6e<\/strong><\/p>\n<pre>cloudxns.conf \u6587\u4ef6\u5185\u5bb9\r\n\r\n<span style=\"font-size: 16px;\"><code><span style=\"font-family: 'times new roman', times, serif;\"><code class=\"hljs ini\"><span class=\"hljs-setting\">API_KEY=<span class=\"hljs-value\"><span class=\"hljs-string\">\"YOUR_API_KEY\"<\/span><\/span><\/span><\/code><\/span><\/code> <code><span style=\"font-family: 'times new roman', times, serif;\"><code class=\"hljs ini\"><span class=\"hljs-setting\">SECRET_KEY=<span class=\"hljs-value\"><span class=\"hljs-string\">\"YOUR_SECRET_KEY\"<\/span><\/span><\/span> <\/code><\/span><\/code> <code><span style=\"font-family: 'times new roman', times, serif;\"><code class=\"hljs ini\"><span class=\"hljs-setting\">DOMAIN=<span class=\"hljs-value\"><span class=\"hljs-string\">\"example.com\"<\/span><\/span><\/span> <\/code><\/span><\/code> <code><span style=\"font-family: 'times new roman', times, serif;\"><code class=\"hljs ini\"><span class=\"hljs-setting\">CERT_DOMAINS=<span class=\"hljs-value\"><span class=\"hljs-string\">\"example.com www.example.com im.example.com\"<\/span><\/span><\/span><\/code><\/span><\/code><\/span> \u4fee\u6539\u5176\u4e2d\u7684 API_KEY \u53ca SECRET_KEY \u4e3a\u60a8\u7684 <a href=\"https:\/\/www.cloudxns.net\/AccountManage\/apimanage.html\" target=\"_blank\" rel=\"noopener noreferrer\">cloudxns api key<\/a> \uff0c\u4fee\u6539 DOMAIN \u4e3a\u4f60\u7684\u6839\u57df\u540d\uff0c \u4fee\u6539 CERT_DOMAINS \u4e3a\u60a8\u8981\u7b7e\u7684\u57df\u540d\u5217\u8868<\/pre>\n<hr \/>\n<p><strong>\u8fd0\u884c<\/strong><\/p>\n<pre><span style=\"font-family: 'times new roman', times, serif; font-size: 20px;\"><code class=\"hljs\">.\/le-cloudxns.sh cloudxns.conf<\/code><\/span><\/pre>\n<p>\u6700\u540e\u751f\u6210\u7684\u6587\u4ef6\u5728\u5f53\u524d\u76ee\u5f55\u7684 certs \u76ee\u5f55\u4e0b<\/p>\n<hr \/>\n<p><strong>cron \u5b9a\u65f6\u4efb\u52a1<\/strong><\/p>\n<p>\u5b9a\u671f\u66f4\u65b0\u4e00\u6b21\u8bc1\u4e66\uff0c\u53ef\u4ee5\u5728 le-cloudxns.sh \u811a\u672c\u6700\u540e\u52a0\u5165 service nginx reload \u7b49\u91cd\u65b0\u52a0\u8f7d\u670d\u52a1\u3002<\/p>\n<pre><span style=\"font-family: 'times new roman', times, serif; font-size: 20px;\"><code class=\"hljs cpp\">5 3 *\/20 *\/2 * \/etc\/nginx\/le-cloudxns.sh \/etc\/nginx\/le-cloudxns.conf &gt;&gt; \/var\/<span class=\"hljs-built_in\">log<\/span>\/le-cloudxns.<span class=\"hljs-built_in\">log<\/span> <span class=\"hljs-number\">2<\/span>&gt;&amp;<span class=\"hljs-number\">1\r\n\r\n<\/span><\/code><\/span><\/pre>\n<div class=\"answer\">\n<div class=\"cont\">\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.houquner.com\">Kermit\u7684\u7f51\u7ad9<\/a> &raquo; <a href=\"https:\/\/www.houquner.com\/index.php\/archives\/862\">cloudxns DNS \u9a8c\u8bc1\u65b9\u5f0f\u5feb\u901f\u83b7\u53d6 lets-encrypt \u8bc1\u4e66\u7684 shell \u811a\u672c<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>https:\/\/github.com\/xdtianyu\/scripts\/tree\/master\/le-dns \u811a\u672c\u57fa\u4e8e letsencrypt.sh\uff0c\u901a\u8fc7\u8c03\u7528 cloudxns API \u66f4\u65b0 TXT \u8bb0\u5f55\u7528\u4e8e\u8ba4\u8bc1\uff0c\u5b9e\u73b0\u5feb\u901f\u83b7\u53d6 lets-encryp [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-862","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts\/862"}],"collection":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/comments?post=862"}],"version-history":[{"count":11,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts\/862\/revisions"}],"predecessor-version":[{"id":970,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/posts\/862\/revisions\/970"}],"wp:attachment":[{"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/media?parent=862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/categories?post=862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.houquner.com\/index.php\/wp-json\/wp\/v2\/tags?post=862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}