LoginSignup
10
12

More than 5 years have passed since last update.

Let's EncryptでSSL通信をしてhttps化

Last updated at Posted at 2016-05-15

[目的] 
Let's Encryptで証明書を無料で発行し、SSL通信をしてWebサーバをhttps化する

必要なパッケージをインストール

Let's Encrypt のクライアントはGitHubで公開されているため、gitコマンドを使えるようにしておく。また、Apacheに必要なパッケージも事前にインストールしておく。

$ sudo yum install git openssl mod_ssl

$ git clone https://github.com/letsencrypt/letsencrypt.git
Cloning into 'letsencrypt'...
remote: Counting objects: 34827, done.
remote: Compressing objects: 100% (107/107), done.
remote: Total 34827 (delta 60), reused 0 (delta 0), pack-reused 34720
Receiving objects: 100% (34827/34827), 9.34 MiB | 1.38 MiB/s, done.
Resolving deltas: 100% (24733/24733), done.
$ cd letsencrypt/
$ ./letsencrypt-auto --help --debug
Bootstrapping dependencies for RedHat-based OSes...
yum は /usr/bin/yum です
[sudo] password for user1: 
読み込んだプラグイン:fastestmirror, remove-with-leaves, show-leaves
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
パッケージ python-2.7.5-34.el7.x86_64 はインストール済みか最新バージョンです
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ python-devel.x86_64 0:2.7.5-34.el7 を インストール
---> パッケージ python-pip.noarch 0:7.1.0-1.el7 を インストール
---> パッケージ python-tools.x86_64 0:2.7.5-34.el7 を インストール
--> 依存性の処理をしています: tkinter = 2.7.5-34.el7 のパッケージ: python-tools-2.7.5-34.el7.x86_64
---> パッケージ python-virtualenv.noarch 0:1.10.1-2.el7 を インストール
--> トランザクションの確認を実行しています。
---> パッケージ tkinter.x86_64 0:2.7.5-34.el7 を インストール
--> 依存性の処理をしています: libtk8.5.so()(64bit) のパッケージ: tkinter-2.7.5-34.el7.x86_64
--> 依存性の処理をしています: libX11.so.6()(64bit) のパッケージ: tkinter-2.7.5-34.el7.x86_64
--> 依存性の処理をしています: libTix.so()(64bit) のパッケージ: tkinter-2.7.5-34.el7.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ libX11.x86_64 0:1.6.3-2.el7 を インストール
--> 依存性の処理をしています: libX11-common >= 1.6.3-2.el7 のパッケージ: libX11-1.6.3-2.el7.x86_64
--> 依存性の処理をしています: libxcb.so.1()(64bit) のパッケージ: libX11-1.6.3-2.el7.x86_64
---> パッケージ tix.x86_64 1:8.4.3-12.el7 を インストール
---> パッケージ tk.x86_64 1:8.5.13-6.el7 を インストール
--> 依存性の処理をしています: libXft.so.2()(64bit) のパッケージ: 1:tk-8.5.13-6.el7.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ libX11-common.noarch 0:1.6.3-2.el7 を インストール
---> パッケージ libXft.x86_64 0:2.3.2-2.el7 を インストール
--> 依存性の処理をしています: fontconfig >= 2.2-1 のパッケージ: libXft-2.3.2-2.el7.x86_64
--> 依存性の処理をしています: libfontconfig.so.1()(64bit) のパッケージ: libXft-2.3.2-2.el7.x86_64
--> 依存性の処理をしています: libXrender.so.1()(64bit) のパッケージ: libXft-2.3.2-2.el7.x86_64
---> パッケージ libxcb.x86_64 0:1.11-4.el7 を インストール
--> 依存性の処理をしています: libXau.so.6()(64bit) のパッケージ: libxcb-1.11-4.el7.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ fontconfig.x86_64 0:2.10.95-7.el7 を インストール
--> 依存性の処理をしています: fontpackages-filesystem のパッケージ: fontconfig-2.10.95-7.el7.x86_64
---> パッケージ libXau.x86_64 0:1.0.8-2.1.el7 を インストール
---> パッケージ libXrender.x86_64 0:0.9.8-2.1.el7 を インストール
--> トランザクションの確認を実行しています。
---> パッケージ fontpackages-filesystem.noarch 0:1.44-8.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

