フライトシミュレーター愛好家のノート

中文 English 日本語 Français Deutsch Español 한국어 Русский 繁體中文

Let's Encryptの電子証明書をインストールする

昨年は<a href="/x-plane10/2016/01/https.>ウェブサイトのHTTPS対応や<a href="/x-plane10/2016/09/observatory-mozilla-org.>observatory.mozilla.orgを利用したサイトのセキュリティ向上について書きましたが、 当時は有効期限1年のStartComの無料証明書を使用していました。 今月末で期限が切れるため、最近流行りのLet’s Encryptの電子証明書を試しに導入してみます。

まずMacで以下のコマンドを実行してcertbotをインストールします。 $ brew update $ brew install certbot $ brew ls certbot /usr/local/Cellar/certbot/0.9.3_1/bin/certbot /usr/local/Cellar/certbot/0.9.3_1/bin/letsencrypt /usr/local/Cellar/certbot/0.9.3_1/libexec/bin/ (18 files) /usr/local/Cellar/certbot/0.9.3_1/libexec/lib/ (1946 files) /usr/local/Cellar/certbot/0.9.3_1/libexec/ (2 files) /usr/local/Cellar/certbot/0.9.3_1/share/certbot/ (7 files)

次にMac上で実行します $ certbot –config-dir ~/letsencrypt/etc –work-dir ~/letsencrypt/lib –logs-dir ~/letsencrypt/log certonly –manual メールアドレスとドメインを入力し、 指示に従ってサーバー上に.well-known/acme-challenge/以下の認証ファイルを作成し、エンターキーを押します、

証明書の取得に成功したようで、以下の表示が得られました:

IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at /Users/laoyanhunhua/letsencrypt/etc/live//fullchain.pem. Your cert will expire on 2017-04-08. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - If you lose your account credentials, you can recover through e-mails sent to [email protected]. - Your account credentials have been saved in your Certbot configuration directory at /Users/laoyanhunhua/letsencrypt/etc. 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. - 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

ローカルのetc/live/yinlei.org/以下に4つのファイルが生成されているのが確認できます: cert.pem chain.pem fullchain.pem privkey.pem

その後、秘密鍵ファイルprivkey.pem、サイト証明書cert.pem、中間証明書chain.pemを順番にウェブサーバーに配置すればOKです。 (ドメイン設定→SSL証明書更新→秘密鍵をアップロードする→証明書のインストール→中間証明書のインストール ) Let’s Encryptの欠点は有効期限が3ヶ月しかないことで、本当に短すぎます。。

参考資料 Let’s Encrypt の使い方 Windows ユーザーの HTTPS化 - さくらのレンタルサーバ + Let’s Encrypt + WordPress マルチサイト let’s encrypt で複数ホスト名対応な証明書を作る

その後、ウェブサイトの最適化も行いました。 3つのCSSファイルを1つにまとめ、 JavaScript呼び出し時に非同期方式(asyncパラメータ追加)を使用するようにしたところ、 ページの表示速度がいくらか向上したと感じます。 Googleのtestmysite.thinkwithgoogle.comとPageSpeed Insightsツールでテストしたところ、確かに改善が見られました。

注 <a href="/x-plane10/2017/03/lets-encrypt-1.>Let’s Encrypt電子証明書の更新方法