2020/12/06

Ubuntu18 で certbot

Ubuntu18 で letsencrypt の cert を利用して証明書を取得する。

certbot は apt install

apt-get update
apt install certbot

interactive に証明書の取得

certbot certonly --standalone -t

メールアドレスを聞かれたりもろもろ質問に答える。

最後に証明書を発行するドメインを聞かれるので入力すると、ACMEチャレンジが実行される。

Problem binding to port 80: Could not bind to IPv4 or IPv6.

残念ながら Problem binding to port 80: Could not bind to IPv4 or IPv6. というエラーが出てしまった場合、これはすでに 80番ポートが使用されているのでダメという意味なので、起動しているwebサーバを停止する。--standalone の certbot は ACMEチャレンジを単独でこなしてくれるので、webサーバで待ち受ける必要はない。

The server could not connect to the client to verify the domain

以下のようなエラーが出る場合。

Failed authorization procedure. example.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain

エラーの通り、ACMEチャレンジのアクセスが example.com に到達できていないという意味なので、networkの設定を確認して疎通できるようにする。

証明書取得に成功

以下のメッセージとともに、.pem の保存場所が書かれているので、Webサーバミドルウェアなどに設定する。

Congratulations! Your certificate and chain have been saved

更新

/usr/bin/certbot renew

超簡単。

サイト内検索