デジサート Certbotによる自動化
(1) 注意事項
デジサート社のACMEの利用におきまして「action」の指定は重要な意味がございます。
|
使用不可
|
オプション
|
規定値
|
説明
|
|
action
|
enroll
または
指定なし(※注1) |
新規発行
|
新規で証明書を発行します。(契約期間1年)
新しい注文番号(orderId)を取得して下さい。
請求が発生します
|
|
action
|
reissue |
再発行
|
既存の契約期間内で証明書を再発行します。(契約期間は変化なし)
注文番号(orderId)は変化なし
無料 |
|
action
|
renew
|
更新発行
|
契約期間を1年延長して証明書を発行します。(契約期間の延長1年)
更新後の新しい注文番号(orderId)を取得して下さい。
請求が発生します |
(※注1)action の指定がない場合の自動判別
(1) --domain で指定したFQDNがACME注文履歴に存在しない場合
システムが自動判別し、新規発行(enroll)とみなします。
(2) --domain で指定したFQDNがACME注文履歴に存在する場合
システムが自動判別し、再発行(reissue)とみなします。
(2) 証明書発行
新しいコモンネームで申請する場合には「新規発行」となります。
従来ValueSSL会員ページにて申請されていたコモンネームの場合には、ACMEに移行時も「更新発行」が可能です。
■更新発行の必須条件:
(1)該当の注文が更新可能な状態(有効な契約期間・更新可能期間内)であること
(2)--server オプションに「action=renew」「orderId=9999999」を追加すること
※9999999は更新対象の証明書の注文番号です(注文番号はValueSSL会員ページでご確認下さい)
(3) サーバー証明書を新規発行する
サーバー証明書を新たに発行する場合、CertCentral から発行された EAB を付与して、発行対象 FQDN を
指定の上で、Certbot コマンドを実行します。
(1) Certbot コマンド例:
certbot certonly --standalone --register-unsafely-without-email --non-interactive --config-dir /opt/digicert/certificate --key-type rsa --server https://one.digicert.com/mpki/api/v1/acme/v2/directory?action=enroll --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
(2) ワイルドカード証明書の場合のCertbot コマンド例:
ワイルドカード証明書の自動化にはDNSプロバイダーとの連携に対応したプラグインが必要ですが、
ここでは以下のようなマニュアル作業による方法を説明します。
certbot certonly --register-unsafely-without-email --manual --preferred-challenges dns --config-dir /opt/digicert/certificate --key-type rsa --server https://one.digicert.com/mpki/api/v1/acme/v2/directory?action=enroll --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
Please deploy a DNS TXT record under the name
_acme-challenge.example.com with the following value:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Before continuing, verify the record is deployed.
Press Enter to Continue
いったん画面はそのままにして上記で表示されたDNS認証情報をDNSサーバに設定します。
_acme-challenge.example.com TXT xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DNSにTXTレコードを登録してもすぐに伝幡はされないので、しばらく待って可能であれば nslookup などのコマンドで登録したトークンの応答があることを確認します。
DNSがトークンの応答を返すことを確認したら、certbotの画面に戻り、Enterを押します。
Successfully received certificate.
表示されれば成功です。失敗の場合は、何故失敗したのかメッセージに表示されています。
(3) certonly サブコマンド・オプション
|
サブコマンド
|
説明
|
|
certonly
|
証明書を発行します。
|
|
必須
|
オプション
|
規定値
|
説明
|
|
〇
|
--standalone
|
なし
|
スタンドアロン Web サーバーを使用してサーバー証明書を取得します。
--standalone に代えて --webroot でも可。
ワイルドカード証明書の場合で「manual」を指定した場合は--standaloneは不要。
|
|
×
|
--register-unsafelywithout-email
|
なし
|
メールアドレスの登録を不要にします。
|
|
×
|
--non-interactive
|
なし
|
ユーザー入力を一切求めずに非対話で実行します。
※初回起動は、本オプションを指定せずに動作させて
ください。もしくは -agree-tos を指定して下さい。
|
|
〇
|
--domain
|
FQDN
|
証明書を取得する FQDN を指定します。
「-domain」オプションを複数指定するか、FQDN のカン
マ区切りのリストを指定することでマルチドメイン証
明書が発行できます。
|
|
〇
|
--eab-kid
|
EAB_KID
|
外部アカウントバインディングのキー識別子を指定し
ます
|
|
〇
|
--eab-hmac-key
|
EAB_HMAC_KEY
|
外部アカウントバインディングの HMAC 鍵を指定します
|
|
〇
|
--server
|
ACME Directory
Resource URI
|
申請先の ACME Directory Resource URI を指定しま
す。
|
|
×
|
--force-renewal
|
なし
|
要求されたドメインにすでに証明書が存在する場合、
有効期限が近いかどうかに関わらず、すぐに更新しま
す。--expand も暗黙的に指定されます。
|
|
×
|
--config-dir
|
ファイルパス
|
certbot が使用する設定ディレクトリを指定します。
|
|
×
|
--key-type
|
アルゴリズム名
|
「rsa」、「ecdsa」を指定できます。(既定:ecdsa)
|
|
×
|
--preferred-challenges
|
認証方式の指定
|
ワイルドカード証明書の場合は「dns」を指定します。(既定:http)
|
|
×
|
--agree-tos
|
|
ACMEサーバーの利用規約に同意したの意味
|
|
×
|
--manual
|
|
ドメイン認証を手動で行います。
|
|
使用不可
|
オプション
|
規定値
|
説明
|
|
使用不可
|
--dry-run
|
なし
|
Certbot のオプションである --dry-run は本サービスでは正常に動作しないため、使用しないで下さい。 |
※本資料に掲載しているオプションは、一部であり、一例です。certbot コマンドには、他のオプション
による方法もあります。詳細は certbot 公式ドキュメントを参照ください。
(4) 複数の FQDN を指定する方法
複数の FQDN を指定する場合、FQDN ごとに「--domain」オプションを指定するか、1つの「--domain」オ
プションにカンマ区切りで指定します。
例)FQDN ごとに「--domain」オプションを指定する場合:
--domain example.com --domain www.example.com
例)1つの「--domain」オプションにカンマ区切りで指定する場合:
--domain example.com,www.example.com
(5) 発行完了時
下記メッセージが表示されれば、サーバー証明書の発行は完了です。
Successfully received certificate.
■重要
新規発行が完了しましたら10分~30分ほど待って、ValueSSLの会員ページにログインして下さい。
「ACME注文履歴」に新規発行の注文が計上されていますので、「注文番号」をコピーして
以降の「再発行」「更新発行」の「orderId」に転記して下さい。
あるいは会員メールアドレス宛に「ACME支払案内」メールが届きますので、そちらのメールからも注文番号を確認できます。
新規発行後ならびに更新発行後は「orderId」の更新が必要です。
|
(6) Certbot 初回利用時の規約同意について
Certbot で初めて証明書を発行させる際は、規約に同意する手続きが必要です。
DigiCert Master Service Agreement(https://www.digicert.com/master-services-agreement)をご確
認いただき、内容に同意いただける場合は、「Y」を入力してください。
# certbot certonly --standalone --register-unsafely-without-email --force-renewal --config-dir /opt/digicert/certificate --key-type rsa --server https://one.digicert.com/mpki/api/v1/acme/v2/directory--eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at:
https://www.digicert.com/master-services-agreement
You must agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Account registered.
Requesting a certificate for example.com
Successfully received certificate.
Certificate is saved at: /opt/digicert/certificate/live/example.com/fullchain.pem
Key is saved at: /opt/digicert/certificate/live/example.com/privkey.pem
This certificate expires on 2026-07-17.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
(6) Certbot 規約同意手続きの省略
コマンドに--agree-tos を追加しますと自動的に規約に同意したことになり、手続きを省略できます。
# certbot certonly --standalone --register-unsafely-without-email --agree-tos --force-renewal --config-dir /opt/digicert/certificate --key-type rsa --server https://one.digicert.com/mpki/api/v1/a cme/v2/directory--eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
(4) サーバ証明書を更新する
契約期間の終了日が近づき、証明書を更新(契約期間を1年延長)する場合は、更新手続きにてサーバー証明書を発行します。
サーバー証明書を更新させる際に、更新対象の注文番号を指定することで、指定した注文のサーバ証明書を発行し、契約期間を1年延長することができます。
(1) Certbot コマンド例:
certbot certonly --standalone --register-unsafely-without-email --non-interactive --config-dir /opt/digicert/certificate --key-type rsa --server https://one.digicert.com/mpki/api/v1/acme/v2/directory?action=renew&orderId=123456789 --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
|
Linuxをご利用の場合は、--serverクエリに&(アンパサンド) を使用するとそのコマンドはバックグラウンドで始動します。
回避するために、 URL部分(https://から123456789まで)を' (シングルクォート) で囲んで下さい。
|
例)
certbot certonly --standalone --register-unsafely-without-email --non-interactive --config-dir /opt/digicert/certificate --key-type rsa --server 'https://one.digicert.com/mpki/api/v1/acme/v2/directory?action=renew&orderId=123456789' --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
(2) certonly サブコマンド・オプション
|
サブコマンド
|
説明
|
|
certonly
|
証明書を発行します。
|
|
必須
|
オプション
|
規定値
|
説明
|
|
〇
|
--standalone
|
なし
|
スタンドアロン Web サーバーを使用してサーバー証明書を取得します。
--standalone に代えて --webroot でも可。
ワイルドカード証明書の場合で「manual」を指定した場合は--standaloneは不要。
|
|
×
|
--register-unsafelywithout-email
|
なし
|
メールアドレスの登録を不要にします。
|
|
×
|
--non-interactive
|
なし
|
ユーザー入力を一切求めずに非対話で実行します。
※初回起動は、本オプションを指定せずに動作させて
ください。もしくは -agree-tos を指定して下さい。
|
|
〇
|
--domain
|
FQDN
|
証明書を取得する FQDN を指定します。
「-domain」オプションを複数指定するか、FQDN のカン
マ区切りのリストを指定することでマルチドメイン証
明書が発行できます。
|
|
〇
|
--eab-kid
|
EAB_KID
|
外部アカウントバインディングのキー識別子を指定し
ます
|
|
〇
|
--eab-hmac-key
|
EAB_HMAC_KEY
|
外部アカウントバインディングの HMAC 鍵を指定します
|
|
〇
|
--server
|
ACME Directory
Resource URI
|
申請先の ACME Directory Resource URI を指定しま
す。
|
|
×
|
--force-renewal
|
なし
|
要求されたドメインにすでに証明書が存在する場合、
有効期限が近いかどうかに関わらず、すぐに更新しま
す。--expand も暗黙的に指定されます。
|
|
×
|
--config-dir
|
ファイルパス
|
certbot が使用する設定ディレクトリを指定します。
|
|
×
|
--key-type
|
アルゴリズム名
|
「rsa」、「ecdsa」を指定できます。(既定:ecdsa)
|
|
使用不可
|
オプション
|
規定値
|
説明
|
|
使用不可
|
--dry-run
|
なし
|
Certbot のオプションである --dry-run は本サービスでは正常に動作しないため、使用しないで下さい。 |
※本資料に掲載しているオプションは、一部であり、一例です。certbot コマンドには、他のオプション
による方法もあります。詳細は certbot 公式ドキュメントを参照ください。
(3) --server オプションに追加するクエリ
|
クエリ
|
規定値
|
証明書を発行します。
|
|
action |
renew |
更新を意味する値「renew」を指定します。
契約期間が1年延長されます。代金の請求が発生します。
|
|
orderId
|
オーダーID
|
CertCentral で発行されたオーダーID に紐づけます。
オーダーID を省略すると、CertCentral が該当するオーダーを自動検出し紐づけます。
|
(4) 発行完了時
下記メッセージが表示されれば、サーバー証明書の発行は完了です。
Successfully received certificate.
■重要
更新発行が完了しましたら10分~30分ほど待って、ValueSSLの会員ページにログインして下さい。
「ACME注文履歴」に更新発行の注文が計上されていますので、更新後の「新しい注文番号」をコピーして以降の「再発行」「更新発行」の「orderId」に転記して下さい。
あるいは会員メールアドレス宛に「ACME支払案内」メールが届きますので、そちらのメールからも注文番号を確認できます。
新規発行後ならびに更新発行後は「orderId」の更新が必要です。
|
(5) サーバ証明書を再発行する
契約期間の終了日89日前より早く、サーバー証明書の終了日到来する場合は
更新ではなく再発行の手続きでサーバー証明書を追加発行(再発行)します。
契約期間中は何度でも無料でサーバ証明書の追加発行(再発行)が可能です。
オーダー番号を指定することで指定したオーダーに紐づけてサーバー証明書を再発行させることができます。
再発行されたサーバ証明書は再発行日を起点に最大199日の有効期間が設定されます。
再発行されたサーバ証明書の「有効期間の終了日」は「契約期間の終了日」を超えることはありません。
(1) Certbot コマンド例:
certbot certonly --standalone --register-unsafely-without-email --non-interactive --force-renewal --config-dir /opt/digicert/certificate --key-type rsa --server https://one.digicert.com/mpki/api/v1/acme/v2/directory?action=reissue&orderId=123456789 --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
|
Linuxをご利用の場合は、--serverクエリに&(アンパサンド) を使用するとそのコマンドはバックグラウンドで始動します。
回避するために、 URL部分(https://から123456789まで)を' (シングルクォート) で囲んで下さい。
|
例)
certbot certonly --standalone --register-unsafely-without-email --non-interactive --force-renewal --config-dir /opt/digicert/certificate --key-type rsa --server 'https://one.digicert.com/mpki/api/v1/acme/v2/directory?action=reissue&orderId=123456789' --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -d example.com,www.example.com
(2) certonly サブコマンド・オプション
|
サブコマンド
|
説明
|
|
certonly
|
証明書を発行します。
|
|
必須
|
オプション
|
規定値
|
説明
|
|
〇
|
--standalone
|
なし
|
スタンドアロン Web サーバーを使用してサーバー証明書を取得します。
--standalone に代えて --webroot でも可。
ワイルドカード証明書の場合で「manual」を指定した場合は--standaloneは不要。
|
|
×
|
--register-unsafelywithout-email
|
なし
|
メールアドレスの登録を不要にします。
|
|
×
|
--non-interactive
|
なし
|
ユーザー入力を一切求めずに非対話で実行します。
※初回起動は、本オプションを指定せずに動作させて
ください。もしくは -agree-tos を指定して下さい。
|
|
〇
|
--domain
|
FQDN
|
証明書を取得する FQDN を指定します。
「-domain」オプションを複数指定するか、FQDN のカン
マ区切りのリストを指定することでマルチドメイン証
明書が発行できます。
|
|
〇
|
--eab-kid
|
EAB_KID
|
外部アカウントバインディングのキー識別子を指定し
ます
|
|
〇
|
--eab-hmac-key
|
EAB_HMAC_KEY
|
外部アカウントバインディングの HMAC 鍵を指定します
|
|
〇
|
--server
|
ACME Directory
Resource URI
|
申請先の ACME Directory Resource URI を指定しま
す。
|
|
×
|
--force-renewal
|
なし
|
要求されたドメインにすでに証明書が存在する場合、
有効期限が近いかどうかに関わらず、すぐに更新しま
す。--expand も暗黙的に指定されます。
|
|
×
|
--config-dir
|
ファイルパス
|
certbot が使用する設定ディレクトリを指定します。
|
|
×
|
--key-type
|
アルゴリズム名
|
「rsa」、「ecdsa」を指定できます。(既定:ecdsa)
|
|
使用不可
|
オプション
|
規定値
|
説明
|
|
使用不可
|
--dry-run
|
なし
|
Certbot のオプションである --dry-run は本サービスでは正常に動作しないため、使用しないで下さい。 |
※本資料に掲載しているオプションは、一部であり、一例です。certbot コマンドには、他のオプション
による方法もあります。詳細は certbot 公式ドキュメントを参照ください。
(3) --server オプションに追加するクエリ
|
クエリ
|
規定値
|
証明書を発行します。
|
|
action |
reissue |
再発行を意味する値「reissue」を指定します。
契約期間は変わりません。(無料)
|
|
orderId
|
オーダーID
|
CertCentral で発行されたオーダーID に紐づけます。
オーダーID を省略すると、CertCentral が該当するオーダーを自動検出し、紐づけます。
|
(4) 発行完了時
下記メッセージが表示されれば、サーバー証明書の発行は完了です。
Successfully received certificate.
(6) サーバ証明書の失効
■■重要■■
1つの注文番号において、発行済証明書をすべて「失効」してしまいますと
有効なサーバ証明書がなくなり、以降はその注文番号では「再発行」ができなくなります。
1個以上の有効なサーバ証明書を残して下さい。
|
必要に応じて、発行したサーバー証明書を失効させます。
サーバー証明書を失効させるケースは、「サーバー証明書が必要ではなくなった」、「サーバー証明書
の秘密鍵の危殆化が判明した」などがあります。
Certbot では、失効用のコマンドを発行することで発行されたサーバー証明書を失効させることができま
す。
(1) Certbot コマンド例:
certbot revoke --config-dir /opt/digicert/certificate --server https://one.digicert.com/mpki/api/v1/acme/v2/directory --eab-kid AAAAAAAAAAA --eab-hmac-key AAAAAAAAAA -cert-path /opt/digicert/certificate/test.example.com --reason cessationofoperation
(2) revoke サブコマンド・オプション
|
サブコマンド
|
説明
|
|
revoke
|
証明書を失効します。
|
|
必須
|
オプション
|
規定値
|
説明
|
|
〇
|
--server
|
ACME Directory
Resource URI
|
申請先の ACME Directory Resource URI を指定しま
す。
|
|
〇
|
--eab-kid
|
EAB_KID
|
外部アカウントバインディングのキー識別子を指定し
ます
|
|
〇
|
--eab-hmac-key
|
EAB_HMAC_KEY
|
外部アカウントバインディングの HMAC 鍵を指定します
|
|
〇
|
--cert-name
|
証明書コモンネーム
|
失効させるサーバー証明書のコモンネームを指定しま
す。「--cert-path」と排他利用
|
|
〇
|
--cert-path
|
証明書ファイルパス
|
失効させるサーバー証明書のファイルパスを指定しま
す。「--cert-name」と排他利用
|
|
×
|
----reason
|
失効理由
|
任意(既定:unspecified)
失効理由を指定します。
unspecified
keycompromise
affiliationchanged
supersededs
cessationofoperation
|
|
×
|
--config-dir
|
ファイルパス
|
certbot が使用する設定ディレクトリを指定します。
|
|
使用不可
|
オプション
|
規定値
|
説明
|
|
使用不可
|
--dry-run
|
なし
|
Certbot のオプションである --dry-run は本サービスでは正常に動作しないため、使用しないで下さい。 |
※本資料に掲載しているオプションは、一部であり、一例です。certbot コマンドには、他のオプション
による方法もあります。詳細は certbot 公式ドキュメントを参照ください。
(3) 失効完了時
下記メッセージが表示されれば、サーバー証明書の失効は完了です。
You have successfully revoked the certificate that was located at ファイルパス.
|