CertBot と DNSPod の組み合わせ#
summary: certbot と dnspod を組み合わせて SSL 証明書の自動登録と自動更新を実現
1. pip、venv をインストールし、certbot の仮想環境を新規作成してアクティブにする#
apt install python3-pip
apt install python3.11-venv
python3 -m venv certbot-env
source certbot-env/bin/activate
2. pip で certbot をインストール#
- 仮想環境内で certbot をインストールします。pip でインストールする利点は、最新のバージョンであることです(豆瓣のソースを使用)。
pip3 install certbot -i https://pypi.doubanio.com/simple/
3. DNSPod 拡張をインストール#
pip install git+https://github.com/tengattack/certbot-dns-dnspod.git
- (optional) zope が欠けていると表示された場合
pip install zope.interface -i https://pypi.doubanio.com/simple/
4. certbot-dns-dnspod の設定ファイル#
dnspod の設定 ini ファイルを編集します
dns_dnspod_api_id = 12345
dns_dnspod_api_token = 1234567890abcdef1234567890abcdef
5. certbot とプラグインの使用#
certbot certonly -a dns-dnspod \
--dns-dnspod-credentials /etc/letsencrypt/dnspod.ini \
-d example.com \
-d *.example.com
6. Certbot の一般的な管理コマンド#
- certbot が現在管理している証明書を表示
certbot certificates
- 更新
certbot renew