我がブログサイトをSSL対応にした

November 22, 2017 – 11:38 pm

本ブログサイト(Yama’s Memorandum)は、昨日(2017/11/21)からSSL対応となった。

このサイトがSSL対応になっていることはブラウザのアドレスバーで確認できる。ブラウザがMicrosoft Edge ではアドレスの前に鍵マークが、そして google chrome の場合には、鍵マークに加え「保護された通信」が表示されている筈だ。

このブログサイトのSSL化には、無料で「SSL/TLSサーバ証明書」を発行する Let’s Encrypt を活用した。

以下、一連のSSL化作業をメモしておいた。

クライアントソフト「Certbot」のインストール
Let’s Encrypt によるSSL/TLSサーバ証明書の取得・更新作業は、クライアントソフト「Certbot」により自動的に行うことができる。

Certbotのインストールは、Let’s Encrypt に示されているインストール方法(RHEL7対応)に従った。

インストール作業時のログを以下に掲げる:

# yum install --enablerepo=epel certbot python-certbot-apache
Resolving Dependencies
--> Running transaction check
---> Package certbot.noarch 0:0.19.0-1.el7 will be installed
--> Processing Dependency: python2-certbot = 0.19.0-1.el7 for package: certbot-0.19.0-1.el7.noarch
---> Package python2-certbot-apache.noarch 0:0.19.0-1.el7 will be installed
--> Processing Dependency: mod_ssl for package: python2-certbot-apache-0.19.0-1.el7.noarch
--> Processing Dependency: python-augeas for package: python2-certbot-apache-0.19.0-1.el7.noarch
--> Running transaction check
---> Package mod_ssl.x86_64 1:2.4.6-67.sl7.5 will be installed
---> Package python-augeas.noarch 0:0.5.0-2.el7 will be installed
--> Processing Dependency: augeas-libs for package: python-augeas-0.5.0-2.el7.noarch
---> Package python2-certbot.noarch 0:0.19.0-1.el7 will be installed
--> Processing Dependency: python2-acme = 0.19.0 for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python2-configargparse >= 0.10.0 for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python2-dialog >= 3.3.0 for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python2-psutil >= 2.1.0 for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python-parsedatetime for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python-zope-interface for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python2-future for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python2-mock for package: python2-certbot-0.19.0-1.el7.noarch
--> Processing Dependency: python2-zope-component for package: python2-certbot-0.19.0-1.el7.noarch
--> Running transaction check
---> Package augeas-libs.x86_64 0:1.4.0-2.el7_4.1 will be installed
---> Package python-parsedatetime.noarch 0:1.5-3.el7 will be installed
---> Package python-zope-component.noarch 1:4.1.0-3.el7 will be installed
--> Processing Dependency: python-zope-event for package: 1:python-zope-component-4.1.0-3.el7.noarch
---> Package python-zope-interface.x86_64 0:4.0.5-4.el7 will be installed
---> Package python2-acme.noarch 0:0.19.0-1.el7 will be installed
--> Processing Dependency: pyOpenSSL >= 0.13 for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: python-cryptography for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: python-ndg_httpsclient for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: python-pyasn1 for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: python-pyrfc3339 for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: python-requests for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: python-six for package: python2-acme-0.19.0-1.el7.noarch
--> Processing Dependency: pytz for package: python2-acme-0.19.0-1.el7.noarch
---> Package python2-configargparse.noarch 0:0.11.0-1.el7 will be installed
---> Package python2-dialog.noarch 0:3.3.0-6.el7 will be installed
--> Processing Dependency: dialog for package: python2-dialog-3.3.0-6.el7.noarch
---> Package python2-future.noarch 0:0.16.0-2.el7 will be installed
---> Package python2-mock.noarch 0:1.0.1-9.el7 will be installed
---> Package python2-psutil.x86_64 0:2.2.1-2.el7 will be installed
--> Running transaction check
---> Package dialog.x86_64 0:1.2-4.20130523.el7 will be installed
---> Package pyOpenSSL.x86_64 0:0.13.1-3.el7 will be installed
---> Package python-ndg_httpsclient.noarch 0:0.3.2-1.el7 will be installed
--> Processing Dependency: python-setuptools for package: python-ndg_httpsclient-0.3.2-1.el7.noarch
---> Package python-requests.noarch 0:2.6.0-1.el7_1 will be installed
--> Processing Dependency: python-chardet >= 2.2.1-1 for package: python-requests-2.6.0-1.el7_1.noarch
--> Processing Dependency: python-urllib3 >= 1.10.2-1 for package: python-requests-2.6.0-1.el7_1.noarch
---> Package python-six.noarch 0:1.9.0-2.el7 will be installed
---> Package python-zope-event.noarch 0:4.0.3-2.el7 will be installed
---> Package python2-cryptography.x86_64 0:1.7.2-1.el7 will be installed
--> Processing Dependency: python-cffi >= 1.4.1 for package: python2-cryptography-1.7.2-1.el7.x86_64
--> Processing Dependency: python-idna >= 2.0 for package: python2-cryptography-1.7.2-1.el7.x86_64
--> Processing Dependency: python-enum34 for package: python2-cryptography-1.7.2-1.el7.x86_64
--> Processing Dependency: python-ipaddress for package: python2-cryptography-1.7.2-1.el7.x86_64
---> Package python2-pyasn1.noarch 0:0.1.9-7.el7 will be installed
---> Package python2-pyrfc3339.noarch 0:1.0-2.el7 will be installed
---> Package pytz.noarch 0:2012d-5.el7 will be installed
--> Running transaction check
---> Package python-cffi.x86_64 0:1.6.0-5.el7 will be installed
--> Processing Dependency: python-pycparser for package: python-cffi-1.6.0-5.el7.x86_64
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
---> Package python-enum34.noarch 0:1.0.4-1.el7 will be installed
---> Package python-idna.noarch 0:2.0-1.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-4.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-4.el7.noarch
---> Package python-urllib3.noarch 0:1.10.2-2.el7_1 will be installed
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.4.0.2-4.el7 will be installed
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
---> Package python-pycparser.noarch 0:2.14-1.el7 will be installed
--> Processing Dependency: python-ply for package: python-pycparser-2.14-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ply.noarch 0:3.4-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                                           Arch                 Version                           Repository                 Size
==========================================================================================================================================
Installing:
 certbot                                           noarch               0.19.0-1.el7                      epel                       20 k
 python2-certbot-apache                            noarch               0.19.0-1.el7                      epel                      151 k