=============================================================================================================================================================
 Package                                         アーキテクチャー               バージョン                                リポジトリー                  容量
=============================================================================================================================================================
インストール中:
 python-devel                                    x86_64                         2.7.5-34.el7                              base                         391 k
 python-pip                                      noarch                         7.1.0-1.el7                               epel                         1.5 M
 python-tools                                    x86_64                         2.7.5-34.el7                              base                         850 k
 python-virtualenv                               noarch                         1.10.1-2.el7                              base                         1.2 M
依存性関連でのインストールをします:
 fontconfig                                      x86_64                         2.10.95-7.el7                             base                         228 k
 fontpackages-filesystem                         noarch                         1.44-8.el7                                base                         9.9 k
 libX11                                          x86_64                         1.6.3-2.el7                               base                         605 k
 libX11-common                                   noarch                         1.6.3-2.el7                               base                         162 k
 libXau                                          x86_64                         1.0.8-2.1.el7                             base                          29 k
 libXft                                          x86_64                         2.3.2-2.el7                               base                          58 k
 libXrender                                      x86_64                         0.9.8-2.1.el7                             base                          25 k
 libxcb                                          x86_64                         1.11-4.el7                                base                         189 k
 tix                                             x86_64                         1:8.4.3-12.el7                            base                         254 k
 tk                                              x86_64                         1:8.5.13-6.el7                            base                         1.4 M
 tkinter                                         x86_64                         2.7.5-34.el7                              base                         319 k

トランザクションの要約
=============================================================================================================================================================
インストール  4 パッケージ (+11 個の依存関係のパッケージ)

