GCPで Let’s encrypt を更新する際「likely firewall problem」になった話→VM設定の問題だった

Let’s encryptので証明書更新コマンドを実行した際、ファイアウォール関連のエラーになりました。→ [結論]

実行したコマンド

一部伏せ字にしています

$ certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/amemy-blog.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator apache, Installer apache
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for amemy-blog.com
Waiting for verification...
^[[ACleaning up challenges
Attempting to renew cert (amemy-blog.com) from /etc/letsencrypt/renewal/amemy-blog.com.conf produced an unexpected error: Failed authorization procedure. amemy-blog.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: ***.***.***.***: Fetching http://amemy-blog.com/.well-known/acme-challenge/*********************************: Timeout during connect (likely firewall problem). Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/amemy-blog.com/fullchain.pem (failure)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates below have not been saved.)

All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/amemy-blog.com/fullchain.pem (failure)
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: amemy-blog.com
   Type:   connection
   Detail: ***.***.***.***: Fetching
   http://amemy-blog.com/.well-known/acme-challenge/0eu88QjASLwTw7svuNSSQE_VuTKOmcgOlEONj5ZcS54:
   Timeout during connect (likely firewall problem)

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

原因&解決方法

VMインスタンスの設定の中でHTTPトラフィックを許可していなかったことが問題でした。

「Fetching http://amemy-blog.com/.well-known/acme-challenge/~~」のプロトコルがhttpsじゃなくてhttpだからです。

以下の手順で解決しました。

コンソールから VMインスタンス を開く
編集 をクリック
HTTPトラフィックを許可する
ここにチェックを入れる
保存する

この作業をした上でrenewを行うとエラーが解消されました。
VPCネットワークのファイアウォールで許可しても解決しなかったのですこしハマりました。

ここじゃ解決できなかった

この記事が参考になれば幸いです。