ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
メインメニュー
検索
オンライン状況
24 人のユーザが現在オンラインです。 (3 人のユーザが ニュース を参照しています。)

登録ユーザ: 0
ゲスト: 24

もっと...
Let's Encryptを試す : 無償SSL/TLS証明書の Let's Encrypt を試す
投稿者: f-otake 投稿日時: 2017-2-1 17:35:47 (2381 ヒット)

SSLの証明書は高額になると思っていたら、近頃は無償の証明書が手に入るようになって来た。
今まではオレオレ証明書を使ってきたが、これだと一々ワーニングが出てユーザーに不便を強いるので、無償SSL/TLS証明書の Let's Encrypt を試してみる。
https://www.websec-room.com/2016/10/01/2698を参考にした。
参考にしたサイトはCentOS 7 とApache だが、私はCentOS 6 と Apache なので少し違う。
まずは Virtual Host の設定だが、私の場合は/etc/httpd/conf.d/ に virtualhost.conf と言う名で設定をしている。私はバーチャルホストを4つ設定しているので、内容は書かないが、https://www.websec-room.com/2016/10/01/2698 を参考にしてもらいたい。
必要なモジュールがあるので
# yum -y install httpd openssl mod_ssl
でインストールしておくが、私の場合は既にインストール済みである。
https://certbot.eff.org/アクセスすると (見づらい場合はブラウザの横幅を調整してください)

画面が開くので、SoftwareをApache、SystemをCentOS 6 を選ぶと
画面が代わり画像2になります。なので画像2の指示にしたがってやっていきます。
まずは
# wget https://dl.eff.org/certbot-auto
すると

--2017-01-31 19:26:22--  https://dl.eff.org/certbot-auto
dl.eff.org をDNSに問いあわせています... 173.239.79.196
dl.eff.org|173.239.79.196|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 46237 (45K) [application/octet-stream]
`certbot-auto' に保存中
100%[========================================>]
46,237      --.-K/s 時間 0.1s
2017-01-31 19:26:25 (384 KB/s) - `certbot-auto' へ保存完了 [46237/46237]

と表示が出て certbot-auto が保存されます。
次にこれに実行フラグを付け
# chmod a+x certbot-auto
そして実行
# ./certbot-auto
Bootstrapping dependencies for RedHat-based OSes...
yum is /usr/bin/yum
To use Certbot, packages from the EPEL repository need to be installed.
読み込んだプラグイン:fastestmirror, priorities, refresh-packagekit, security, versionlock
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
パッケージ epel-release-6-8.noarch はインストール済みか最新バージョンです
何もしません
読み込んだプラグイン:fastestmirror, priorities, refresh-packagekit, security, versionlock
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
パッケージ gcc-4.4.7-17.el6.x86_64 はインストール済みか最新バージョンです
パッケージ augeas-libs-1.0.0-10.el6.x86_64 はインストール済みか最新バージョンです
パッケージ openssl-1.0.1e-48.el6_8.3.x86_64 はインストール済みか最新バージョンです
パッケージ openssl-devel-1.0.1e-48.el6_8.3.x86_64 はインストール済みか最新バージョンです
パッケージ libffi-devel-3.0.5-3.2.el6.x86_64 はインストール済みか最新バージョンです
パッケージ redhat-rpm-config-9.0.3-51.el6.centos.noarch はインストール済みか最新バージョンです
パッケージ ca-certificates-2015.2.6-65.0.1.el6_7.noarch はインストール済みか最新バージョンです
パッケージ python-2.6.6-66.el6_8.x86_64 はインストール済みか最新バージョンです
パッケージ python-virtualenv は利用できません。←エラーが出ている
パッケージ python-pip は利用できません。←エラーが出ている
パッケージ 1:mod_ssl-2.2.15-56.el6.centos.3.x86_64 はインストール済みか最新バージョンです
依存性の解決をしています --> トランザクションの確認を実行しています
 ---> Package python-devel.x86_64 0:2.6.6-66.el6_8 will be インストール
 ---> Package python-tools.x86_64 0:2.6.6-66.el6_8 will be インストール
 --> 依存性の処理をしています: tkinter = 2.6.6-66.el6_8 のパッケージ: python-tools-2.6.6-66.el6_8.x86_64
 --> トランザクションの確認を実行しています。
 ---> Package tkinter.x86_64 0:2.6.6-66.el6_8 will be インストール
 --> 依存性の処理をしています: libtk8.5.so()(64bit) のパッケージ: tkinter-2.6.6-66.el6_8.x86_64
 --> 依存性の処理をしています: libTix.so()(64bit) のパッケージ: tkinter-2.6.6-66.el6_8.x86_64
 --> トランザクションの確認を実行しています。
 ---> Package tix.x86_64 1:8.4.3-5.el6 will be インストール
 ---> Package tk.x86_64 1:8.5.7-5.el6 will be インストール
 --> 依存性解決を終了しました。  依存性を解決しました