総ダウンロード容量: 7.2 M
インストール容量: 22 M
Downloading packages:
(1/15): fontpackages-filesystem-1.44-8.el7.noarch.rpm                                                                                 | 9.9 kB  00:00:00     
(2/15): fontconfig-2.10.95-7.el7.x86_64.rpm                                                                                           | 228 kB  00:00:00     
(3/15): libXau-1.0.8-2.1.el7.x86_64.rpm                                                                                               |  29 kB  00:00:00     
(4/15): libX11-common-1.6.3-2.el7.noarch.rpm                                                                                          | 162 kB  00:00:00     
(5/15): libXft-2.3.2-2.el7.x86_64.rpm                                                                                                 |  58 kB  00:00:00     
(6/15): libXrender-0.9.8-2.1.el7.x86_64.rpm                                                                                           |  25 kB  00:00:00     
(7/15): libxcb-1.11-4.el7.x86_64.rpm                                                                                                  | 189 kB  00:00:00     
(8/15): libX11-1.6.3-2.el7.x86_64.rpm                                                                                                 | 605 kB  00:00:00     
(9/15): python-devel-2.7.5-34.el7.x86_64.rpm                                                                                          | 391 kB  00:00:00     
(10/15): python-tools-2.7.5-34.el7.x86_64.rpm                                                                                         | 850 kB  00:00:00     
(11/15): tix-8.4.3-12.el7.x86_64.rpm                                                                                                  | 254 kB  00:00:00     
(12/15): python-virtualenv-1.10.1-2.el7.noarch.rpm                                                                                    | 1.2 MB  00:00:00     
(13/15): tk-8.5.13-6.el7.x86_64.rpm                                                                                                   | 1.4 MB  00:00:00     
(14/15): python-pip-7.1.0-1.el7.noarch.rpm                                                                                            | 1.5 MB  00:00:00     
(15/15): tkinter-2.7.5-34.el7.x86_64.rpm                                                                                              | 319 kB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                          12 MB/s | 7.2 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : fontpackages-filesystem-1.44-8.el7.noarch                                                                                   1/15 
  インストール中          : fontconfig-2.10.95-7.el7.x86_64                                                                                             2/15 
  インストール中          : libXau-1.0.8-2.1.el7.x86_64                                                                                                 3/15 
  インストール中          : libxcb-1.11-4.el7.x86_64                                                                                                    4/15 
  インストール中          : libX11-common-1.6.3-2.el7.noarch                                                                                            5/15 
  インストール中          : libX11-1.6.3-2.el7.x86_64                                                                                                   6/15 
  インストール中          : libXrender-0.9.8-2.1.el7.x86_64                                                                                             7/15 
  インストール中          : libXft-2.3.2-2.el7.x86_64                                                                                                   8/15 
  インストール中          : 1:tk-8.5.13-6.el7.x86_64                                                                                                    9/15 
  インストール中          : 1:tix-8.4.3-12.el7.x86_64                                                                                                  10/15 
  インストール中          : tkinter-2.7.5-34.el7.x86_64                                                                                                11/15 
  インストール中          : python-devel-2.7.5-34.el7.x86_64                                                                                           12/15 
  インストール中          : python-virtualenv-1.10.1-2.el7.noarch                                                                                      13/15 
  インストール中          : python-tools-2.7.5-34.el7.x86_64                                                                                           14/15 
  インストール中          : python-pip-7.1.0-1.el7.noarch                                                                                              15/15 
  検証中                  : python-devel-2.7.5-34.el7.x86_64                                                                                            1/15 
  検証中                  : libX11-common-1.6.3-2.el7.noarch                                                                                            2/15 
  検証中                  : tkinter-2.7.5-34.el7.x86_64                                                                                                 3/15 
  検証中                  : python-virtualenv-1.10.1-2.el7.noarch                                                                                       4/15 
  検証中                  : libX11-1.6.3-2.el7.x86_64                                                                                                   5/15 
  検証中                  : libXft-2.3.2-2.el7.x86_64                                                                                                   6/15 
  検証中                  : fontconfig-2.10.95-7.el7.x86_64                                                                                             7/15 
  検証中                  : libxcb-1.11-4.el7.x86_64                                                                                                    8/15 
  検証中                  : libXau-1.0.8-2.1.el7.x86_64                                                                                                 9/15 
  検証中                  : 1:tix-8.4.3-12.el7.x86_64                                                                                                  10/15 
  検証中                  : 1:tk-8.5.13-6.el7.x86_64                                                                                                   11/15 
  検証中                  : python-pip-7.1.0-1.el7.noarch                                                                                              12/15 
  検証中                  : libXrender-0.9.8-2.1.el7.x86_64                                                                                            13/15 
  検証中                  : fontpackages-filesystem-1.44-8.el7.noarch                                                                                  14/15 
  検証中                  : python-tools-2.7.5-34.el7.x86_64                                                                                           15/15 

インストール:
  python-devel.x86_64 0:2.7.5-34.el7    python-pip.noarch 0:7.1.0-1.el7    python-tools.x86_64 0:2.7.5-34.el7    python-virtualenv.noarch 0:1.10.1-2.el7   

依存性関連をインストールしました:
  fontconfig.x86_64 0:2.10.95-7.el7   fontpackages-filesystem.noarch 0:1.44-8.el7   libX11.x86_64 0:1.6.3-2.el7         libX11-common.noarch 0:1.6.3-2.el7  
  libXau.x86_64 0:1.0.8-2.1.el7       libXft.x86_64 0:2.3.2-2.el7                   libXrender.x86_64 0:0.9.8-2.1.el7   libxcb.x86_64 0:1.11-4.el7          
  tix.x86_64 1:8.4.3-12.el7           tk.x86_64 1:8.5.13-6.el7                      tkinter.x86_64 0:2.7.5-34.el7      

完了しました!
New leaves:
  python-pip.noarch
  python-tools.x86_64
  python-virtualenv.noarch
