LoginSignup
1
0

More than 3 years have passed since last update.

Amazon Linux 2017.03 + nginx 環境にCertbotを使ってLet's Encrypt!! あと自動更新

Posted at

概要

ちょっと古い環境を証明書入れないで運用していたがHTTPSにしないと問題になる要件が発生したので、Let's Encryptを利用してHTTPS化していく。

最後にHTTPSにリダイレクトする設定を行っていないが、要件的に必要ないのであればリダイレクトさせたほうが良いです。

散々擦られたネタではあると思うが自分の学習と実績用。

環境

  • Amazon Linux AMI release 2017.03
  • nginx/1.10.3

参考

CertbotのCentOS6 + nignx
https://certbot.eff.org/lets-encrypt/centos6-nginx

手順

以下EC2上の操作

Certbotの取得

$ wget https://dl.eff.org/certbot-auto
$ sudo mv certbot-auto /usr/local/bin/certbot-auto
$ sudo chown root /usr/local/bin/certbot-auto
$ sudo chmod 0755 /usr/local/bin/certbot-auto

Certbotの実行

  • Amazon LinuxでCertbotを実行するには --debug オプションをつける必要がある。
    • 要約するとAmazon Linux上での実行は実験的なものだからバックアップ取って--debugオプションをつけて実行してね
    • 付けない場合はFATAL ERRORになる
      $ sudo /usr/local/bin/certbot-auto --nginx
      FATAL: Amazon Linux support is very experimental at present...
      if you would like to work on improving it, please ensure you have backups
      and then run this script again with the --debug flag!
      Alternatively, you can install OS dependencies yourself and run this script
      again with --no-bootstrap.
      

      $ sudo /usr/local/bin/certbot-auto --nginx --debug
      

      INSTALL DUMP
      $ sudo /usr/local/bin/certbot-auto --nginx --debug
      Bootstrapping dependencies for Amazon... (you can skip this with --no-bootstrap)
      yum は /usr/bin/yum です
      yum はハッシュされています (/usr/bin/yum)
      読み込んだプラグイン:priorities, update-motd, upgrade-helper
      amzn-main                                                                                                                                           | 2.1 kB  00:00:00
      amzn-updates                                                                                                                                        | 2.5 kB  00:00:00
      40 packages excluded due to repository priority protections
      依存性の解決をしています
      --> トランザクションの確認を実行しています。
      ---> パッケージ augeas-libs.x86_64 0:1.0.0-5.7.amzn1 を インストール
      ---> パッケージ ca-certificates.noarch 0:2015.2.6-65.0.1.16.amzn1 を 更新
      ---> パッケージ ca-certificates.noarch 0:2018.2.22-65.1.20.amzn1 を アップデート
      ---> パッケージ gcc.noarch 0:4.8.3-3.20.amzn1 を 更新
      --> 依存性の処理をしています: gcc = 4.8.3-3.20.amzn1 のパッケージ: gcc-c++-4.8.3-3.20.amzn1.noarch
      ---> パッケージ gcc.noarch 0:4.8.5-1.22.amzn1 を アップデート
      --> 依存性の処理をしています: gcc48 >= 4.8.5 のパッケージ: gcc-4.8.5-1.22.amzn1.noarch
      ---> パッケージ libffi-devel.x86_64 0:3.0.13-16.5.amzn1 を インストール
      ---> パッケージ mod_ssl.x86_64 1:2.2.34-1.16.amzn1 を インストール
      --> 依存性の処理をしています: httpd = 2.2.34-1.16.amzn1 のパッケージ: 1:mod_ssl-2.2.34-1.16.amzn1.x86_64
      ---> パッケージ openssl.x86_64 1:1.0.1k-15.99.amzn1 を 更新
      ---> パッケージ openssl.x86_64 1:1.0.2k-16.150.amzn1 を アップデート
      ---> パッケージ openssl-devel.x86_64 1:1.0.2k-16.150.amzn1 を インストール
      --> 依存性の処理をしています: zlib-devel(x86-64) のパッケージ: 1:openssl-devel-1.0.2k-16.150.amzn1.x86_64
      --> 依存性の処理をしています: krb5-devel(x86-64) のパッケージ: 1:openssl-devel-1.0.2k-16.150.amzn1.x86_64
      ---> パッケージ python27-devel.x86_64 0:2.7.12-2.120.amzn1 を 更新
      ---> パッケージ python27-devel.x86_64 0:2.7.16-1.127.amzn1 を アップデート
      --> 依存性の処理をしています: python27(x86-64) = 2.7.16-1.127.amzn1 のパッケージ: python27-devel-2.7.16-1.127.amzn1.x86_64
      --> 依存性の処理をしています: python27(x86-64) = 2.7.16-1.127.amzn1 のパッケージ: python27-devel-2.7.16-1.127.amzn1.x86_64
      --> 依存性の処理をしています: python27(x86-64) = 2.7.16-1.127.amzn1 のパッケージ: python27-devel-2.7.16-1.127.amzn1.x86_64
      ---> パッケージ python27-pip.noarch 0:6.1.1-1.23.amzn1 を 更新
      ---> パッケージ python27-pip.noarch 0:9.0.3-1.26.amzn1 を アップデート
      ---> パッケージ python27-tools.x86_64 0:2.7.16-1.127.amzn1 を インストール
      ---> パッケージ python27-virtualenv.noarch 0:12.0.7-1.13.amzn1 を 更新
      ---> パッケージ python27-virtualenv.noarch 0:15.1.0-1.14.amzn1 を アップデート
      ---> パッケージ system-rpm-config.noarch 0:9.0.3-42.28.amzn1 を インストール
      --> トランザクションの確認を実行しています。
      ---> パッケージ gcc-c++.noarch 0:4.8.3-3.20.amzn1 を 更新
      ---> パッケージ gcc-c++.noarch 0:4.8.5-1.22.amzn1 を アップデート
      --> 依存性の処理をしています: gcc48-c++ >= 4.8.5 のパッケージ: gcc-c++-4.8.5-1.22.amzn1.noarch
      --> 依存性の処理をしています: libstdc++48 >= 4.8.5 のパッケージ: gcc-c++-4.8.5-1.22.amzn1.noarch
      ---> パッケージ gcc48.x86_64 0:4.8.3-9.111.amzn1 を 更新
      ---> パッケージ gcc48.x86_64 0:4.8.5-28.142.amzn1 を アップデート
      --> 依存性の処理をしています: libgcc48(x86-64) = 4.8.5 のパッケージ: gcc48-4.8.5-28.142.amzn1.x86_64
      --> 依存性の処理をしています: cpp48(x86-64) = 4.8.5-28.142.amzn1 のパッケージ: gcc48-4.8.5-28.142.amzn1.x86_64
      --> 依存性の処理をしています: libgomp(x86-64) >= 4.8.5-28.142.amzn1 のパッケージ: gcc48-4.8.5-28.142.amzn1.x86_64
      --> 依存性の処理をしています: libgcc(x86-64) >= 4.8.5-28.142.amzn1 のパッケージ: gcc48-4.8.5-28.142.amzn1.x86_64
      ---> パッケージ httpd.x86_64 0:2.2.32-1.9.amzn1 を 更新
      ---> パッケージ httpd.x86_64 0:2.2.34-1.16.amzn1 を アップデート
      --> 依存性の処理をしています: httpd-tools = 2.2.34-1.16.amzn1 のパッケージ: httpd-2.2.34-1.16.amzn1.x86_64
      ---> パッケージ krb5-devel.x86_64 0:1.15.1-34.44.amzn1 を インストール
      --> 依存性の処理をしています: libkadm5(x86-64) = 1.15.1-34.44.amzn1 のパッケージ: krb5-devel-1.15.1-34.44.amzn1.x86_64
      --> 依存性の処理をしています: krb5-libs(x86-64) = 1.15.1-34.44.amzn1 のパッケージ: krb5-devel-1.15.1-34.44.amzn1.x86_64
      --> 依存性の処理をしています: libverto-devel のパッケージ: krb5-devel-1.15.1-34.44.amzn1.x86_64
      --> 依存性の処理をしています: libselinux-devel のパッケージ: krb5-devel-1.15.1-34.44.amzn1.x86_64
      --> 依存性の処理をしています: libcom_err-devel のパッケージ: krb5-devel-1.15.1-34.44.amzn1.x86_64
      --> 依存性の処理をしています: keyutils-libs-devel のパッケージ: krb5-devel-1.15.1-34.44.amzn1.x86_64
      ---> パッケージ python27.x86_64 0:2.7.12-2.120.amzn1 を 更新
      ---> パッケージ python27.x86_64 0:2.7.16-1.127.amzn1 を アップデート
      --> 依存性の処理をしています: python27-libs(x86-64) = 2.7.16-1.127.amzn1 のパッケージ: python27-2.7.16-1.127.amzn1.x86_64
      ---> パッケージ zlib-devel.x86_64 0:1.2.8-7.18.amzn1 を インストール
      --> トランザクションの確認を実行しています。
      ---> パッケージ cpp48.x86_64 0:4.8.3-9.111.amzn1 を 更新
      ---> パッケージ cpp48.x86_64 0:4.8.5-28.142.amzn1 を アップデート
      ---> パッケージ gcc48-c++.x86_64 0:4.8.3-9.111.amzn1 を 更新
      ---> パッケージ gcc48-c++.x86_64 0:4.8.5-28.142.amzn1 を 非推奨
      ---> パッケージ httpd-tools.x86_64 0:2.2.32-1.9.amzn1 を 更新
      ---> パッケージ httpd-tools.x86_64 0:2.2.34-1.16.amzn1 を アップデート
      ---> パッケージ keyutils-libs-devel.x86_64 0:1.5.8-3.12.amzn1 を インストール
      ---> パッケージ krb5-libs.x86_64 0:1.14.1-27.41.amzn1 を 更新
      ---> パッケージ krb5-libs.x86_64 0:1.15.1-34.44.amzn1 を アップデート
      ---> パッケージ libcom_err-devel.x86_64 0:1.43.5-2.43.amzn1 を インストール
      --> 依存性の処理をしています: libcom_err(x86-64) = 1.43.5-2.43.amzn1 のパッケージ: libcom_err-devel-1.43.5-2.43.amzn1.x86_64
      ---> パッケージ libgcc48.x86_64 0:4.8.3-9.111.amzn1 を 更新
      ---> パッケージ libgcc48.x86_64 0:4.8.5-28.142.amzn1 を アップデート
      ---> パッケージ libgomp.x86_64 0:4.8.3-9.111.amzn1 を 更新
      ---> パッケージ libgomp.x86_64 0:6.4.1-1.45.amzn1 を アップデート
      ---> パッケージ libkadm5.x86_64 0:1.15.1-34.44.amzn1 を インストール
      ---> パッケージ libselinux-devel.x86_64 0:2.1.10-3.22.amzn1 を インストール
      --> 依存性の処理をしています: libsepol-devel >= 2.1.5-1 のパッケージ: libselinux-devel-2.1.10-3.22.amzn1.x86_64
      --> 依存性の処理をしています: pkgconfig(libsepol) のパッケージ: libselinux-devel-2.1.10-3.22.amzn1.x86_64
      ---> パッケージ libstdc++48.x86_64 0:4.8.3-9.111.amzn1 を 更新
      ---> パッケージ libstdc++48.x86_64 0:4.8.5-28.142.amzn1 を アップデート
      ---> パッケージ libstdc++48-devel.x86_64 0:4.8.3-9.111.amzn1 を 不要
      ---> パッケージ libverto-devel.x86_64 0:0.2.5-4.9.amzn1 を インストール
      ---> パッケージ python27-libs.x86_64 0:2.7.12-2.120.amzn1 を 更新
      ---> パッケージ python27-libs.x86_64 0:2.7.16-1.127.amzn1 を アップデート
      --> トランザクションの確認を実行しています。
      ---> パッケージ libcom_err.x86_64 0:1.42.12-4.40.amzn1 を 更新
      --> 依存性の処理をしています: libcom_err(x86-64) = 1.42.12-4.40.amzn1 のパッケージ: e2fsprogs-1.42.12-4.40.amzn1.x86_64
      --> 依存性の処理をしています: libcom_err(x86-64) = 1.42.12-4.40.amzn1 のパッケージ: libss-1.42.12-4.40.amzn1.x86_64
      --> 依存性の処理をしています: libcom_err(x86-64) = 1.42.12-4.40.amzn1 のパッケージ: e2fsprogs-libs-1.42.12-4.40.amzn1.x86_64
      ---> パッケージ libcom_err.x86_64 0:1.43.5-2.43.amzn1 を アップデート
      ---> パッケージ libsepol-devel.x86_64 0:2.1.7-3.12.amzn1 を インストール
      --> トランザクションの確認を実行しています。
      ---> パッケージ e2fsprogs.x86_64 0:1.42.12-4.40.amzn1 を 更新
      ---> パッケージ e2fsprogs.x86_64 0:1.43.5-2.43.amzn1 を アップデート
      --> 依存性の処理をしています: libfuse.so.2(FUSE_2.8)(64bit) のパッケージ: e2fsprogs-1.43.5-2.43.amzn1.x86_64
      --> 依存性の処理をしています: libfuse.so.2(FUSE_2.6)(64bit) のパッケージ: e2fsprogs-1.43.5-2.43.amzn1.x86_64
      --> 依存性の処理をしています: libfuse.so.2(FUSE_2.5)(64bit) のパッケージ: e2fsprogs-1.43.5-2.43.amzn1.x86_64
      --> 依存性の処理をしています: libfuse.so.2()(64bit) のパッケージ: e2fsprogs-1.43.5-2.43.amzn1.x86_64
      ---> パッケージ e2fsprogs-libs.x86_64 0:1.42.12-4.40.amzn1 を 更新
      ---> パッケージ e2fsprogs-libs.x86_64 0:1.43.5-2.43.amzn1 を アップデート
      ---> パッケージ libss.x86_64 0:1.42.12-4.40.amzn1 を 更新
      ---> パッケージ libss.x86_64 0:1.43.5-2.43.amzn1 を アップデート
      --> トランザクションの確認を実行しています。
      ---> パッケージ fuse-libs.x86_64 0:2.9.4-1.18.amzn1 を インストール
      --> 依存性解決を終了しました。
      
      依存性を解決しました
      
      ===========================================================================================================================================================================
       Package                                      アーキテクチャー                バージョン                                       リポジトリー                           容量
      ===========================================================================================================================================================================
      インストール中:
       augeas-libs                                  x86_64                          1.0.0-5.7.amzn1                                  amzn-main                             345 k
       gcc48-c++                                    x86_64                          4.8.5-28.142.amzn1                               amzn-updates                          9.8 M
           libstdc++48-devel.x86_64 4.8.3-9.111.amzn1 を入れ替えます
       libffi-devel                                 x86_64                          3.0.13-16.5.amzn1                                amzn-main                              23 k
       mod_ssl                                      x86_64                          1:2.2.34-1.16.amzn1                              amzn-main                             107 k
       openssl-devel                                x86_64                          1:1.0.2k-16.150.amzn1                            amzn-updates                          1.7 M
       python27-tools                               x86_64                          2.7.16-1.127.amzn1                               amzn-updates                          712 k
       system-rpm-config                            noarch                          9.0.3-42.28.amzn1                                amzn-main                              63 k
      更新します:
       ca-certificates                              noarch                          2018.2.22-65.1.20.amzn1                          amzn-updates                          1.1 M
       gcc                                          noarch                          4.8.5-1.22.amzn1                                 amzn-main                             4.1 k
       openssl                                      x86_64                          1:1.0.2k-16.150.amzn1                            amzn-updates                          1.8 M
       python27-devel                               x86_64                          2.7.16-1.127.amzn1                               amzn-updates                          525 k
       python27-pip                                 noarch                          9.0.3-1.26.amzn1                                 amzn-updates                          2.3 M
       python27-virtualenv                          noarch                          15.1.0-1.14.amzn1                                amzn-main                             2.1 M
      依存性関連でのインストールをします:
       fuse-libs                                    x86_64                          2.9.4-1.18.amzn1                                 amzn-updates                           98 k
       keyutils-libs-devel                          x86_64                          1.5.8-3.12.amzn1                                 amzn-main                              37 k
       krb5-devel                                   x86_64                          1.15.1-34.44.amzn1                               amzn-updates                          292 k
       libcom_err-devel                             x86_64                          1.43.5-2.43.amzn1                                amzn-updates                           36 k
       libkadm5                                     x86_64                          1.15.1-34.44.amzn1                               amzn-updates                          201 k
       libselinux-devel                             x86_64                          2.1.10-3.22.amzn1                                amzn-main                             157 k
       libsepol-devel                               x86_64                          2.1.7-3.12.amzn1                                 amzn-main                              70 k
       libverto-devel                               x86_64                          0.2.5-4.9.amzn1                                  amzn-main                              11 k
       zlib-devel                                   x86_64                          1.2.8-7.18.amzn1                                 amzn-main                              53 k
      依存性関連での更新をします:
       cpp48                                        x86_64                          4.8.5-28.142.amzn1                               amzn-updates                          6.7 M
       e2fsprogs                                    x86_64                          1.43.5-2.43.amzn1                                amzn-updates                          1.5 M
       e2fsprogs-libs                               x86_64                          1.43.5-2.43.amzn1                                amzn-updates                          208 k
       gcc-c++                                      noarch                          4.8.5-1.22.amzn1                                 amzn-main                             4.0 k
       gcc48                                        x86_64                          4.8.5-28.142.amzn1                               amzn-updates                           18 M
       httpd                                        x86_64                          2.2.34-1.16.amzn1                                amzn-main                             1.2 M
       httpd-tools                                  x86_64                          2.2.34-1.16.amzn1                                amzn-main                              80 k
       krb5-libs                                    x86_64                          1.15.1-34.44.amzn1                               amzn-updates                          882 k
       libcom_err                                   x86_64                          1.43.5-2.43.amzn1                                amzn-updates                           47 k
       libgcc48                                     x86_64                          4.8.5-28.142.amzn1                               amzn-updates                          155 k
       libgomp                                      x86_64                          6.4.1-1.45.amzn1                                 amzn-main                             204 k
       libss                                        x86_64                          1.43.5-2.43.amzn1                                amzn-updates                           52 k
       libstdc++48                                  x86_64                          4.8.5-28.142.amzn1                               amzn-updates                          408 k
       python27                                     x86_64                          2.7.16-1.127.amzn1                               amzn-updates                          103 k
       python27-libs                                x86_64                          2.7.16-1.127.amzn1                               amzn-updates                          6.8 M
      
      トランザクションの要約
      ===========================================================================================================================================================================
      インストール  7 パッケージ (+ 9 個の依存関係のパッケージ)
      更新          6 パッケージ (+15 個の依存関係のパッケージ)
      
      総ダウンロード容量: 58 M
      Is this ok [y/d/N]: y
      Downloading packages:
      (1/37): augeas-libs-1.0.0-5.7.amzn1.x86_64.rpm                                                                                                      | 345 kB  00:00:00
      (2/37): ca-certificates-2018.2.22-65.1.20.amzn1.noarch.rpm                                                                                          | 1.1 MB  00:00:00
      (3/37): e2fsprogs-1.43.5-2.43.amzn1.x86_64.rpm                                                                                                      | 1.5 MB  00:00:00
      (4/37): cpp48-4.8.5-28.142.amzn1.x86_64.rpm                                                                                                         | 6.7 MB  00:00:00
      (5/37): e2fsprogs-libs-1.43.5-2.43.amzn1.x86_64.rpm                                                                                                 | 208 kB  00:00:00
      (6/37): fuse-libs-2.9.4-1.18.amzn1.x86_64.rpm                                                                                                       |  98 kB  00:00:00
      (7/37): gcc-4.8.5-1.22.amzn1.noarch.rpm                                                                                                             | 4.1 kB  00:00:00
      (8/37): gcc-c++-4.8.5-1.22.amzn1.noarch.rpm                                                                                                         | 4.0 kB  00:00:00
      (9/37): gcc48-c++-4.8.5-28.142.amzn1.x86_64.rpm                                                                                                     | 9.8 MB  00:00:00
      (10/37): httpd-tools-2.2.34-1.16.amzn1.x86_64.rpm                                                                                                   |  80 kB  00:00:00
      (11/37): httpd-2.2.34-1.16.amzn1.x86_64.rpm                                                                                                         | 1.2 MB  00:00:00
      (12/37): gcc48-4.8.5-28.142.amzn1.x86_64.rpm                                                                                                        |  18 MB  00:00:00
      (13/37): keyutils-libs-devel-1.5.8-3.12.amzn1.x86_64.rpm                                                                                            |  37 kB  00:00:00
      (14/37): krb5-devel-1.15.1-34.44.amzn1.x86_64.rpm                                                                                                   | 292 kB  00:00:00
      (15/37): libcom_err-1.43.5-2.43.amzn1.x86_64.rpm                                                                                                    |  47 kB  00:00:00
      (16/37): krb5-libs-1.15.1-34.44.amzn1.x86_64.rpm                                                                                                    | 882 kB  00:00:00
      (17/37): libcom_err-devel-1.43.5-2.43.amzn1.x86_64.rpm                                                                                              |  36 kB  00:00:00
      (18/37): libgcc48-4.8.5-28.142.amzn1.x86_64.rpm                                                                                                     | 155 kB  00:00:00
      (19/37): libkadm5-1.15.1-34.44.amzn1.x86_64.rpm                                                                                                     | 201 kB  00:00:00
      (20/37): libffi-devel-3.0.13-16.5.amzn1.x86_64.rpm                                                                                                  |  23 kB  00:00:00
      (21/37): libgomp-6.4.1-1.45.amzn1.x86_64.rpm                                                                                                        | 204 kB  00:00:00
      (22/37): libselinux-devel-2.1.10-3.22.amzn1.x86_64.rpm                                                                                              | 157 kB  00:00:00
      (23/37): libsepol-devel-2.1.7-3.12.amzn1.x86_64.rpm                                                                                                 |  70 kB  00:00:00
      (24/37): libverto-devel-0.2.5-4.9.amzn1.x86_64.rpm                                                                                                  |  11 kB  00:00:00
      (25/37): mod_ssl-2.2.34-1.16.amzn1.x86_64.rpm                                                                                                       | 107 kB  00:00:00
      (26/37): libss-1.43.5-2.43.amzn1.x86_64.rpm                                                                                                         |  52 kB  00:00:00
      (27/37): libstdc++48-4.8.5-28.142.amzn1.x86_64.rpm                                                                                                  | 408 kB  00:00:00
      (28/37): openssl-1.0.2k-16.150.amzn1.x86_64.rpm                                                                                                     | 1.8 MB  00:00:00
      (29/37): openssl-devel-1.0.2k-16.150.amzn1.x86_64.rpm                                                                                               | 1.7 MB  00:00:00
      (30/37): python27-2.7.16-1.127.amzn1.x86_64.rpm                                                                                                     | 103 kB  00:00:00
      (31/37): python27-devel-2.7.16-1.127.amzn1.x86_64.rpm                                                                                               | 525 kB  00:00:00
      (32/37): python27-pip-9.0.3-1.26.amzn1.noarch.rpm                                                                                                   | 2.3 MB  00:00:00
      (33/37): python27-libs-2.7.16-1.127.amzn1.x86_64.rpm                                                                                                | 6.8 MB  00:00:00
      (34/37): python27-tools-2.7.16-1.127.amzn1.x86_64.rpm                                                                                               | 712 kB  00:00:00
      (35/37): system-rpm-config-9.0.3-42.28.amzn1.noarch.rpm                                                                                             |  63 kB  00:00:00
      (36/37): zlib-devel-1.2.8-7.18.amzn1.x86_64.rpm                                                                                                     |  53 kB  00:00:00
      (37/37): python27-virtualenv-15.1.0-1.14.amzn1.noarch.rpm                                                                                           | 2.1 MB  00:00:00
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      合計                                                                                                                                        37 MB/s |  58 MB  00:00:01
      Running transaction check
      Running transaction test
      Transaction test succeeded
      Running transaction
        更新します              : libcom_err-1.43.5-2.43.amzn1.x86_64                                                                                                       1/60
        更新します              : 1:openssl-1.0.2k-16.150.amzn1.x86_64                                                                                                      2/60
        更新します              : krb5-libs-1.15.1-34.44.amzn1.x86_64                                                                                                       3/60
        更新します              : libgcc48-4.8.5-28.142.amzn1.x86_64                                                                                                        4/60
        更新します              : libstdc++48-4.8.5-28.142.amzn1.x86_64                                                                                                     5/60
        更新します              : python27-2.7.16-1.127.amzn1.x86_64                                                                                                        6/60
        更新します              : python27-libs-2.7.16-1.127.amzn1.x86_64                                                                                                   7/60
        更新します              : python27-devel-2.7.16-1.127.amzn1.x86_64                                                                                                  8/60
        インストール中          : libkadm5-1.15.1-34.44.amzn1.x86_64                                                                                                        9/60
        更新します              : httpd-tools-2.2.34-1.16.amzn1.x86_64                                                                                                     10/60
        更新します              : httpd-2.2.34-1.16.amzn1.x86_64                                                                                                           11/60
        更新します              : e2fsprogs-libs-1.43.5-2.43.amzn1.x86_64                                                                                                  12/60
        インストール中          : libcom_err-devel-1.43.5-2.43.amzn1.x86_64                                                                                                13/60
        更新します              : libss-1.43.5-2.43.amzn1.x86_64                                                                                                           14/60
        インストール中          : libverto-devel-0.2.5-4.9.amzn1.x86_64                                                                                                    15/60
        更新します              : ca-certificates-2018.2.22-65.1.20.amzn1.noarch                                                                                           16/60
      warning: /etc/pki/java/cacerts created as /etc/pki/java/cacerts.rpmnew
      warning: /etc/pki/tls/certs/ca-bundle.crt created as /etc/pki/tls/certs/ca-bundle.crt.rpmnew
      warning: /etc/pki/tls/certs/ca-bundle.trust.crt created as /etc/pki/tls/certs/ca-bundle.trust.crt.rpmnew
        更新します              : python27-pip-9.0.3-1.26.amzn1.noarch                                                                                                     17/60
        更新します              : libgomp-6.4.1-1.45.amzn1.x86_64                                                                                                          18/60
        インストール中          : libsepol-devel-2.1.7-3.12.amzn1.x86_64                                                                                                   19/60
        インストール中          : libselinux-devel-2.1.10-3.22.amzn1.x86_64                                                                                                20/60
        インストール中          : fuse-libs-2.9.4-1.18.amzn1.x86_64                                                                                                        21/60
        更新します              : cpp48-4.8.5-28.142.amzn1.x86_64                                                                                                          22/60
        更新します              : gcc48-4.8.5-28.142.amzn1.x86_64                                                                                                          23/60
        更新します              : gcc-4.8.5-1.22.amzn1.noarch                                                                                                              24/60
        インストール中          : gcc48-c++-4.8.5-28.142.amzn1.x86_64                                                                                                      25/60
        インストール中          : zlib-devel-1.2.8-7.18.amzn1.x86_64                                                                                                       26/60
        インストール中          : keyutils-libs-devel-1.5.8-3.12.amzn1.x86_64                                                                                              27/60
        インストール中          : krb5-devel-1.15.1-34.44.amzn1.x86_64                                                                                                     28/60
        インストール中          : 1:openssl-devel-1.0.2k-16.150.amzn1.x86_64                                                                                               29/60
        更新します              : gcc-c++-4.8.5-1.22.amzn1.noarch                                                                                                          30/60
        更新します              : e2fsprogs-1.43.5-2.43.amzn1.x86_64                                                                                                       31/60
        更新します              : python27-virtualenv-15.1.0-1.14.amzn1.noarch                                                                                             32/60
        インストール中          : 1:mod_ssl-2.2.34-1.16.amzn1.x86_64                                                                                                       33/60
        インストール中          : python27-tools-2.7.16-1.127.amzn1.x86_64                                                                                                 34/60
        インストール中          : augeas-libs-1.0.0-5.7.amzn1.x86_64                                                                                                       35/60
        インストール中          : libffi-devel-3.0.13-16.5.amzn1.x86_64                                                                                                    36/60
        インストール中          : system-rpm-config-9.0.3-42.28.amzn1.noarch                                                                                               37/60
        整理中                  : gcc-c++-4.8.3-3.20.amzn1.noarch                                                                                                          38/60
        整理中                  : e2fsprogs-1.42.12-4.40.amzn1.x86_64                                                                                                      39/60
        整理中                  : python27-virtualenv-12.0.7-1.13.amzn1.noarch                                                                                             40/60
        整理中                  : python27-devel-2.7.12-2.120.amzn1.x86_64                                                                                                 41/60
        整理中                  : python27-pip-6.1.1-1.23.amzn1.noarch                                                                                                     42/60
        整理中                  : gcc48-c++-4.8.3-9.111.amzn1.x86_64                                                                                                       43/60
        削除中                  : libstdc++48-devel-4.8.3-9.111.amzn1.x86_64                                                                                               44/60
        整理中                  : gcc-4.8.3-3.20.amzn1.noarch                                                                                                              45/60
        整理中                  : gcc48-4.8.3-9.111.amzn1.x86_64                                                                                                           46/60
        整理中                  : libstdc++48-4.8.3-9.111.amzn1.x86_64                                                                                                     47/60
        整理中                  : python27-libs-2.7.12-2.120.amzn1.x86_64                                                                                                  48/60
        整理中                  : python27-2.7.12-2.120.amzn1.x86_64                                                                                                       49/60
        整理中                  : e2fsprogs-libs-1.42.12-4.40.amzn1.x86_64                                                                                                 50/60
        整理中                  : libss-1.42.12-4.40.amzn1.x86_64                                                                                                          51/60
        整理中                  : httpd-2.2.32-1.9.amzn1.x86_64                                                                                                            52/60
        整理中                  : ca-certificates-2015.2.6-65.0.1.16.amzn1.noarch                                                                                          53/60
      Please ignore warnings about %{lpath}cacerts.rpmnew, they are expected as the new consolidated configuration feature is enabled
      Please ignore warnings about %{lpath}ca-bundle.crt.rpmnew, they are expected as the new consolidated configuration feature is enabled
      Please ignore warnings about %{lpath}ca-bundle.trust.crt.rpmnew, they are expected as the new consolidated configuration feature is enabled
        整理中                  : httpd-tools-2.2.32-1.9.amzn1.x86_64                                                                                                      54/60
        整理中                  : krb5-libs-1.14.1-27.41.amzn1.x86_64                                                                                                      55/60
        整理中                  : 1:openssl-1.0.1k-15.99.amzn1.x86_64                                                                                                      56/60
        整理中                  : libcom_err-1.42.12-4.40.amzn1.x86_64                                                                                                     57/60
        整理中                  : libgcc48-4.8.3-9.111.amzn1.x86_64                                                                                                        58/60
        整理中                  : cpp48-4.8.3-9.111.amzn1.x86_64                                                                                                           59/60
        整理中                  : libgomp-4.8.3-9.111.amzn1.x86_64                                                                                                         60/60
        検証中                  : libcom_err-1.43.5-2.43.amzn1.x86_64                                                                                                       1/60
        検証中                  : gcc-4.8.5-1.22.amzn1.noarch                                                                                                               2/60
        検証中                  : augeas-libs-1.0.0-5.7.amzn1.x86_64                                                                                                        3/60
        検証中                  : e2fsprogs-libs-1.43.5-2.43.amzn1.x86_64                                                                                                   4/60
        検証中                  : libstdc++48-4.8.5-28.142.amzn1.x86_64                                                                                                     5/60
        検証中                  : gcc-c++-4.8.5-1.22.amzn1.noarch                                                                                                           6/60
        検証中                  : libkadm5-1.15.1-34.44.amzn1.x86_64                                                                                                        7/60
        検証中                  : python27-2.7.16-1.127.amzn1.x86_64                                                                                                        8/60
        検証中                  : python27-devel-2.7.16-1.127.amzn1.x86_64                                                                                                  9/60
        検証中                  : python27-libs-2.7.16-1.127.amzn1.x86_64                                                                                                  10/60
        検証中                  : system-rpm-config-9.0.3-42.28.amzn1.noarch                                                                                               11/60
        検証中                  : libselinux-devel-2.1.10-3.22.amzn1.x86_64                                                                                                12/60
        検証中                  : gcc48-4.8.5-28.142.amzn1.x86_64                                                                                                          13/60
        検証中                  : keyutils-libs-devel-1.5.8-3.12.amzn1.x86_64                                                                                              14/60
        検証中                  : zlib-devel-1.2.8-7.18.amzn1.x86_64                                                                                                       15/60
        検証中                  : cpp48-4.8.5-28.142.amzn1.x86_64                                                                                                          16/60
        検証中                  : libcom_err-devel-1.43.5-2.43.amzn1.x86_64                                                                                                17/60
        検証中                  : httpd-tools-2.2.34-1.16.amzn1.x86_64                                                                                                     18/60
        検証中                  : libffi-devel-3.0.13-16.5.amzn1.x86_64                                                                                                    19/60
        検証中                  : fuse-libs-2.9.4-1.18.amzn1.x86_64                                                                                                        20/60
        検証中                  : krb5-devel-1.15.1-34.44.amzn1.x86_64                                                                                                     21/60
        検証中                  : e2fsprogs-1.43.5-2.43.amzn1.x86_64                                                                                                       22/60
        検証中                  : gcc48-c++-4.8.5-28.142.amzn1.x86_64                                                                                                      23/60
        検証中                  : 1:openssl-1.0.2k-16.150.amzn1.x86_64                                                                                                     24/60
        検証中                  : libss-1.43.5-2.43.amzn1.x86_64                                                                                                           25/60
        検証中                  : python27-pip-9.0.3-1.26.amzn1.noarch                                                                                                     26/60
        検証中                  : python27-tools-2.7.16-1.127.amzn1.x86_64                                                                                                 27/60
        検証中                  : libgcc48-4.8.5-28.142.amzn1.x86_64                                                                                                       28/60
        検証中                  : 1:openssl-devel-1.0.2k-16.150.amzn1.x86_64                                                                                               29/60
        検証中                  : libsepol-devel-2.1.7-3.12.amzn1.x86_64                                                                                                   30/60
        検証中                  : python27-virtualenv-15.1.0-1.14.amzn1.noarch                                                                                             31/60
        検証中                  : libgomp-6.4.1-1.45.amzn1.x86_64                                                                                                          32/60
        検証中                  : krb5-libs-1.15.1-34.44.amzn1.x86_64                                                                                                      33/60
        検証中                  : ca-certificates-2018.2.22-65.1.20.amzn1.noarch                                                                                           34/60
        検証中                  : libverto-devel-0.2.5-4.9.amzn1.x86_64                                                                                                    35/60
        検証中                  : httpd-2.2.34-1.16.amzn1.x86_64                                                                                                           36/60
        検証中                  : 1:mod_ssl-2.2.34-1.16.amzn1.x86_64                                                                                                       37/60
        検証中                  : libgomp-4.8.3-9.111.amzn1.x86_64                                                                                                         38/60
        検証中                  : python27-pip-6.1.1-1.23.amzn1.noarch                                                                                                     39/60
        検証中                  : libstdc++48-4.8.3-9.111.amzn1.x86_64                                                                                                     40/60
        検証中                  : ca-certificates-2015.2.6-65.0.1.16.amzn1.noarch                                                                                          41/60
        検証中                  : httpd-2.2.32-1.9.amzn1.x86_64                                                                                                            42/60
        検証中                  : python27-virtualenv-12.0.7-1.13.amzn1.noarch                                                                                             43/60
        検証中                  : python27-devel-2.7.12-2.120.amzn1.x86_64                                                                                                 44/60
        検証中                  : libgcc48-4.8.3-9.111.amzn1.x86_64                                                                                                        45/60
        検証中                  : 1:openssl-1.0.1k-15.99.amzn1.x86_64                                                                                                      46/60
        検証中                  : python27-libs-2.7.12-2.120.amzn1.x86_64                                                                                                  47/60
        検証中                  : httpd-tools-2.2.32-1.9.amzn1.x86_64                                                                                                      48/60
        検証中                  : e2fsprogs-libs-1.42.12-4.40.amzn1.x86_64                                                                                                 49/60
        検証中                  : libcom_err-1.42.12-4.40.amzn1.x86_64                                                                                                     50/60
        検証中                  : libstdc++48-devel-4.8.3-9.111.amzn1.x86_64                                                                                               51/60
        検証中                  : gcc48-4.8.3-9.111.amzn1.x86_64                                                                                                           52/60
        検証中                  : gcc-c++-4.8.3-3.20.amzn1.noarch                                                                                                          53/60
        検証中                  : krb5-libs-1.14.1-27.41.amzn1.x86_64                                                                                                      54/60
        検証中                  : libss-1.42.12-4.40.amzn1.x86_64                                                                                                          55/60
        検証中                  : python27-2.7.12-2.120.amzn1.x86_64                                                                                                       56/60
        検証中                  : e2fsprogs-1.42.12-4.40.amzn1.x86_64                                                                                                      57/60
        検証中                  : gcc-4.8.3-3.20.amzn1.noarch                                                                                                              58/60
        検証中                  : cpp48-4.8.3-9.111.amzn1.x86_64                                                                                                           59/60
        検証中                  : gcc48-c++-4.8.3-9.111.amzn1.x86_64                                                                                                       60/60
      
      インストール:
        augeas-libs.x86_64 0:1.0.0-5.7.amzn1        gcc48-c++.x86_64 0:4.8.5-28.142.amzn1       libffi-devel.x86_64 0:3.0.13-16.5.amzn1       mod_ssl.x86_64 1:2.2.34-1.16.amzn1
        openssl-devel.x86_64 1:1.0.2k-16.150.amzn1  python27-tools.x86_64 0:2.7.16-1.127.amzn1  system-rpm-config.noarch 0:9.0.3-42.28.amzn1
      
      依存性関連をインストールしました:
        fuse-libs.x86_64 0:2.9.4-1.18.amzn1  keyutils-libs-devel.x86_64 0:1.5.8-3.12.amzn1 krb5-devel.x86_64 0:1.15.1-34.44.amzn1   libcom_err-devel.x86_64 0:1.43.5-2.43.amzn1
        libkadm5.x86_64 0:1.15.1-34.44.amzn1 libselinux-devel.x86_64 0:2.1.10-3.22.amzn1   libsepol-devel.x86_64 0:2.1.7-3.12.amzn1 libverto-devel.x86_64 0:0.2.5-4.9.amzn1
        zlib-devel.x86_64 0:1.2.8-7.18.amzn1
      
      更新:
        ca-certificates.noarch 0:2018.2.22-65.1.20.amzn1            gcc.noarch 0:4.8.5-1.22.amzn1                     openssl.x86_64 1:1.0.2k-16.150.amzn1
        python27-devel.x86_64 0:2.7.16-1.127.amzn1                  python27-pip.noarch 0:9.0.3-1.26.amzn1            python27-virtualenv.noarch 0:15.1.0-1.14.amzn1
      
      依存性を更新しました:
        cpp48.x86_64 0:4.8.5-28.142.amzn1          e2fsprogs.x86_64 0:1.43.5-2.43.amzn1    e2fsprogs-libs.x86_64 0:1.43.5-2.43.amzn1    gcc-c++.noarch 0:4.8.5-1.22.amzn1
        gcc48.x86_64 0:4.8.5-28.142.amzn1          httpd.x86_64 0:2.2.34-1.16.amzn1        httpd-tools.x86_64 0:2.2.34-1.16.amzn1       krb5-libs.x86_64 0:1.15.1-34.44.amzn1
        libcom_err.x86_64 0:1.43.5-2.43.amzn1      libgcc48.x86_64 0:4.8.5-28.142.amzn1    libgomp.x86_64 0:6.4.1-1.45.amzn1            libss.x86_64 0:1.43.5-2.43.amzn1
        libstdc++48.x86_64 0:4.8.5-28.142.amzn1    python27.x86_64 0:2.7.16-1.127.amzn1    python27-libs.x86_64 0:2.7.16-1.127.amzn1
      
      置換:
        libstdc++48-devel.x86_64 0:4.8.3-9.111.amzn1
      
      完了しました!
      Creating virtual environment...
      Installing Python packages...
      Saving debug log to /var/log/letsencrypt/letsencrypt.log
      Plugins selected: Authenticator nginx, Installer nginx
      

      Email addressの入力

      • 失効やセキュリティ情報などの通知が届くので連絡用のメールアドレスを入力
      Enter email address (used for urgent renewal and security notices) (Enter 'c' to
      cancel):
      

      利用規約への同意

      • 同意したらAを入力してEnter
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Please read the Terms of Service at
      https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
      agree in order to register with the ACME server at
      https://acme-v02.api.letsencrypt.org/directory
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      (A)gree/(C)ancel:
      

      非営利団体にメールアドレスの共有を行うか

      • 行わないのでNを入力してEnter
      Would you be willing to share your email address with the Electronic Frontier
      Foundation, a founding partner of the Let's Encrypt project and the non-profit
      organization that develops Certbot? We'd like to send you email about our work
      encrypting the web, EFF news, campaigns, and ways to support digital freedom.
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      (Y)es/(N)o:
      

      証明書を発行するドメインの選択

      • 発行したいドメインの番号を入力してEnter
        • 複数選択する場合はカンマ区切り
      Which names would you like to activate HTTPS for?
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      1: foo.example.com
      2: bar.example.com
      3: buzz.example.com
      4: huga.example.com
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Select the appropriate numbers separated by commas and/or spaces, or leave input
      blank to select all options shown (Enter 'c' to cancel):
      

      ドメイン選択時のログ
      Select the appropriate numbers separated by commas and/or spaces, or leave input
      blank to select all options shown (Enter 'c' to cancel): 1
      Obtaining a new certificate
      Performing the following challenges:
      http-01 challenge for foo.example.com
      Waiting for verification...
      Cleaning up challenges
      Deploying Certificate to VirtualHost /etc/nginx/conf.d/foo.conf
      

      HTTP接続をHTTP2にリダイレクトするか

      • 今回はhttpを使いたい要件がまだ残っていたので1を入力してEnter
        • 1: リダイレクトしない
        • 2: リダイレクトする
      Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      1: No redirect - Make no further changes to the webserver configuration.
      2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
      new sites, or if you're confident your site works on HTTPS. You can undo this
      change by editing your web server's configuration.
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
      

      将来的には自動でリダイレクト設定にするようなので注意
      Future versions of Certbot will automatically configure the webserver so that all requests redirect to secure HTTPS access. You can control this behavior and disable this warning with the --redirect and --no-redirect flags.
      

      設定終了

      Congratulations!と共に該当のドメインのHTTPS化が終わっているはずなので実際にアクセスしてみる
      IMPORTANT NOTES に重要なことが書いてあることを忘れない

      Congratulations! You have successfully enabled https://foo.example.com
      
      You should test your configuration at:
      https://www.ssllabs.com/ssltest/analyze.html?d=foo.example.com
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      
      IMPORTANT NOTES:
       - Congratulations! Your certificate and chain have been saved at:
         /etc/letsencrypt/live/foo.example.com/fullchain.pem
         Your key file has been saved at:
         /etc/letsencrypt/live/foo.example.com/privkey.pem
         Your cert will expire on 2019-10-17. To obtain a new or tweaked
         version of this certificate in the future, simply run certbot-auto
         again with the "certonly" option. To non-interactively renew *all*
         of your certificates, run "certbot-auto renew"
       - 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.
       - 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
      

      自動更新の設定

      • crontabで土曜の0時,12時に更新設定を入れる
      echo "0 0,12 * * 6 root /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/cron.d/letsencrypt > /dev/null
      
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0