{"id":2685,"date":"2025-10-17T17:37:10","date_gmt":"2025-10-17T09:37:10","guid":{"rendered":"https:\/\/thereisno.top\/?p=2685"},"modified":"2025-10-17T17:37:53","modified_gmt":"2025-10-17T09:37:53","slug":"letencrypt%e6%b3%9b%e5%9f%9f%e5%90%8d%e8%87%aa%e5%8a%a8%e7%bb%ad%e6%9c%9f","status":"publish","type":"post","link":"https:\/\/thereisno.top\/?p=2685","title":{"rendered":"Letencrypt\u6cdb\u57df\u540d\u81ea\u52a8\u7eed\u671f"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u4e0b\u8f7d<\/h2>\n\n\n\n<pre id=\"codecell0\" class=\"wp-block-preformatted\">$ git clone https:\/\/github.com\/ywdblog\/certbot-letencrypt-wildcardcertificates-alydns-au\n$ cd certbot-letencrypt-wildcardcertificates-alydns-au\n$ chmod 0777 au.sh\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u4f7f\u7528\u65b9\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 \u7533\u8bf7\u8bc1\u4e66<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">2.1.1 \u6d4b\u8bd5\u662f\u5426\u6709\u9519\u8bef<\/h4>\n\n\n\n<pre id=\"codecell1\" class=\"wp-block-preformatted\">certbot certonly  -d *.abc.com -d abc.com  --manual --preferred-challenges dns --server https:\/\/acme-v02.api.letsencrypt.org\/directory   --manual-auth-hook \"\/path\/certbot-alydns\/au.sh python aly add\" --manual-cleanup-hook \"\/path\/certbot-alydns\/au.sh python aly clean\"   --dry-run \n<\/pre>\n\n\n\n<p><strong>Debug\uff1a<\/strong> \u64cd\u4f5c DNS API \u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u7cfb\u5217\u95ee\u9898\uff0c\u6bd4\u5982 API token \u6743\u9650\u4e0d\u8db3\uff0c\u9047\u5230\u76f8\u5173\u95ee\u9898\uff0c\u53ef\u4ee5\u67e5\u770b \/var\/log\/certd.log\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><strong>\u91cd\u8981\u89e3\u91ca\uff1a<\/strong> &#8211;manual-auth-hook \u548c &#8211;manual-cleanup-hook \u6709\u4e09\u4e2a\u53c2\u6570\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c\u4e00\u4e2a\u4ee3\u8868\u4f60\u8981\u9009\u62e9\u90a3\u79cd\u8bed\u8a00(php\/python)<\/li>\n\n\n\n<li>\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4ee3\u8868\u4f60\u7684DNS\u5382\u5546(aly\/txy)<\/li>\n\n\n\n<li>\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u56fa\u5b9a\u7684(\u2013manual-auth-hook\u4e2d\u7528add\uff0c\u2013manual-clean-hook\u4e2d\u7528clean)<\/li>\n<\/ul>\n\n\n\n<p>\u6bd4\u5982\u4f60\u8981\u9009\u62e9Python\u73af\u5883\uff0c\u53ef\u4ee5\u5c06 &#8211;manual-auth-hook \u8f93\u5165\u4fee\u6539\u4e3a \u201c\/path\/certbot-alydns\/au.sh python aly add\u201d\uff0c\u2013manual-cleanup-hook \u8f93\u5165\u4fee\u6539\u4e3a \u201c\/path\/certbot-alydns\/au.sh python aly clean\u201d<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.1.2 \u5b9e\u9645\u7533\u8bf7<\/h4>\n\n\n\n<p>\u786e\u8ba4\u65e0\u8bef\u540e\uff0c\u5b9e\u9645\u8fd0\u884c\uff08\u53bb\u9664 &#8211;dry-run \u53c2\u6570\uff09\uff1a<\/p>\n\n\n\n<pre id=\"codecell2\" class=\"wp-block-preformatted\">certbot certonly  -d *.abc.com -d abc.com  --manual --preferred-challenges dns --server https:\/\/acme-v02.api.letsencrypt.org\/directory   --manual-auth-hook \"\/path\/certbot-alydns\/au.sh python aly add\" --manual-cleanup-hook \"\/path\/certbot-alydns\/au.sh python aly clean\"\n<\/pre>\n\n\n\n<p>\u53c2\u6570\u89e3\u91ca\uff08\u53ef\u4ee5\u4e0d\u7528\u5173\u5fc3\uff09\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>certonly\uff1a\u8868\u793a\u91c7\u7528\u9a8c\u8bc1\u6a21\u5f0f\uff0c\u53ea\u4f1a\u83b7\u53d6\u8bc1\u4e66\uff0c\u4e0d\u4f1a\u4e3aweb\u670d\u52a1\u5668\u914d\u7f6e\u8bc1\u4e66<\/li>\n\n\n\n<li>\u2013manual\uff1a\u8868\u793a\u63d2\u4ef6<\/li>\n\n\n\n<li>\u2013preferred-challenges dns\uff1a\u8868\u793a\u91c7\u7528DNS\u9a8c\u8bc1\u7533\u8bf7\u8005\u5408\u6cd5\u6027\uff08\u662f\u4e0d\u662f\u57df\u540d\u7684\u7ba1\u7406\u8005\uff09<\/li>\n\n\n\n<li>\u2013dry-run\uff1a\u5728\u5b9e\u9645\u7533\u8bf7\/\u66f4\u65b0\u8bc1\u4e66\u524d\u8fdb\u884c\u6d4b\u8bd5\uff0c\u5f3a\u70c8\u63a8\u8350<\/li>\n\n\n\n<li>-d\uff1a\u8868\u793a\u9700\u8981\u4e3a\u90a3\u4e2a\u57df\u540d\u7533\u8bf7\u8bc1\u4e66\uff0c\u53ef\u4ee5\u6709\u591a\u4e2a\u3002<\/li>\n\n\n\n<li>\u2013manual-auth-hook\uff1a\u5728\u6267\u884c\u547d\u4ee4\u7684\u65f6\u5019\u8c03\u7528\u4e00\u4e2a hook \u6587\u4ef6<\/li>\n\n\n\n<li>\u2013manual-cleanup-hook\uff1a\u6e05\u9664 DNS \u6dfb\u52a0\u7684\u8bb0\u5f55<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">2.1.3 \u591a\u4e2a\u57df\u540d\u7533\u8bf7<\/h4>\n\n\n\n<p>\u5982\u679c\u4f60\u60f3\u4e3a\u591a\u4e2a\u57df\u540d\u7533\u8bf7\u901a\u914d\u7b26\u8bc1\u4e66\uff08\u5408\u5e76\u5728\u4e00\u5f20\u8bc1\u4e66\u4e2d\uff0c\u4e5f\u53eb\u505a <strong>SAN \u901a\u914d\u7b26\u8bc1\u4e66<\/strong>\uff09\uff0c\u76f4\u63a5\u8f93\u5165\u591a\u4e2a -d \u53c2\u6570\u5373\u53ef\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<pre id=\"codecell3\" class=\"wp-block-preformatted\">certbot certonly  -d *.abc.com -d *.abc.org  --manual --preferred-challenges dns --server https:\/\/acme-v02.api.letsencrypt.org\/directory   --manual-auth-hook \"\/path\/certbot-alydns\/au.sh python aly add\" --manual-cleanup-hook \"\/path\/certbot-alydns\/au.sh python aly clean\"\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 \u7eed\u671f\u8bc1\u4e66<\/h3>\n\n\n\n<p>\u8bc1\u4e66\u6709\u6548\u671f&lt;30\u5929\u624d\u4f1arenew\uff0c\u6240\u4ee5crontab\u53ef\u4ee5\u914d\u7f6e\u4e3a1\u5929\u62161\u5468<\/p>\n\n\n\n<pre id=\"codecell4\" class=\"wp-block-preformatted\">certbot renew --post-hook  \"systemctl reload nginx \" --post-hook \"systemctl reload apache2\"\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.3 \u52a0\u5165 crontab<\/h3>\n\n\n\n<p>\u7f16\u8f91\u6587\u4ef6 \/etc\/crontab :<\/p>\n\n\n\n<pre id=\"codecell5\" class=\"wp-block-preformatted\">1 1 *\/1 * * root certbot renew --post-hook  \"systemctl reload nginx \" --post-hook \"systemctl reload apache2\"\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u4e0b\u8f7d $ git clone https:\/\/github.com\/ywdblog\/certbot-let &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/thereisno.top\/?p=2685\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cLetencrypt\u6cdb\u57df\u540d\u81ea\u52a8\u7eed\u671f\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[103],"tags":[278,279],"class_list":["post-2685","post","type-post","status-publish","format-standard","hentry","category-103","tag-letencrypt","tag-279"],"_links":{"self":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/2685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2685"}],"version-history":[{"count":2,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/2685\/revisions"}],"predecessor-version":[{"id":2687,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/2685\/revisions\/2687"}],"wp:attachment":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}