読み込んだプラグイン:fastestmirror, remove-with-leaves, show-leaves
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
パッケージ gcc-4.8.5-4.el7.x86_64 はインストール済みか最新バージョンです
パッケージ 1:openssl-1.0.1e-51.el7_2.4.x86_64 はインストール済みか最新バージョンです
パッケージ 1:openssl-devel-1.0.1e-51.el7_2.4.x86_64 はインストール済みか最新バージョンです
パッケージ redhat-rpm-config-9.1.0-68.el7.centos.noarch はインストール済みか最新バージョンです
パッケージ ca-certificates-2015.2.6-70.1.el7_2.noarch はインストール済みか最新バージョンです
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ augeas-libs.x86_64 0:1.4.0-2.el7 を インストール
---> パッケージ dialog.x86_64 0:1.2-4.20130523.el7 を インストール
---> パッケージ libffi-devel.x86_64 0:3.0.13-16.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

=============================================================================================================================================================
 Package                                アーキテクチャー                 バージョン                                     リポジトリー                    容量
=============================================================================================================================================================
インストール中:
 augeas-libs                            x86_64                           1.4.0-2.el7                                    base                           355 k
 dialog                                 x86_64                           1.2-4.20130523.el7                             base                           208 k
 libffi-devel                           x86_64                           3.0.13-16.el7                                  base                            23 k

トランザクションの要約
=============================================================================================================================================================
インストール  3 パッケージ

総ダウンロード容量: 586 k
インストール容量: 1.6 M
Downloading packages:
(1/3): libffi-devel-3.0.13-16.el7.x86_64.rpm                                                                                          |  23 kB  00:00:00     
(2/3): augeas-libs-1.4.0-2.el7.x86_64.rpm                                                                                             | 355 kB  00:00:00     
(3/3): dialog-1.2-4.20130523.el7.x86_64.rpm                                                                                           | 208 kB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                         1.0 MB/s | 586 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : dialog-1.2-4.20130523.el7.x86_64                                                                                             1/3 
  インストール中          : augeas-libs-1.4.0-2.el7.x86_64                                                                                               2/3 
  インストール中          : libffi-devel-3.0.13-16.el7.x86_64                                                                                            3/3 
  検証中                  : libffi-devel-3.0.13-16.el7.x86_64                                                                                            1/3 
  検証中                  : augeas-libs-1.4.0-2.el7.x86_64                                                                                               2/3 
  検証中                  : dialog-1.2-4.20130523.el7.x86_64                                                                                             3/3 

インストール:
  augeas-libs.x86_64 0:1.4.0-2.el7                  dialog.x86_64 0:1.2-4.20130523.el7                  libffi-devel.x86_64 0:3.0.13-16.el7                 

完了しました!
New leaves:
  augeas-libs.x86_64
  dialog.x86_64
  libffi-devel.x86_64
読み込んだプラグイン:fastestmirror, remove-with-leaves, show-leaves
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
パッケージ 1:mod_ssl-2.4.6-40.el7.centos.x86_64 はインストール済みか最新バージョンです
何もしません
Checking for new version...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Requesting root privileges to run letsencrypt...
   sudo /home/user1/.local/share/letsencrypt/bin/letsencrypt --help --debug

  letsencrypt-auto [SUBCOMMAND] [options] [-d domain] [-d domain] ...

The Let's Encrypt agent can obtain and install HTTPS/TLS/SSL certificates.  By
default, it will attempt to use a webserver both for obtaining and installing
the cert. Major SUBCOMMANDS are:

  (default) run        Obtain & install a cert in your current webserver
  certonly             Obtain cert, but do not install it (aka "auth")
  install              Install a previously obtained cert in a server
  renew                Renew previously obtained certs that are near expiry
  revoke               Revoke a previously obtained certificate
  rollback             Rollback server configuration changes made during install
  config_changes       Show changes made to server config during installation
  plugins              Display information about installed plugins

