ureo/certbot-dns01
Be able to run DNS-01 challenge by launching a DNS server on Docker.
60
DockerでDNSサーバーを立ち上げ、dns-01チャレンジを行えます。
Be able to run DNS-01 challenge by launching a DNS server on Docker.
Let’s Encryptでワイルドカード証明書を取得する話 | IIJ Engineers Blog
sudo docker run --rm -i --net host \
-e DOMAIN=example.com \
-e ADDR=2001:db8::1 \
-e EMAIL=letsencrypt@example.com \
--name certbot-dns01 \
-v certbot_data:/etc/letsencrypt \
-v knot_config:/config \
-v knot_rundir:/rundir \
-v knot_storage:/storage \
-v /usr/syno/etc/certificate:/certificate \
ureo/certbot-dns01:0.1 ./script.sh
※ サンプルコマンドの環境変数を使うため、適宜読み替えてください
NOTE: Please read as appropriate to use the environment variable in the sample command
acme.example.com
に 2001:db8::1
を設定する
Set 2001:db8::1
to acme.example.com
_acme-challenge.example.com
にNS(CNAME)レコードを acme.example.com
向けで設定
Set acme.example.com
as NS (CNAME) record to _acme-challenge.example.com
2001:db8::1
の 53ポートを開放
Open 53 ports of 2001:db8::1
docker run --rm ... ./init.sh
出力を _acme-challenge.example.com にDSレコードとして設定
Set output as DS record to _acme-challenge.example.com
docker run --rm ... ./first.sh
生成された証明書をDSMに設定 (on DSM only)
Set the generated certificate to DSM (on DSM only)
docker create ... ./renew.sh
以下のコマンドを定期的に実行
Execute the following commands regularly
docker start certbot-dns01 -ai
synofirewall --disable &&
docker start certbot-dns01 -ai &&
synosystemctl restart nginx &&
synofirewall --enable
エラー例
Error Examples
DNS problem: SERVFAIL looking up TXT for _acme-challenge.example.com - the domain's nameservers may be malfunctioning
DNS problem: query timed out looking up TXT for _acme-challenge.example.com
Encountered error when making query: The DNS operation timed out.
解決方法
Solution
手順の1から4を再度実行する
Execute 1 to 4 of the procedure again
または次の実行結果を比較し、合わない場合は前者でとれたDSレコードを設定し、再度実行
Or compare the following execution results, set the DS record that is removed in the former if it does not fit, and execute it again.
# 出力: 本来設定されるべきDSレコード
# Output: DS record that should be set
docker run -rm ... ./get_ds.sh
# 出力: 現在ネームサーバーに設定されているDSレコード
# Output: DS record currently set on the name server
docker run -rm ... kdig acme.example.com ds
エラー例
Error Example
Encountered exception during recovery: certbot.errors.PluginError: Unable to determine base domain for _acme-challenge.example.com using names: ['_acme-challenge.example.com', 'example.com', 'com'].
解決方法
Solution
NAS等のシステムのファイアウォール、ルーターのポート解放、そしてアドレス等を再度確認する。
Check the firewalls of NAS and other systems, release routers, and address again.
次のコマンドを実行することでDNSサーバーを一時的に立てることができるため、その間に外からアクセスできるかを確かめる。 By executing the following command, you can temporarily stand the DNS server, so that you can access from the outside in the meantime.
docker run --rm ... sh -c "knotd -d && sleep 3600 && knotc stop"
エラー例
Error Example
Submitting DS Record Registration...error: [_acme-challenge.example.com] (no key ready for submission)
解決方法
Solution
多くの場合は既にacme.example.comのDSレコードを設定し、それをKnot DNSに通知済みなだけなので、最後の証明書発行後にinit.shを実行していなければ無視してOK
In many cases, the DS record of acme.example.com has already been set, and it has only been notified to Knot DNS, so if you do not execute init.sh after issuing the last certificate, you can ignore it.
docker pull ureo/certbot-dns01