☆☆ 新着記事 ☆☆

2018年12月1日土曜日

ねこでもわかる 「さくら VPS」 を試してみる 第六回 -Let's Encrypt

サーバー・レンタルの大手 さくらのVPSが、ネコでもわかる!らしいので、初心者だけど試してみる。の第六回目。 今回は、サーバー証明書の取得の為、Let's Encriptを設定。

 
参考にするのは、さくら公式の導入ガイド「ネコでもわかる!さくらのVPS講座」
ネコに分かって、人間様に分からない筈はないので、早速、やってみる。 の六回目。

前回は、phpMyAdminをインストールして、そのセキュリティーー対策を実施した。 
Weサーバー環境構築して、その上にWordPress環境を構築する、というプロセスでは、必須の項目ではなかった。
六回目も、SSL証明書 Let’s Encryptの導入方法について。 

さくらのLet's Encriptのサポートに関するニュース・リリース(2017.11.21)によると、
以下の感じ。


Let's Encrypt」は、ドメイン名の使用権限を確認して発行する「ドメイン認証(DV)」タイプの無料のSSLサーバー証明書です。米国の非営利団体ISRG(Internet Security Research Group)が運営しています。発行スピードも早く、独自ドメインをご利用の方であれば、どなたでも発行できます
従来「さくらのVPS」で「 Let's Encrypt」の設定を行うにはお客様で設定が必要でしたが、本日から提供を開始する「Let's Encrypt」のスタートアップスクリプトをご利用すれば、お客様がサーバ上で作業をせずにSSLサーバー証明書を発行と設定ができます。さらに、通常必要な90日ごとの更新作業も自動的に行われます。

従来「さくらのVPS」で「 Let's Encrypt」の設定を行うにはお客様で設定が必要でしたが、本日から提供を開始する「Let's Encrypt」のスタートアップスクリプトをご利用すれば、お客様がサーバ上で作業をせずにSSLサーバー証明書を発行と設定ができます。さらに、通常必要な90日ごとの更新作業も自動的に行われます。

とのこと。 早速、やってみる。

*ちなみに、この設定を進めるには、独自ドメインを取得しておく必要があります。
 自分は、http://www.freenom.com/ で、12か月無料のドメインを取得しました。
(その取得の手続きは別途)

まずは、2つの前提となるセッティングを確認。

1) ApacheのSSLモジュールmod_sslが必要(第五回で実施済み)

・mod_sslが導入済みかどうかは以下のコマンドで確認

# httpd -M
・・・・
ssl_module (shared)
・・・

2) https通信がファイアウォールで許可
♯ firewall-cmd --list-all


services: dhcpv6-client ssh http https

が、表示されるリストの中にあればOK.

この2つの条件が揃っていれば、当然、https通信はできます。
でも、httpsでサイトにアクセスすると、以下のようなメッセージが出てしまう。
今回は、Let's Encryptを利用して、証明書を取得して、このメッセージを出ないようにしよう、
という話ですね。






Let’s Encryptのインストールを開始

Let's Encryptの 'certbot' は、epel レポジトリに入っています。 まだ、epelへのアクセスを可能にしていなければ
# yum install epel-release
の実行が必要です。

1) Certbotのインストール

yum install certbot python2-certbot-apache


***ガイドで上手くできなかったので、この部分は読み飛ばしてください***

certbotコマンドを実行して証明書をインストールします。 mossymob.tk の部分は自分のドメイン名に置き換えてください。(mossymob.tkは、無料で取得したドメイン名で12か月間有効になっています。)

 # certbot --apache -d mossymob.tz


(結果)
[root@localhost ~]# certbot --apache -d mossymob.tz
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):
kappamobestjp@gmail.com
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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: N
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mossymob.tz
Cleaning up challenges
Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.

IMPORTANT NOTES:
 - 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.



メッセージは、ガイダンスとちょっと違う。

気にせず、apacheの再起動。


# systemctl restart httpd

(結果)



ガイドに案内されている手順だけでは上手くできないようです。

後日、以下の公式サイトを参照しながら再チャレンジしてみます。

https://letsencrypt.jp/


***読み飛ばし終了***
 

1) Certbotのインストール
 yum install certbot python2-certbot-apache
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c ********************352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
 
Complete!
 
$ sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):(連絡先emailアドレス入力)
 
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: A
 
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: N
 
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mossymob.tk
2: jplife.mossymob.tk
3: uslife.mossymob.tk
4: www.mossymob.tk
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown
(Enter 'c' to cancel): [単にリターン・キー押下]
 
IMPORTANT NOTES:
 - Unable to install the certificate
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mossymob.tk/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mossymob.tk/privkey.pem
   Your cert will expire on 2019-03-29. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. 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.
 
Unable なのに Congratulationsとは、どういう意味?
 
実際にサイトにアクセスしてみる。
 
 
やっぱり、これじゃダメですね。
 
 


0 件のコメント:

コメントを投稿