Choice of server plugins for obtaining and installing cert:

  --apache          Use the Apache plugin for authentication & installation
  --standalone      Run a standalone webserver for authentication
  (nginx support is experimental, buggy, and not installed by default)
  --webroot         Place files in a server's webroot folder for authentication

OR use different plugins to obtain (authenticate) the cert and then install it:

  --authenticator standalone --installer apache

More detailed help:

  -h, --help [topic]    print this message, or detailed help on a topic;
                        the available topics are:

   all, automation, paths, security, testing, or any of the subcommands or
   plugins (certonly, install, nginx, apache, standalone, webroot, etc)

Let’s Encrypt クライアントのインストール

git clone https://github.com/letsencrypt/letsencrypt
Cloning into 'letsencrypt'...
remote: Counting objects: 35446, done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 35446 (delta 59), reused 0 (delta 0), pack-reused 35329
Receiving objects: 100% (35446/35446), 9.53 MiB | 2.02 MiB/s, done.
Resolving deltas: 100% (25184/25184), done.
cd letsencrypt/
./letsencrypt-auto --help --debug
Bootstrapping dependencies for RedHat-based OSes...
yum は /usr/bin/yum です
[sudo] password for user1: 
読み込んだプラグイン:fastestmirror, remove-with-leaves, show-leaves
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                            | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                            | 5.2 kB  00:00:00     
epel                                                                            | 4.3 kB  00:00:00     
http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
http://ftp.tsukuba.wide.ad.jp/Linux/fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
http://mirror1.ku.ac.th/fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
http://mirror.wanxp.id/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
他のミラーを試します。
epel                                                                            | 4.3 kB  00:00:00     
extras                                                                          | 3.4 kB  00:00:00     
groonga                                                                         | 2.5 kB  00:00:00     
mysql-connectors-community                                                      | 2.5 kB  00:00:00     
mysql-tools-community                                                           | 2.5 kB  00:00:00     
mysql56-community                                                               | 2.5 kB  00:00:00     
updates                                                                         | 3.4 kB  00:00:00     
(1/6): epel/x86_64/group_gz                                                     | 170 kB  00:00:00     
epel/x86_64/updateinfo         FAILED                                          
http://ftp.tsukuba.wide.ad.jp/Linux/fedora/epel/7/x86_64/repodata/4e6f7cf18ae8bc3553da486c7847ac8f9a50671406d26c72a4d0765f914c5c76-updateinfo.xml.bz2: [Errno 14] HTTP Error 404 - Not Found
他のミラーを試します。
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