========================================================================================================================
  パッケージ                    アーキテクチャ          バージョン                        リポジトリー              容量
========================================================================================================================
インストールしています:
 python-devel                  x86_64                  2.6.6-66.el6_8                    updates                  173 k
 python-tools                  x86_64                  2.6.6-66.el6_8                    updates                  871 k
 依存性関連でのインストールをします。:
  tix                           x86_64                  1:8.4.3-5.el6                     base                     252 k
  tk                            x86_64                  1:8.5.7-5.el6                     base                     1.4 M
  tkinter                       x86_64                  2.6.6-66.el6_8                    updates                  258 k
 トランザクションの要約
========================================================================================================================
インストール         5 パッケージ
総ダウンロード容量: 2.9 M 
インストール済み容量: 8.4 M
これでいいですか? [y/N]

途中でエラーが出ていますが、とりあえずインストールするために y を入力、すると
パッケージをダウンロードしています:
(1/5): python-devel-2.6.6-66.el6_8.x86_64.rpm                                                    | 173 kB     00:00
(2/5): python-tools-2.6.6-66.el6_8.x86_64.rpm                                                    | 871 kB     00:00
(3/5): tix-8.4.3-5.el6.x86_64.rpm                                                                | 252 kB     00:00
(4/5): tk-8.5.7-5.el6.x86_64.rpm                                                                 | 1.4 MB     00:00
(5/5): tkinter-2.6.6-66.el6_8.x86_64.rpm                                                         | 258 kB     00:00
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    3.2 MB/s | 2.9 MB     00:00
rpm_check_debug を実行しています
トランザクションのテストを実行しています
トランザクションのテストを成功しました
トランザクションを実行しています
  インストールしています  : 1:tk-8.5.7-5.el6.x86_64                                                                 1/5
  インストールしています  : 1:tix-8.4.3-5.el6.x86_64                                                                2/5
  インストールしています  : tkinter-2.6.6-66.el6_8.x86_64                                                           3/5
  インストールしています  : python-tools-2.6.6-66.el6_8.x86_64                                                      4/5
  インストールしています  : python-devel-2.6.6-66.el6_8.x86_64                                                      5/5
  Verifying               : python-devel-2.6.6-66.el6_8.x86_64                                                      1/5
  Verifying               : tkinter-2.6.6-66.el6_8.x86_64                                                           2/5
  Verifying               : 1:tix-8.4.3-5.el6.x86_64                                                                3/5
  Verifying               : python-tools-2.6.6-66.el6_8.x86_64                                                      4/5
  Verifying               : 1:tk-8.5.7-5.el6.x86_64                                                                 5/5
インストール:
  python-devel.x86_64 0:2.6.6-66.el6_8                       python-tools.x86_64 0:2.6.6-66.el6_8
 依存性関連をインストールしました:
  tix.x86_64 1:8.4.3-5.el6             tk.x86_64 1:8.5.7-5.el6             tkinter.x86_64 0:2.6.6-66.el6_8
完了しました!
Creating virtual environment...
./certbot-auto: line 622: virtualenv: コマンドが見つかりません