Installing for dependencies:
 augeas-libs                                       x86_64               1.4.0-2.el7_4.1                   sl-security               354 k
 dialog                                            x86_64               1.2-4.20130523.el7                sl                        207 k
 mod_ssl                                           x86_64               1:2.4.6-67.sl7.5                  sl-security               108 k
 pyOpenSSL                                         x86_64               0.13.1-3.el7                      sl                        132 k
 python-augeas                                     noarch               0.5.0-2.el7                       sl                         24 k
 python-backports                                  x86_64               1.0-8.el7                         sl                        4.9 k
 python-backports-ssl_match_hostname               noarch               3.4.0.2-4.el7                     sl                         11 k
 python-cffi                                       x86_64               1.6.0-5.el7                       sl                        217 k
 python-chardet                                    noarch               2.2.1-1.el7_1                     sl                        226 k
 python-enum34                                     noarch               1.0.4-1.el7                       sl                         51 k
 python-idna                                       noarch               2.0-1.el7                         sl                         91 k
 python-ipaddress                                  noarch               1.0.16-2.el7                      sl                         33 k
 python-ndg_httpsclient                            noarch               0.3.2-1.el7                       epel                       43 k
 python-parsedatetime                              noarch               1.5-3.el7                         epel                       61 k
 python-ply                                        noarch               3.4-10.el7                        sl                        122 k
 python-pycparser                                  noarch               2.14-1.el7                        sl                        104 k
 python-requests                                   noarch               2.6.0-1.el7_1                     sl                         93 k
 python-setuptools                                 noarch               0.9.8-4.el7                       sl                        396 k
 python-six                                        noarch               1.9.0-2.el7                       sl                         28 k
 python-urllib3                                    noarch               1.10.2-2.el7_1                    sl                         99 k
 python-zope-component                             noarch               1:4.1.0-3.el7                     epel                      227 k
 python-zope-event                                 noarch               4.0.3-2.el7                       epel                       79 k
 python-zope-interface                             x86_64               4.0.5-4.el7                       sl                        138 k
 python2-acme                                      noarch               0.19.0-1.el7                      epel                      176 k
 python2-certbot                                   noarch               0.19.0-1.el7                      epel                      471 k
 python2-configargparse                            noarch               0.11.0-1.el7                      epel                       30 k
 python2-cryptography                              x86_64               1.7.2-1.el7                       sl-security               501 k
 python2-dialog                                    noarch               3.3.0-6.el7                       epel                       94 k
 python2-future                                    noarch               0.16.0-2.el7                      epel                      799 k
 python2-mock                                      noarch               1.0.1-9.el7                       epel                       92 k
 python2-psutil                                    x86_64               2.2.1-2.el7                       epel                      116 k
 python2-pyasn1                                    noarch               0.1.9-7.el7                       sl                         99 k
 python2-pyrfc3339                                 noarch               1.0-2.el7                         epel                       13 k
 pytz                                              noarch               2012d-5.el7                       sl                         37 k

