SSL証明書が期限切れ…

突然、サーバのWebサービスが見れなくなりました。

ブラウザのURLでhttps://が赤線になってるので、確認するとSSL証明書の有効期限が切れていました。

証明書は、無料のLet’s Encryptを使用していて、更新にはcronで実行されていたはずなのに、上手く動いていなかったらしく切れてしまいました。

また、切れてしまった際の備忘録として…

まずは、Webサーバのサービスを停めます。

# systemctl stop httpd.service

続けて証明書を更新

# ./certbot-auto certonly -standalone -d www.maruweb.jp.net
Bootstrapping dependencies for RedHat-based OSes... (you can skip this with --no-bootstrap)
yum は /bin/yum です
yum はハッシュされています (/bin/yum)
読み込んだプラグイン:langpacks, versionlock

~~ 中略 ~~

OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pip wheel failed with error code 1

実施してみましたが、OSエラーで失敗しました。どうやらpipのエラーらしい…

エラーで検索して、python-pipをアップグレードすればいいという記事を見つけたので実行

# yum install python-pip
# pip install --upgrade setuptools
# pip install --upgrade virtualenv
# pip install --upgrade pip

それぞれ、アップグレードされたので再度、証明書の更新

# ./certbot-auto certonly -d www.maruweb.jp.net
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: Spin up a temporary webserver (standalone)
3: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-3] then [enter] (press 'c' to cancel): 2
Plugins selected: Authenticator standalone, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for www.maruweb.jp.net
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/www.maruweb.jp.net/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/www.maruweb.jp.net/privkey.pem
   Your cert will expire on 2019-07-01. 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

更新されたようです。

10行目:7行目にある「2」を選択
20行目: このメッセージが出力されていれば成功しているようです。
24行目: 次回の更新日

Webサーバのサービスを起動します。

# systemctl start httpd.service

SSL証明書の有効期限を確認してみます。

# certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Attempting to parse the version 0.32.0 renewal configuration file found at /etc/letsencrypt/renewal/www.maruweb.jp.net.conf with version 0.31.0 of Certbot. This might not work.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: www.maruweb.jp.net
    Domains: www.maruweb.jp.net
    Expiry Date: 2019-07-01 14:43:33+00:00 (VALID: 80 days)
    Certificate Path: /etc/letsencrypt/live/www.maruweb.jp.net/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/www.maruweb.jp.net/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

9行目:有効期限は、2019/7/1までで、あと80日あるということです。

次回は、自動更新の設定について書きます。

いいね! & シェア お願いします。

コメントは受け付けていません。