用 certbot 取用 Let’s Encrypt 的 certificates

我原本使用 dehydrated,前陣子開始改用 certbot
對我這懶人來說,certbot 有 rpm & dpkg,也都有 yum 跟 apt 的 repositories 可用,這點挺重要… XD

單機(純 hostname)的 certificate 搭配 nginx 用這行指令就可以完成:

certbot certonly --nginx -d {hostname}

取用 wildcard certificate 的話可以先看看 certbot 的 DNS Plugins 文件。
我自己的網域 DNS server 是自己掌管的,搭配的是 certbot-dns-rfc2136
編輯完設定檔(eg. /etc/letsencrypt/rfc2136.ini)之後也是一行指令完成:

certbot certonly \
	--dns-rfc2136 \
	--dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini \
	-d *.{DOMAIN} -d {DOMAIN}

另外,在 Ubuntu 安裝的 certbot 已經使用 systemd 的 timers 觸發定時更新,用下面這行指令可以確認其狀況。

systemctl status certbot.timer