Transaction Summary
==========================================================================================================================================
Install  2 Packages (+34 Dependent packages)

Total download size: 5.3 M
Installed size: 24 M
Is this ok [y/d/N]: y
Downloading packages:
(1/36): certbot-0.19.0-1.el7.noarch.rpm                                                                            |  20 kB  00:00:00     
(2/36): dialog-1.2-4.20130523.el7.x86_64.rpm                                                                       | 207 kB  00:00:01     
(3/36): pyOpenSSL-0.13.1-3.el7.x86_64.rpm                                                                          | 132 kB  00:00:01     
(4/36): augeas-libs-1.4.0-2.el7_4.1.x86_64.rpm                                                                     | 354 kB  00:00:01     
(5/36): mod_ssl-2.4.6-67.sl7.5.x86_64.rpm                                                                          | 108 kB  00:00:01     
(6/36): python-backports-1.0-8.el7.x86_64.rpm                                                                      | 4.9 kB  00:00:00     
(7/36): python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch.rpm                                               |  11 kB  00:00:00     
(8/36): python-enum34-1.0.4-1.el7.noarch.rpm                                                                       |  51 kB  00:00:00     
(9/36): python-idna-2.0-1.el7.noarch.rpm                                                                           |  91 kB  00:00:00     
(10/36): python-ndg_httpsclient-0.3.2-1.el7.noarch.rpm                                                             |  43 kB  00:00:00     
(11/36): python-ipaddress-1.0.16-2.el7.noarch.rpm                                                                  |  33 kB  00:00:00     
(12/36): python-parsedatetime-1.5-3.el7.noarch.rpm                                                                 |  61 kB  00:00:00     
(13/36): python-ply-3.4-10.el7.noarch.rpm                                                                          | 122 kB  00:00:00     
(14/36): python-pycparser-2.14-1.el7.noarch.rpm                                                                    | 104 kB  00:00:00     
(15/36): python-requests-2.6.0-1.el7_1.noarch.rpm                                                                  |  93 kB  00:00:00     
(16/36): python-chardet-2.2.1-1.el7_1.noarch.rpm                                                                   | 226 kB  00:00:01     
(17/36): python-six-1.9.0-2.el7.noarch.rpm                                                                         |  28 kB  00:00:00     
(18/36): python-zope-component-4.1.0-3.el7.noarch.rpm                                                              | 227 kB  00:00:00     
(19/36): python-zope-event-4.0.3-2.el7.noarch.rpm                                                                  |  79 kB  00:00:00     
(20/36): python-setuptools-0.9.8-4.el7.noarch.rpm                                                                  | 396 kB  00:00:00     
(21/36): python2-acme-0.19.0-1.el7.noarch.rpm                                                                      | 176 kB  00:00:00     
(22/36): python2-certbot-0.19.0-1.el7.noarch.rpm                                                                   | 471 kB  00:00:00     
(23/36): python2-certbot-apache-0.19.0-1.el7.noarch.rpm                                                            | 151 kB  00:00:00     
(24/36): python2-configargparse-0.11.0-1.el7.noarch.rpm                                                            |  30 kB  00:00:00     
(25/36): python-zope-interface-4.0.5-4.el7.x86_64.rpm                                                              | 138 kB  00:00:00     
(26/36): python2-dialog-3.3.0-6.el7.noarch.rpm                                                                     |  94 kB  00:00:00     
(27/36): python2-future-0.16.0-2.el7.noarch.rpm                                                                    | 799 kB  00:00:00     
(28/36): python2-mock-1.0.1-9.el7.noarch.rpm                                                                       |  92 kB  00:00:00     
(29/36): python2-psutil-2.2.1-2.el7.x86_64.rpm                                                                     | 116 kB  00:00:00     
(30/36): python2-pyasn1-0.1.9-7.el7.noarch.rpm                                                                     |  99 kB  00:00:00     
(31/36): python2-pyrfc3339-1.0-2.el7.noarch.rpm                                                                    |  13 kB  00:00:00     
(32/36): python-urllib3-1.10.2-2.el7_1.noarch.rpm                                                                  |  99 kB  00:00:00     
(33/36): pytz-2012d-5.el7.noarch.rpm                                                                               |  37 kB  00:00:00     
(34/36): python-augeas-0.5.0-2.el7.noarch.rpm                                                                      |  24 kB  00:00:03     
(35/36): python2-cryptography-1.7.2-1.el7.x86_64.rpm                                                               | 501 kB  00:00:01     
(36/36): python-cffi-1.6.0-5.el7.x86_64.rpm                                                                        | 217 kB  00:00:03     
------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                     1.1 MB/s | 5.3 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python2-pyasn1-0.1.9-7.el7.noarch                                                                                     1/36 
  Installing : python-six-1.9.0-2.el7.noarch                                                                                         2/36 
  Installing : pyOpenSSL-0.13.1-3.el7.x86_64                                                                                         3/36 
  Installing : python-zope-interface-4.0.5-4.el7.x86_64                                                                              4/36 
  Installing : pytz-2012d-5.el7.noarch                                                                                               5/36 
  Installing : python-parsedatetime-1.5-3.el7.noarch                                                                                 6/36 
  Installing : python-chardet-2.2.1-1.el7_1.noarch                                                                                   7/36 
  Installing : python-ipaddress-1.0.16-2.el7.noarch                                                                                  8/36 
  Installing : python-zope-event-4.0.3-2.el7.noarch                                                                                  9/36 
  Installing : 1:python-zope-component-4.1.0-3.el7.noarch                                                                           10/36 
  Installing : python2-mock-1.0.1-9.el7.noarch                                                                                      11/36 
  Installing : python-idna-2.0-1.el7.noarch                                                                                         12/36 
  Installing : python-backports-1.0-8.el7.x86_64                                                                                    13/36 
  Installing : python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch                                                             14/36 
  Installing : python-setuptools-0.9.8-4.el7.noarch                                                                                 15/36 
  Installing : python-ndg_httpsclient-0.3.2-1.el7.noarch                                                                            16/36 
  Installing : python-urllib3-1.10.2-2.el7_1.noarch                                                                                 17/36 
  Installing : python-requests-2.6.0-1.el7_1.noarch                                                                                 18/36 
  Installing : 1:mod_ssl-2.4.6-67.sl7.5.x86_64                                                                                      19/36 
  Installing : python-ply-3.4-10.el7.noarch                                                                                         20/36 
  Installing : python-pycparser-2.14-1.el7.noarch                                                                                   21/36 
  Installing : python-cffi-1.6.0-5.el7.x86_64                                                                                       22/36 
  Installing : python2-pyrfc3339-1.0-2.el7.noarch                                                                                   23/36 
  Installing : python2-psutil-2.2.1-2.el7.x86_64                                                                                    24/36 
  Installing : dialog-1.2-4.20130523.el7.x86_64                                                                                     25/36 
  Installing : python2-dialog-3.3.0-6.el7.noarch                                                                                    26/36 
  Installing : augeas-libs-1.4.0-2.el7_4.1.x86_64                                                                                   27/36 
  Installing : python-augeas-0.5.0-2.el7.noarch                                                                                     28/36 
  Installing : python2-future-0.16.0-2.el7.noarch                                                                                   29/36 
  Installing : python-enum34-1.0.4-1.el7.noarch                                                                                     30/36 
  Installing : python2-cryptography-1.7.2-1.el7.x86_64                                                                              31/36 
  Installing : python2-acme-0.19.0-1.el7.noarch                                                                                     32/36 
  Installing : python2-configargparse-0.11.0-1.el7.noarch                                                                           33/36 
  Installing : python2-certbot-0.19.0-1.el7.noarch                                                                                  34/36 
  Installing : certbot-0.19.0-1.el7.noarch                                                                                          35/36 