epel/x86_64/primary_db         FAILED                                          
http://ftp.tsukuba.wide.ad.jp/Linux/fedora/epel/7/x86_64/repodata/ff94d6a6fd8803f1ba27ab562b8e99c2b5f7f4ffa5d49b97689f3df6ca57e367-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
他のミラーを試します。
epel/x86_64/updateinfo         FAILED                                          
http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/repodata/4e6f7cf18ae8bc3553da486c7847ac8f9a50671406d26c72a4d0765f914c5c76-updateinfo.xml.bz2: [Errno 14] HTTP Error 404 - Not Found
他のミラーを試します。
(2/6): extras/7/x86_64/primary_db                                               | 117 kB  00:00:00     
(3/6): groonga/7/x86_64/primary_db                                              | 161 kB  00:00:00     
epel/x86_64/primary_db         FAILED                                          
http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/repodata/ff94d6a6fd8803f1ba27ab562b8e99c2b5f7f4ffa5d49b97689f3df6ca57e367-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
他のミラーを試します。
(4/6): updates/7/x86_64/primary_db                                              | 4.8 MB  00:00:00     
(5/6): epel/x86_64/updateinfo                                                   | 547 kB  00:00:00     
epel/x86_64/primary_db         FAILED                                          
http://free.nchc.org.tw/fedora-epel/7/x86_64/repodata/ff94d6a6fd8803f1ba27ab562b8e99c2b5f7f4ffa5d49b97689f3df6ca57e367-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
他のミラーを試します。
(6/6): epel/x86_64/primary_db                                                   | 4.1 MB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * epel: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
パッケージ gcc-4.8.5-4.el7.x86_64 はインストール済みか最新バージョンです
パッケージ dialog-1.2-4.20130523.el7.x86_64 はインストール済みか最新バージョンです
パッケージ augeas-libs-1.4.0-2.el7.x86_64 はインストール済みか最新バージョンです
パッケージ libffi-devel-3.0.13-16.el7.x86_64 はインストール済みか最新バージョンです
パッケージ redhat-rpm-config-9.1.0-68.el7.centos.noarch はインストール済みか最新バージョンです
パッケージ ca-certificates-2015.2.6-70.1.el7_2.noarch はインストール済みか最新バージョンです
パッケージ python-2.7.5-34.el7.x86_64 はインストール済みか最新バージョンです
パッケージ python-devel-2.7.5-34.el7.x86_64 はインストール済みか最新バージョンです
パッケージ python-virtualenv-1.10.1-2.el7.noarch はインストール済みか最新バージョンです
パッケージ python-tools-2.7.5-34.el7.x86_64 はインストール済みか最新バージョンです
パッケージ python-pip-7.1.0-1.el7.noarch はインストール済みか最新バージョンです
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ mod_ssl.x86_64 1:2.4.6-40.el7.centos を 更新
---> パッケージ mod_ssl.x86_64 1:2.4.6-40.el7.centos.1 を アップデート
--> 依存性の処理をしています: httpd = 2.4.6-40.el7.centos.1 のパッケージ: 1:mod_ssl-2.4.6-40.el7.centos.1.x86_64
---> パッケージ openssl.x86_64 1:1.0.1e-51.el7_2.4 を 更新
---> パッケージ openssl.x86_64 1:1.0.1e-51.el7_2.5 を アップデート
--> 依存性の処理をしています: openssl-libs(x86-64) = 1:1.0.1e-51.el7_2.5 のパッケージ: 1:openssl-1.0.1e-51.el7_2.5.x86_64
---> パッケージ openssl-devel.x86_64 1:1.0.1e-51.el7_2.4 を 更新
---> パッケージ openssl-devel.x86_64 1:1.0.1e-51.el7_2.5 を アップデート
--> トランザクションの確認を実行しています。
---> パッケージ httpd.x86_64 0:2.4.6-40.el7.centos を 更新
---> パッケージ httpd.x86_64 0:2.4.6-40.el7.centos.1 を アップデート
--> 依存性の処理をしています: httpd-tools = 2.4.6-40.el7.centos.1 のパッケージ: httpd-2.4.6-40.el7.centos.1.x86_64
---> パッケージ openssl-libs.x86_64 1:1.0.1e-51.el7_2.4 を 更新
---> パッケージ openssl-libs.x86_64 1:1.0.1e-51.el7_2.5 を アップデート
--> トランザクションの確認を実行しています。
---> パッケージ httpd-tools.x86_64 0:2.4.6-40.el7.centos を 更新
---> パッケージ httpd-tools.x86_64 0:2.4.6-40.el7.centos.1 を アップデート
--> 依存性解決を終了しました。

依存性を解決しました

====================================================================================================================================================================================
 Package                                     アーキテクチャー                     バージョン                                            リポジトリー                           容量
====================================================================================================================================================================================
更新します:
 mod_ssl                                     x86_64                               1:2.4.6-40.el7.centos.1                               updates                               103 k
 openssl                                     x86_64                               1:1.0.1e-51.el7_2.5                                   updates                               712 k
 openssl-devel                               x86_64                               1:1.0.1e-51.el7_2.5                                   updates                               1.2 M
依存性関連での更新をします:
 httpd                                       x86_64                               2.4.6-40.el7.centos.1                                 updates                               2.7 M
 httpd-tools                                 x86_64                               2.4.6-40.el7.centos.1                                 updates                                82 k
 openssl-libs                                x86_64                               1:1.0.1e-51.el7_2.5                                   updates                               952 k

