<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>〈certbot〉彙整頁面 - MIS 的流水年華</title>
	<atom:link href="https://jameschien.mooo.com/wordpress/tag/certbot/feed/" rel="self" type="application/rss+xml" />
	<link>https://jameschien.mooo.com/wordpress/tag/certbot/</link>
	<description>流水記事</description>
	<lastBuildDate>Wed, 10 Mar 2021 06:39:51 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>
	<item>
		<title>使用 certbot 申請 Let&#8217;s Encrypt Wildcard 憑證</title>
		<link>https://jameschien.mooo.com/wordpress/2020/08/25/%e4%bd%bf%e7%94%a8-certbot-%e7%94%b3%e8%ab%8b-lets-encrypt-wildcard-%e6%86%91%e8%ad%89/</link>
					<comments>https://jameschien.mooo.com/wordpress/2020/08/25/%e4%bd%bf%e7%94%a8-certbot-%e7%94%b3%e8%ab%8b-lets-encrypt-wildcard-%e6%86%91%e8%ad%89/#respond</comments>
		
		<dc:creator><![CDATA[James]]></dc:creator>
		<pubDate>Tue, 25 Aug 2020 05:29:43 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[certbot]]></category>
		<category><![CDATA[Let&#039;s Encrypt]]></category>
		<category><![CDATA[Wildcard 憑證]]></category>
		<category><![CDATA[教學]]></category>
		<guid isPermaLink="false">https://jameschien.no-ip.biz/wordpress/?p=230</guid>

					<description><![CDATA[<p>系統: Centos 7需求: 包含自行管理DNS的網域(bind)以及免費 no-ip網域, 若為其它代管業 &#8230; <a href="https://jameschien.mooo.com/wordpress/2020/08/25/%e4%bd%bf%e7%94%a8-certbot-%e7%94%b3%e8%ab%8b-lets-encrypt-wildcard-%e6%86%91%e8%ad%89/" class="more-link">閱讀全文 <span class="screen-reader-text">使用 certbot 申請 Let&#8217;s Encrypt Wildcard 憑證</span></a></p>
<p>〈<a href="https://jameschien.mooo.com/wordpress/2020/08/25/%e4%bd%bf%e7%94%a8-certbot-%e7%94%b3%e8%ab%8b-lets-encrypt-wildcard-%e6%86%91%e8%ad%89/">使用 certbot 申請 Let&#8217;s Encrypt Wildcard 憑證</a>〉這篇文章最早發佈於《<a href="https://jameschien.mooo.com/wordpress">MIS 的流水年華</a>》。</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">系統: Centos 7<br>需求: 包含自行管理DNS的網域(bind)以及免費 no-ip網域, 若為其它代管業者可以到certbot查詢是否有範本或plugin.</p>



<p class="has-large-font-size wp-block-paragraph"><strong>安裝</strong></p>



<p class="wp-block-paragraph">在提供服務的主機</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">yum install certbot<br>yum install python2-pip</p>



<p class="wp-block-paragraph">DNS若為自行管理, 需要安裝 certbot-dns-rfc2136 PLUGIN以自動更新DNS TXT RECORD讓 Let&#8217;s Encrypt 確認您擁有網域管理權</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">pip install certbot-dns-rfc2136</p>



<p class="has-large-font-size wp-block-paragraph"><strong>設定</strong></p>



<p class="wp-block-paragraph">在提供服務的主機上新增 /etc/letsencrypt/rfc2136.ini 檔案, 檔案權限須為0600, 內容如下</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph"># Target DNS server<br>dns_rfc2136_server = 10.0.0.1<br># Target DNS port<br>dns_rfc2136_port = 53<br># TSIG key name<br>dns_rfc2136_name = rndckey<br># TSIG key secret<br>dns_rfc2136_secret = mP1z2QD3R156ULti97TbdsRbPBcxe8zoBlaBla<br># TSIG key algorithm<br>dns_rfc2136_algorithm = HMAC-MD5</p>
</div></div>



<p class="wp-block-paragraph">TSIG Key 是用來更新 named.conf 中區域的字串 , 產生方式如下</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST rndckey</p>



<p class="wp-block-paragraph">修改 DNS 管理主機上的 named.conf ,  指定需要自動更新的ZONE &amp; 增加控制的TSIG KEY</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">key rndckey {<br>                algorithm hmac-md5;<br>                secret  &#8220;mP1z2QD3R156ULti97TbdsRbPBcxe8zoBlaBla&#8221;;<br>                };<br><br>zone &#8220;example.com&#8221; {<br>                type master;<br>                file &#8220;/var/named/example.com.hosts&#8221;;<br>                allow-update {<br>                                key &#8220;rndckey&#8221;;<br>                                };<br>                };</p>



<p class="wp-block-paragraph">若考慮安全性可用 update-policy 取代 allow-update, 但需要Bind9以上的版本</p>



<p class="wp-block-paragraph">測試是否能動態更新DNS</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">certbot certonly &#8211;dry-run &#8211;dns-rfc2136 &#8211;dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini &#8211;dns-rfc2136-propagation-seconds 30 -d example.com -d *.example.com</p>



<p class="wp-block-paragraph">若訊息顯示沒有問題就可以以正式取得憑證</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">certbot certonly &#8211;dns-rfc2136 &#8211;dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini &#8211;dns-rfc2136-propagation-seconds 30 -d example.com -d *.example.com</p>



<p class="wp-block-paragraph">若為no-ip 網域因無法使用DNS驗證則測試方式改為(非wildcard憑證)</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">certbot certonly &#8211;dry-run &#8211;webroot -w /var/www/html -d yourdomain.no-ip.com</p>



<p class="wp-block-paragraph">正式取得</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">certbot certonly &#8211;webroot -w /var/www/html -d yourdomain.no-ip.com</p>



<p class="wp-block-paragraph">申請完成後因為憑證期限為3個月 所以我們需要排成3個約一次執行該指令 另外需要重啟相關使用憑證的服務, 例如:</p>



<p class="has-white-color has-dark-gray-background-color has-text-color has-background wp-block-paragraph">certbot certonly &#8211;dns-rfc2136 &#8211;dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini &#8211;dns-rfc2136-propagation-seconds 30 -d example.com -d *.example.com &#8211;post-hook &#8216;systemctl restart httpd;systemctl restart dovecot;systemctl restart sendmail&#8217;</p>



<p class="wp-block-paragraph">如果管理的網域很多也可以直接使用 certbot renew , 但因為certbot版本更新很快, 不是很確定所有狀況 renew 都可以正確更新 , 所以這邊直接使用完整指令更新</p>



<p class="wp-block-paragraph">參考文獻:</p>


<p>https://certbot-dns-rfc2136.readthedocs.io/en/stable/<br />https://certbot.eff.org/docs/using.html?highlight=renew<br />https://evermeet.cx/wiki/Let%27s_Encrypt_with_Apache,_dovecot,_and_sendmail</p>


<p class="wp-block-paragraph"></p>
<p>〈<a href="https://jameschien.mooo.com/wordpress/2020/08/25/%e4%bd%bf%e7%94%a8-certbot-%e7%94%b3%e8%ab%8b-lets-encrypt-wildcard-%e6%86%91%e8%ad%89/">使用 certbot 申請 Let&#8217;s Encrypt Wildcard 憑證</a>〉這篇文章最早發佈於《<a href="https://jameschien.mooo.com/wordpress">MIS 的流水年華</a>》。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://jameschien.mooo.com/wordpress/2020/08/25/%e4%bd%bf%e7%94%a8-certbot-%e7%94%b3%e8%ab%8b-lets-encrypt-wildcard-%e6%86%91%e8%ad%89/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