SELinux:  Could not downgrade policy file /etc/selinux/targeted/policy/policy.30, searching for an older version.
SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.30:  No such file or directory
/sbin/load_policy:  Can't load policy:  No such file or directory
libsemanage.semanage_reload_policy: load_policy returned error code 2. (No such file or directory).
SELinux:  Could not downgrade policy file /etc/selinux/targeted/policy/policy.30, searching for an older version.
SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.30:  No such file or directory
/sbin/load_policy:  Can't load policy:  No such file or directory
libsemanage.semanage_reload_policy: load_policy returned error code 2. (No such file or directory).
OSError: No such file or directory
  Installing : python2-certbot-apache-0.19.0-1.el7.noarch                                                                           36/36 
  Verifying  : python-augeas-0.5.0-2.el7.noarch                                                                                      1/36 
  Verifying  : python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch                                                              2/36 
  Verifying  : python2-configargparse-0.11.0-1.el7.noarch                                                                            3/36 
  Verifying  : python-ndg_httpsclient-0.3.2-1.el7.noarch                                                                             4/36 
  Verifying  : 1:python-zope-component-4.1.0-3.el7.noarch                                                                            5/36 
  Verifying  : python-enum34-1.0.4-1.el7.noarch                                                                                      6/36 
  Verifying  : python2-future-0.16.0-2.el7.noarch                                                                                    7/36 
  Verifying  : augeas-libs-1.4.0-2.el7_4.1.x86_64                                                                                    8/36 
  Verifying  : python2-acme-0.19.0-1.el7.noarch                                                                                      9/36 
  Verifying  : dialog-1.2-4.20130523.el7.x86_64                                                                                     10/36 
  Verifying  : python2-psutil-2.2.1-2.el7.x86_64                                                                                    11/36 
  Verifying  : python2-certbot-apache-0.19.0-1.el7.noarch                                                                           12/36 
  Verifying  : certbot-0.19.0-1.el7.noarch                                                                                          13/36 
  Verifying  : python2-pyrfc3339-1.0-2.el7.noarch                                                                                   14/36 
  Verifying  : python-zope-interface-4.0.5-4.el7.x86_64                                                                             15/36 
  Verifying  : python-setuptools-0.9.8-4.el7.noarch                                                                                 16/36 
  Verifying  : python-ply-3.4-10.el7.noarch                                                                                         17/36 
  Verifying  : 1:mod_ssl-2.4.6-67.sl7.5.x86_64                                                                                      18/36 
  Verifying  : python-six-1.9.0-2.el7.noarch                                                                                        19/36 
  Verifying  : python2-certbot-0.19.0-1.el7.noarch                                                                                  20/36 
  Verifying  : python-backports-1.0-8.el7.x86_64                                                                                    21/36 
  Verifying  : python-cffi-1.6.0-5.el7.x86_64                                                                                       22/36 
  Verifying  : python2-dialog-3.3.0-6.el7.noarch                                                                                    23/36 
  Verifying  : python2-cryptography-1.7.2-1.el7.x86_64                                                                              24/36 
  Verifying  : python-idna-2.0-1.el7.noarch                                                                                         25/36 
  Verifying  : pyOpenSSL-0.13.1-3.el7.x86_64                                                                                        26/36 
  Verifying  : python-pycparser-2.14-1.el7.noarch                                                                                   27/36 
  Verifying  : python2-mock-1.0.1-9.el7.noarch                                                                                      28/36 
  Verifying  : python-requests-2.6.0-1.el7_1.noarch                                                                                 29/36 
  Verifying  : python-zope-event-4.0.3-2.el7.noarch                                                                                 30/36 
  Verifying  : python-ipaddress-1.0.16-2.el7.noarch                                                                                 31/36 
  Verifying  : python-chardet-2.2.1-1.el7_1.noarch                                                                                  32/36 
  Verifying  : python2-pyasn1-0.1.9-7.el7.noarch                                                                                    33/36 
  Verifying  : python-urllib3-1.10.2-2.el7_1.noarch                                                                                 34/36 
  Verifying  : python-parsedatetime-1.5-3.el7.noarch                                                                                35/36 
  Verifying  : pytz-2012d-5.el7.noarch                                                                                              36/36 