トランザクションの要約
====================================================================================================================================================================================
更新  3 パッケージ (+3 個の依存関係のパッケージ)

総ダウンロード容量: 5.7 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/6): mod_ssl-2.4.6-40.el7.centos.1.x86_64.rpm                                                                                                              | 103 kB  00:00:00     
(2/6): httpd-tools-2.4.6-40.el7.centos.1.x86_64.rpm                                                                                                          |  82 kB  00:00:01     
(3/6): openssl-1.0.1e-51.el7_2.5.x86_64.rpm                                                                                                                  | 712 kB  00:00:00     
(4/6): openssl-devel-1.0.1e-51.el7_2.5.x86_64.rpm                                                                                                            | 1.2 MB  00:00:00     
(5/6): openssl-libs-1.0.1e-51.el7_2.5.x86_64.rpm                                                                                                             | 952 kB  00:00:00     
(6/6): httpd-2.4.6-40.el7.centos.1.x86_64.rpm                                                                                                                | 2.7 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                                                3.7 MB/s | 5.7 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  更新します              : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64                                                                                                            1/12 
  更新します              : 1:openssl-1.0.1e-51.el7_2.5.x86_64                                                                                                                 2/12 
  更新します              : httpd-tools-2.4.6-40.el7.centos.1.x86_64                                                                                                           3/12 
  更新します              : httpd-2.4.6-40.el7.centos.1.x86_64                                                                                                                 4/12 
  更新します              : 1:mod_ssl-2.4.6-40.el7.centos.1.x86_64                                                                                                             5/12 
  更新します              : 1:openssl-devel-1.0.1e-51.el7_2.5.x86_64                                                                                                           6/12 
  整理中                  : 1:mod_ssl-2.4.6-40.el7.centos.x86_64                                                                                                               7/12 
  整理中                  : httpd-2.4.6-40.el7.centos.x86_64                                                                                                                   8/12 
  整理中                  : httpd-tools-2.4.6-40.el7.centos.x86_64                                                                                                             9/12 
  整理中                  : 1:openssl-devel-1.0.1e-51.el7_2.4.x86_64                                                                                                          10/12 
  整理中                  : 1:openssl-1.0.1e-51.el7_2.4.x86_64                                                                                                                11/12 
  整理中                  : 1:openssl-libs-1.0.1e-51.el7_2.4.x86_64                                                                                                           12/12 
  検証中                  : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64                                                                                                            1/12 
  検証中                  : httpd-2.4.6-40.el7.centos.1.x86_64                                                                                                                 2/12 
  検証中                  : 1:mod_ssl-2.4.6-40.el7.centos.1.x86_64                                                                                                             3/12 
  検証中                  : 1:openssl-1.0.1e-51.el7_2.5.x86_64                                                                                                                 4/12 
  検証中                  : httpd-tools-2.4.6-40.el7.centos.1.x86_64                                                                                                           5/12 
  検証中                  : 1:openssl-devel-1.0.1e-51.el7_2.5.x86_64                                                                                                           6/12 
  検証中                  : 1:mod_ssl-2.4.6-40.el7.centos.x86_64                                                                                                               7/12 
  検証中                  : httpd-tools-2.4.6-40.el7.centos.x86_64                                                                                                             8/12 
  検証中                  : httpd-2.4.6-40.el7.centos.x86_64                                                                                                                   9/12 
  検証中                  : 1:openssl-devel-1.0.1e-51.el7_2.4.x86_64                                                                                                          10/12 
  検証中                  : 1:openssl-1.0.1e-51.el7_2.4.x86_64                                                                                                                11/12 
  検証中                  : 1:openssl-libs-1.0.1e-51.el7_2.4.x86_64                                                                                                           12/12 

更新:
  mod_ssl.x86_64 1:2.4.6-40.el7.centos.1                      openssl.x86_64 1:1.0.1e-51.el7_2.5                      openssl-devel.x86_64 1:1.0.1e-51.el7_2.5                     