と途中でエラーの為に止まります。これは python-virtualenv と python-pip が無いためです。
まずは python-pip をインストールし、そこから python-virtualenv をインストールします
# wget https://bootstrap.pypa.io/get-pip.py
とすると
--2017-01-31 19:34:30--  https://bootstrap.pypa.io/get-pip.py
bootstrap.pypa.io をDNSに問いあわせています... 151.101.72.175
bootstrap.pypa.io|151.101.72.175|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1595408 (1.5M) [text/x-python]
`get-pip.py' に保存中
100%
[==============================================================================>]
1,595,408   7.37M/s 時間 0.2s
2017-01-31 19:34:31 (7.37 MB/s) - `get-pip.py' へ保存完了 [1595408/1595408]

となるので、
# python get-pip.py
と入力すると
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop
support for Python 2.6
Collecting pip
/tmp/tmpazcLU0/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made,
but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect
TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see
https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
/tmp/tmpazcLU0/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not
available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a
newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
 Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
  100% |████████████████████████████████| 1.3MB 328kB/s
Collecting setuptools
 Downloading setuptools-34.1.0-py2.py3-none-any.whl (389kB)
  100% |████████████████████████████████| 399kB 992kB/s
Collecting wheel
 Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
  100% |████████████████████████████████| 71kB 2.7MB/s
Collecting six>=1.6.0 (from setuptools)
 Downloading six-1.10.0-py2.py3-none-any.whl
Collecting appdirs>=1.4.0 (from setuptools)
 Downloading appdirs-1.4.0-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools)
 Downloading packaging-16.8-py2.py3-none-any.whl
Collecting argparse; python_version == "2.6" (from wheel)
 Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools)
 Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
  100% |████████████████████████████████| 61kB 3.1MB/s
Installing collected packages: pip, six, appdirs, pyparsing, packaging, setuptools, argparse, wheel
 Found existing installation: argparse 1.2.1
  Uninstalling argparse-1.2.1:
   Successfully uninstalled argparse-1.2.1
Successfully installed appdirs-1.4.0 argparse-1.4.0 packaging-16.8 pip-9.0.1 pyparsing-2.1.10 setuptools-34.1.0 six-1.10.0 wheel-0.29.0
/tmp/tmpazcLU0/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not
available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a
newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.

と表示された。python 2.6 は今後サポートされないと出ているがとりあえずこのまま進む
# curl -kL https://bootstrap.pypa.io/get-pip.py | python
とすると
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current   Dload  Upload   Total   Spent    Left  Speed
 100 1558k  100 1558k    0     0  3117k      0 --:--:-- --:--:-- --:--:-- 5091k
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop
support for Python 2.6
Requirement already up-to-date: pip in /usr/lib/python2.6/site-packages

となり、既にup-to-date されているので、virtualenv をインストールする
# pip install virtualenv
とすると
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop
support for Python 2.6
Collecting virtualenv
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been
made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an
incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more
information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext
object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can
upgrade to a newer version of Python to solve this. For more information, see
https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
 InsecurePlatformWarning
 Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
   100% |████████████████████████████████| 1.8MB 252kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-15.1.0