Installed:
  certbot.noarch 0:0.19.0-1.el7                                python2-certbot-apache.noarch 0:0.19.0-1.el7                               

Dependency Installed:
  augeas-libs.x86_64 0:1.4.0-2.el7_4.1                                       dialog.x86_64 0:1.2-4.20130523.el7                          
  mod_ssl.x86_64 1:2.4.6-67.sl7.5                                            pyOpenSSL.x86_64 0:0.13.1-3.el7                             
  python-augeas.noarch 0:0.5.0-2.el7                                         python-backports.x86_64 0:1.0-8.el7                         
  python-backports-ssl_match_hostname.noarch 0:3.4.0.2-4.el7                 python-cffi.x86_64 0:1.6.0-5.el7                            
  python-chardet.noarch 0:2.2.1-1.el7_1                                      python-enum34.noarch 0:1.0.4-1.el7                          
  python-idna.noarch 0:2.0-1.el7                                             python-ipaddress.noarch 0:1.0.16-2.el7                      
  python-ndg_httpsclient.noarch 0:0.3.2-1.el7                                python-parsedatetime.noarch 0:1.5-3.el7                     
  python-ply.noarch 0:3.4-10.el7                                             python-pycparser.noarch 0:2.14-1.el7                        
  python-requests.noarch 0:2.6.0-1.el7_1                                     python-setuptools.noarch 0:0.9.8-4.el7                      
  python-six.noarch 0:1.9.0-2.el7                                            python-urllib3.noarch 0:1.10.2-2.el7_1                      
  python-zope-component.noarch 1:4.1.0-3.el7                                 python-zope-event.noarch 0:4.0.3-2.el7                      
  python-zope-interface.x86_64 0:4.0.5-4.el7                                 python2-acme.noarch 0:0.19.0-1.el7                          
  python2-certbot.noarch 0:0.19.0-1.el7                                      python2-configargparse.noarch 0:0.11.0-1.el7                
  python2-cryptography.x86_64 0:1.7.2-1.el7                                  python2-dialog.noarch 0:3.3.0-6.el7                         
  python2-future.noarch 0:0.16.0-2.el7                                       python2-mock.noarch 0:1.0.1-9.el7                           
  python2-psutil.x86_64 0:2.2.1-2.el7                                        python2-pyasn1.noarch 0:0.1.9-7.el7                         
  python2-pyrfc3339.noarch 0:1.0-2.el7                                       pytz.noarch 0:2012d-5.el7                                   