依存性を更新しました:
  httpd.x86_64 0:2.4.6-40.el7.centos.1                    httpd-tools.x86_64 0:2.4.6-40.el7.centos.1                    openssl-libs.x86_64 1:1.0.1e-51.el7_2.5                   

完了しました!
Checking for new version...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Requesting root privileges to run certbot...
   sudo CERTBOT_AUTO=./letsencrypt-auto /home/user1/.local/share/letsencrypt/bin/letsencrypt --help --debug

  letsencrypt-auto [SUBCOMMAND] [options] [-d domain] [-d domain] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
cert. Major SUBCOMMANDS are:

  (default) run        Obtain & install a cert in your current webserver
  certonly             Obtain cert, but do not install it (aka "auth")
  install              Install a previously obtained cert in a server
  renew                Renew previously obtained certs that are near expiry
  revoke               Revoke a previously obtained certificate
  rollback             Rollback server configuration changes made during install
  config_changes       Show changes made to server config during installation
  plugins              Display information about installed plugins

Choice of server plugins for obtaining and installing cert:

  --apache          Use the Apache plugin for authentication & installation
  --standalone      Run a standalone webserver for authentication
  (nginx support is experimental, buggy, and not installed by default)
  --webroot         Place files in a server's webroot folder for authentication

OR use different plugins to obtain (authenticate) the cert and then install it:

  --authenticator standalone --installer apache

More detailed help:

  -h, --help [topic]    print this message, or detailed help on a topic;
                        the available topics are:

   all, automation, paths, security, testing, or any of the subcommands or
   plugins (certonly, install, nginx, apache, standalone, webroot, etc)

証明書の取得

letsencrypt-autoで証明書を発行する。
オプションは以下の通り。

オプション 内容
certonly 証明書の取得のみを行うオプション。デフォルトだと run オプションで実行され、証明書取得とApache等のSSL設定を実行するが、うまく動かないことが多いらしい。
--webroot  Apache等のウェブサーバのドキュメントルートに、認証用ファイルを生成する。ドキュメントルート直下に「.well-known/」というディレクトリが作成され、証明書の取得が終われば、この認証用ファイルは削除される。
-w  ドキュメントルートのパスを指定する。Apacheの場合はDocumentRootで指定しているパス。  
-d  証明書を取得するドメイン名を指定する。Apacheの場合はServerNameで指定しているドメイン名。
-m  メールアドレスを指定。トラブル時や証明書の更新期限が近づいた際の連絡先に利用される。
--agree-tos  Let's Encryptの利用規約に同意する。
./letsencrypt-auto certonly --webroot \
-w /var/www/sample -d sample.com \
-m sample@sample.com \
--agree-tos
Checking for new version...
Requesting root privileges to run certbot...
   sudo CERTBOT_AUTO=./letsencrypt-auto /home/user1/.local/share/letsencrypt/bin/letsencrypt certonly --webroot -w /var/www/sample -d sample.com -m sample@sample.com --agree-tos

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/sample.com/fullchain.pem. Your cert will
   expire on 2016-08-13. To obtain a new version of the certificate in
   the future, simply run Certbot again.
 - 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

Webサーバの設定

sudo vim /etc/httpd/conf.d/ssl.conf 
以下を編集
SSLCertificateFile /etc/pki/tls/certs/localhost.crt

SSLCertificateFile /etc/letsencrypt/live/<逆引きホスト名>/cert.pem

SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

SSLCertificateKeyFile /etc/letsencrypt/live/<逆引きホスト名>/privkey.pem

#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt

SSLCertificateChainFile /etc/letsencrypt/live/<逆引きホスト名>/chain.pem
Apache再起動
service httpd restart

これで、https://ホスト名/ でアクセスできるようになる。

追記: 2018/05

./letsencrypt-auto だと、

An unexpected error occurred:
ReadTimeout: HTTPSConnectionPool(host='acme-v01.api.letsencrypt.org', port=443): Read timed out. (read timeout=45)

となった。./certbot-auto で実行すると成功。

10
12
1

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
10
12