certbotが証明書の更新に失敗するので証明書を作り直してみるが仕様が変更されているようなのでcertbotを更新もしておく

root@plusload:~/certbot# ./certbot-auto renew
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator standalone, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for plusload.net
Cleaning up challenges
Attempting to renew cert (plusload.net-0001) from /etc/letsencrypt/renewal/plusload.net-0001.conf produced an unexpected error: Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.

と出て証明書の更新に失敗するので以下を試した。

root@plusload:~/certbot# ./certbot-auto certonly -d plusload.net
Your system is not supported by certbot-auto anymore.
certbot-auto and its Certbot installation will no longer receive updates.
You will not receive any bug fixes including those fixing server compatibility
or security problems.
Please visit https://certbot.eff.org/ to check for other alternatives.
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Apache Web Server plugin (apache)
2: Nginx Web Server plugin (nginx)
3: Spin up a temporary webserver (standalone)
4: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-4] then [enter] (press 'c' to cancel): 4
Plugins selected: Authenticator webroot, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for plusload.net
Input the webroot for plusload.net: (Enter 'c' to cancel):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 does not exist or is not a directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Input the webroot for plusload.net: (Enter 'c' to cancel): /var/www/wordpress
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/plusload.net-0001/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/plusload.net-0001/privkey.pem
   Your cert will expire on 2021-08-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - 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

なんか成功したっぽい。なので普通に試してみる。

root@plusload:~/certbot# ./certbot-auto renew
Your system is not supported by certbot-auto anymore.
certbot-auto and its Certbot installation will no longer receive updates.
You will not receive any bug fixes including those fixing server compatibility
or security problems.
Please visit https://certbot.eff.org/ to check for other alternatives.
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/plusload.net-0001.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not yet due for renewal

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/plusload.net.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following certs are not due for renewal yet:
  /etc/letsencrypt/live/plusload.net-0001/fullchain.pem expires on 2021-08-05 (skipped)
No renewals were attempted.

Additionally, the following renewal configurations were invalid:
  /etc/letsencrypt/renewal/plusload.net.conf (parsefail)

8月5日まで三か月伸びたみたい。

でも、certbotの仕様が変更になったらしい。だから

root@plusload~:# certbot-auto renew

が使えなくなったようだ。なのでこちらを参考にcertbotの更新をする。ただし内容はubuntuでnginxの場合。別の場合はトップに戻って環境にあわせて項目を選択したページを見てください。

Ubuntuの場合は最初からsnapedはインストールされているらしい。
なので

root@plusload~:# sudo snap install core
root@plusload~:# sudo snap refresh core

で、certbotを削除する。

root@plusload~:# sudo apt-get remove certbot

僕の環境の場合は以降でエラーが出た

root@plusload~:# sudo snap install --classic certbot

error: snap "certbot" is not available on stable but is available to install on
the following channels:

edge snap install --edge certbot

Please be mindful pre-release channels may include features not
completely tested or implemented. Get more information with 'snap info
certbot'.

なので

root@plusload~:# sudo snap install --edge certbot --classic
certbot (edge) 1.5.0-22-g961c57386 from Certbot Project (certbot-eff?) installed

よくわからんがedgeをインストールしてcertbotの存在を確認する。

root@plusload~:# sudo snap install --classic certbot
snap "certbot" is already installed, see 'snap help refresh'

既にインストールされていると出ている。なので続けて

root@plusload:~$ sudo ln -s /snap/bin/certbot /usr/bin/certbot
root@plusload:~$ sudo certbot --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: plusload.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
Attempting to parse the version 1.9.0 renewal configuration file found at /etc/letsencrypt/renewal/plusload.net-0001.conf with version 1.6.0.dev0 of Certbot. This might not work.
Attempting to parse the version 1.8.0 renewal configuration file found at /etc/letsencrypt/renewal/plusload.net.conf with version 1.6.0.dev0 of Certbot. This might not work.
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/plusload.net-0001.conf)

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 #引き続き証明書を使うので2を選択
Renewing an existing certificate
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/default
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on [::]:80, ignored
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/default
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on [::]:80, ignored

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Your existing certificate has been successfully renewed, and the new certificate
has been installed.

The new certificate covers the following domains: https://plusload.net

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=plusload.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/plusload.net-0001/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/plusload.net-0001/privkey.pem
Your cert will expire on 2021-08-08. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- 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

root@plusload:~$ sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/plusload.net-0001.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator nginx, Installer nginx
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for plusload.net
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on [::]:80, ignored
Waiting for verification...
Cleaning up challenges
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on [::]:80, ignored
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "plusload.net" on [::]:80, ignored

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed with reload of nginx server; fullchain is
/etc/letsencrypt/live/plusload.net-0001/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/plusload.net.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Attempting to parse the version 1.8.0 renewal configuration file found at /etc/letsencrypt/renewal/plusload.net.conf with version 1.6.0.dev0 of Certbot. This might not work.

Traceback (most recent call last):
File "/snap/certbot/356/lib/python3.6/site-packages/certbot/_internal/renewal.py", line 64, in _reconstitute
renewal_candidate = storage.RenewableCert(full_path, config)
File "/snap/certbot/356/lib/python3.6/site-packages/certbot/_internal/storage.py", line 466, in __init__
self._check_symlinks()
File "/snap/certbot/356/lib/python3.6/site-packages/certbot/_internal/storage.py", line 533, in _check_symlinks
"expected {0} to be a symlink".format(link))
certbot.errors.CertStorageError: expected /etc/letsencrypt/live/plusload.net/cert.pem to be a symlink
Renewal configuration file /etc/letsencrypt/renewal/plusload.net.conf is broken. Skipping.

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

Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/plusload.net-0001/fullchain.pem (success)

Additionally, the following renewal configurations were invalid:
/etc/letsencrypt/renewal/plusload.net.conf (parsefail)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 renew failure(s), 1 parse failure(s)

IMPORTANT NOTES:
- 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.

成功しているようだ。なのでコマンドが変わっているのでcrontabも更新しておく。

root@plusload:~$ crontab -e

0 1 1 * * sudo certbot renew && systemctl restart nginx > /home/root/log/certbot.log

これで更新されるだろ。

コメントを残す

メールアドレスが公開されることはありません。必須項目には印がついています *

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)