となり、再度ワーニングが出るがインストールはされたので、再度
# ./certbot-auto
Bootstrapping dependencies for RedHat-based OSes...
yum is /usr/bin/yum
To use Certbot, packages from the EPEL repository need to be installed.
読み込んだプラグイン:fastestmirror, priorities, refresh-packagekit, security, versionlock
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
パッケージ epel-release-6-8.noarch はインストール済みか最新バージョンです
何もしません
読み込んだプラグイン:fastestmirror, priorities, refresh-packagekit, security, versionlock
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
パッケージ gcc-4.4.7-17.el6.x86_64 はインストール済みか最新バージョンです
パッケージ augeas-libs-1.0.0-10.el6.x86_64 はインストール済みか最新バージョンです
パッケージ openssl-1.0.1e-48.el6_8.3.x86_64 はインストール済みか最新バージョンです
パッケージ openssl-devel-1.0.1e-48.el6_8.3.x86_64 はインストール済みか最新バージョンです
パッケージ libffi-devel-3.0.5-3.2.el6.x86_64 はインストール済みか最新バージョンです
パッケージ redhat-rpm-config-9.0.3-51.el6.centos.noarch はインストール済みか最新バージョンです
パッケージ ca-certificates-2015.2.6-65.0.1.el6_7.noarch はインストール済みか最新バージョンです
パッケージ python-2.6.6-66.el6_8.x86_64 はインストール済みか最新バージョンです
パッケージ python-devel-2.6.6-66.el6_8.x86_64 はインストール済みか最新バージョンです
パッケージ python-virtualenv は利用できません。 ← 同じエラーが出ているが出来る
パッケージ python-tools-2.6.6-66.el6_8.x86_64 はインストール済みか最新バージョンです
パッケージ python-pip は利用できません。 ← 同じエラーが出ているが出来る
パッケージ 1:mod_ssl-2.2.15-56.el6.centos.3.x86_64 はインストール済みか最新バージョンです 何もしません
Creating virtual environment...
Installing Python packages...
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop
support for Python 2.6
Installation succeeded.
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer
supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
 DeprecationWarning
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: www.kinryokai.net
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1 ← 1を入力
Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): xxxxxxx@kinryokai.net ← メアドを入力
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A ← Aを入力
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for www.kinryokai.net
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0000_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0000_csr-certbot.pem
Deploying Certificate to VirtualHost /etc/httpd/conf.d/ssl.conf
Please choose whether HTTPS access is required or optional.
-------------------------------------------------------------------------------
1: Easy - Allow both HTTP and HTTPS access to these sites
2: Secure - Make all requests redirect to secure HTTPS access
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 ← 2 を入力
Created redirect file: le-redirect-www.kinryokai.net:443.conf
Rollback checkpoint is empty (no changes made?)
-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://www.kinryokai.net
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=www.kinryokai.net
-------------------------------------------------------------------------------
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
  /etc/letsencrypt/live/www.kinryokai.net/fullchain.pem. Your cert
  will expire on 2017-05-01. 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"
 - If you lose your account credentials, you can recover through
   e-mails sent to f-otake@kinryokai.net.
 - 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

これでやっと終わった。www.kinryokai.netにアクセスすると必ず、https://www.kinryokai.net になり、暗号化される
が!!試しにアクセスすると表示が崩れる

私はWEBにXOOPS(JPEx 1.8a)を使用しているが、どうもCSSを読んでいない様である。
そこで mainfile.php チェックすると
// XOOPS Virtual Path (URL)
	// Virtual path to your main XOOPS directory WITHOUT trailing slash
	// Example: define('XOOPS_URL', 'https://www.kinryokai.net/');
	define('XOOPS_URL', 'https://www.kinryokai.net'); ← http://をhttps://に変更
 	define('XOOPS_TRUST_PATH', '/xxxxxx/xxxxx');

とXOOPS_URLを指定する所があるのでhttpsに変更。これで表示が正常に戻った。
やれやれ

Printer Friendly Page Send this Story to a Friend
 
投稿された内容の著作権はコメントの投稿者に帰属します。
テーマ選択

(4 テーマ)
ミニカレンダー
前月2024年 3月翌月
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
<今日>
ピックアップ画像
dsc_0644
最近の画像
IMG_0004.jpg (2023-3-17)
IMG_0004.jpg
IMG_0003.jpg (2023-3-17)
IMG_0003.jpg
IMG_0010.jpg (2023-3-17)
IMG_0010.jpg
IMG_0013.jpg (2023-3-17)
IMG_0013.jpg
IMG_0007.jpg (2023-3-17)
IMG_0007.jpg
IMG_0005.jpg (2023-3-17)
IMG_0005.jpg
IMG_0002.jpg (2023-3-17)
IMG_0002.jpg
IMG_0011.jpg (2023-3-17)
IMG_0011.jpg
IMG_0009.jpg (2023-3-17)
IMG_0009.jpg
IMG_0008.jpg (2023-3-17)
IMG_0008.jpg
人気画像
ゴーキョピー... (5994 hits)
ゴーキョピー...
ギャチュンカ... (5855 hits)
ギャチュンカ...
ばあちゃんミ... (5755 hits)
ばあちゃんミ...
ヒマラヤ壁 (5661 hits)
ヒマラヤ壁
タムセルク残... (5470 hits)
タムセルク残...
Powered by Xoops2 Theme Modified by F-Otake
copyright (c) 2006 All rights reserved.