Complete!

memorandum.yamasnet.com に対応するSSL証明書の取得
以下のコマンドでSSL証明書を取得:

# certbot certonly --webroot \
> -w /var/www/memorandum \
> -d memorandum.yamasnet.com \
> -m sample@yamasnet.com \
> --agree-tos -n

上記のコマンドで正常にSSL証明書が発行された。

コマンドの実行に伴うログ出力を以下に示す:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mobile.yamasnet.com
Using the webroot path /var/www/mobile for all unmatched domains.
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mobile.yamasnet.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mobile.yamasnet.com/privkey.pem
   Your cert will expire on 2018-02-15. 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"
 - 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

  

Apache 設定ファイルの修正と反映
Apacheの設定(コンフィギュレーション)ファイルのうち、Virtual Hostの仕様部(/etc/httpd/conf.d/vhost.conf)のうち、サブディレクトリ memorandum の部分について以下のように修正し、前項で取得したSSL証明書等を取り込む:

(修正前)

<VirtualHost *:80>
     ServerName memorandum.yamasnet.com
     ServerAdmin webmaster@yamasnet.com
     DocumentRoot /var/www/memorandum
     <Directory "/var/www/memorandum">
         AllowOverride All
         Require all granted
         <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteRule ^xmlrpc\.php$ "http\:\/\/0\.0\.0\.0\/" [R=301,L]
            RewriteRule ^index\.php$ - [L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . index.php [L]
         </IfModule>
    </Directory>
</VirtualHost>

(修正後)

<VirtualHost *:443>
     ServerName memorandum.yamasnet.com
     ServerAdmin webmaster@yamasnet.com
     DocumentRoot /var/www/memorandum

     SSLEngine on
     SSLHonorCipherOrder on
     Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
     SSLProtocol -All +TLSv1 +TLSv1.1 +TLSv1.2
     SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

     SSLCertificateFile /etc/letsencrypt/live/memorandum.yamasnet.com/cert.pem
     SSLCertificateKeyFile /etc/letsencrypt/live/memorandum.yamasnet.com/privkey.pem
     SSLCertificateChainFile /etc/letsencrypt/live/memorandum.yamasnet.com/chain.pem

     <Directory "/var/www/memorandum">
         AllowOverride All
         Require all granted

         <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteRule ^xmlrpc\.php$ "https\:\/\/0\.0\.0\.0\/" [R=301,L]
            RewriteRule ^index\.php$ - [L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . index.php [L]
         </IfModule>
    </Directory>

     SetEnvIf Request_URI "\.(gif|jpg|png|css|js)$" nolog
     ErrorLog logs/error_log
     CustomLog logs/access_log combined env=!nolog
</VirtualHost>

Apache を 再起動し、上記の修正を反映する:

systemctl reload httpd

  

Firewall の修正(httpsの通過を可能にする)

# firewall-cmd --permanent --add-service=https
success
# firewall-cmd --reload
success

  

内部リンクに用いている http:// 部を https:// に変更
ssl化により、ブログのpermalink(postあるいはpaegeへのURLリンク)は http://・・ から https://・・ に変更になる。これに伴い、ブログ内部の相互参照する際のhttp:// 部を全てhttps:// に変換する必要がある。

手作業での変換は、手作業で行うことも可能ではあるが、ブログのサイズが大きくなると修正変更作業は困難になる。WordpressのpluginのひとつSerch Regex は、Wordpress Dataで用いられている文字列の検索、置換を自動的に行うことができる。

Serarch Regexをインストールし、有効化し、これを活用し、http://memorandum. を含む文字列を検索し、これを https://memorandum. に置換する。
  

ブログサイトのSSL化の確認と修正
前項までの作業で、基本的には、SSL化が完了する筈。しかし、SSL化する前の条件でブログ画面上に張り付けた外部サイトのサービスに対応するバナー、ボタンのなかには、非SSL状態を前提にするため、SSL化を阻害するものがある。

我がブログサイトにおいては、以下の症状が確認された。以下、症状と対応策について記す:

  • SSL化修正作業後、Google AdSenseのバナー広告が表示されなくなった
    AdSenseヘルプ 広告コードの導入 SSL対応の AdSense用広告コード
  • に次のような記述がある。

    HTTPS 経由でアクセスできるサイトでは、HTTP と HTTPS のコンテンツが混在しているとみなされて AdSense スクリプトがブロックされないように、古い AdSense 広告コードを変更する必要がある場合があります。AdSense 広告コードのスクリプトが「http://」で始まる場合は、「https://」に変更してください。

    HTTPS バージョンの広告コードは HTTP ページでも使用できます。2 種類のバージョンを配信する必要はありません。

    上述の指示に従い広告コードスクリプトのhttp:// 部を https:// に変更することにより、非SSL状態と同様AdSenseのバナー広告が表示されるようになった。

  • 非SSL状態でSideBar に張り付けていた「Extreme Tracking」並びに「IPV6Test サイト」呼び出しボタンによりSSL化が阻害されていた。
    • 「Extreme Tracking」については、SSL化サイトに対応するよう新たなリンクを作成
    • 一方、IPV6Testサイト呼び出しボタンについてはSSL化サイトに対応しないためこのボタンを削除した

http から https への Redirect:
SSL化後のWebサイトはSSL化前のそれとは異なるサイトとみなされる。SSL化前のサイトへのアクセスをSSL化したサイトに誘導するには、SSL化後のVhost.confに、Redirect用のブロックを次のように付け加える:

<VirtualHost *:80>
     ServerName memorandum.yamasnet.com
     Redirect / https://memorandum.yamasnet.com/
</VirtualHost>

上記を付け加えることで、http:// でport 80 へのアクセスは、https:// に強制的にRedirectされる。

Redirectの手続きを有効にするため、Apacheを再起動:

systemctl reload httpd

  

  


Post a Comment