ハマログ

株式会社イーツー・インフォの社員ブログ

IP制限の環境下でLet’s EncryptのSSL証明書を発行する

Let’s EncryptのSSL証明書を導入する際に、通常のウェブ環境であれば、certbotをインストールしてコマンドを実行するだけで、自動的に証明書の発行・設置がおこなわれます。
この方法は「ドメイン認証」です。

ドメイン認証を利用する場合、IP制限がかかった環境では、認証が成功しないため、証明書を発行することができません。

この場合、「DNS認証」を利用して認証を実行することができます。

DNS認証の手順

まずcertbotをインストールします。
手順はOS・ウェブサーバーにより異なるので以下を参照。
https://certbot.eff.org/
続いて「DNS-01 チャレンジ」のコマンドを実行します。実行前にサーバーを停止します。今回はApacheを利用。
systemctl stop httpd
certbotを実行します
# certbot certonly --preferred-challenges dns-01 --authenticator manual --domain demo.e2info.dev
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for demo.e2info.dev

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name:

_acme-challenge.demo.e2info.dev.

with the following value:

QU0ga-Q1hkHm5aQ-q88OUsl57KaXI-Po4fK0c5kHxvk

Before continuing, verify the TXT record has been deployed. Depending on the DNS
provider, this may take some time, from a few seconds to multiple minutes. You can
check if it has finished deploying with aid of online tools, such as the Google
Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.demo.e2info.dev.
Look for one or more bolded line(s) below the line ';ANSWER'. It should show the
value(s) you've just added.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
DNSに登録するTXTレコードの情報が表示され、Continue待ちになりました。この状態のままDNSレコードを登録します。

登録が終わったらEnterを押下して処理を続行するとSSL証明書が発行されます。
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/demo.e2info.dev/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/demo.e2info.dev/privkey.pem
This certificate expires on 2023-12-01.
These files will be updated when the certificate renews.

NEXT STEPS:
- This certificate will not be renewed automatically. Autorenewal of --manual certificates requires the use of an authentication hook script (--manual-auth-hook) but one was not provided. To renew this certificate, repeat this same certbot command before the certificate's expiry date.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
証明書と関連ファイルが発行されてサーバー上に保存されました。
あとはこのファイルを利用してApacheの設定の変更とサーバーの起動をおこないます。
以上。おしまい。
ApacheApache設定変更authentication hook scriptautorenewalCertbotDNS TXTレコードDNS-01 チャレンジDNS認証EFFGoogle Admin ToolboxIP制限ISRGLet's EncryptSSL証明書systemctl stop httpdサーバー起動ドメイン認証

  kaneko tomo   2023年9月2日


関連記事

Tomcat~DBコネクションプール設定

現象 ちょっと前に少しはまった(困った事)があったので同じ人がいたらと思い、書き…

VagrantとAnsibleで仮想環境のCentOS6.5にWordPress環境構築!WebサーバーはNginxですか?(中編)

はい、どーも! てるおです。 前編の戦いを経た今、恐れるものはありません。 早速…

cornerstone がよさげでぽちる

Mac で TortoiseSVN のような svn GUI client はな…


← 前の投稿

次の投稿 →