今更ながら、サイトを常時SSL化してみました。Googleという巨大企業に日和った形です(別に良いのです)ところで、当サイトはさくらインターネットではなく、IDCFクラウドのワンコインクラウドを(まだ)利用しています。なので、常時SSL化するにあたり、SSLをどうしようか悩みました
いつもの通り、できれば、なるべく出資は抑えたい。自分の動きでなんとかなるなら、それでなんとかしたい。という考えから、今回は、Let's Encryptを利用させていただきました(なんかいつの間にかずいぶんおしゃれなページに変わってます)
当サイトは、Centos6.9で運用中ですが、ちまたにある「let's encrypt インストールしました」みたいなサイトを見てインストールするとエラーがでて止まる可能性が高いです(もちろん出ないって環境もあると思いますが)
うちは以下のコマンドでインストールしようとしたところ、エラーがでてインストールが出来ませんでした。
[bash]git clone https://github.com/letsencrypt/letsencrypt[/bash]
で、letsencryptをインストール。letsencryptの中に移動して、以下のコマンドをたたき本体をインストール・・・
[bash]# ./letsencrypt-auto Bootstrapping dependencies for RedHat-based OSes... (you can skip this with --no-bootstrap) yum is /usr/bin/yum 読み込んだプラグイン:fastestmirror インストール処理の設定をしています Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * epel: mirror.dmmlabs.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp パッケージ gcc-4.4.7-18.el6.x86_64 はインストール済みか最新バージョンです パッケージ augeas-libs-1.0.0-10.el6.x86_64 はインストール済みか最新バージョンです パッケージ openssl-1.0.1e-57.el6.x86_64 はインストール済みか最新バージョンです
略
パッケージ 1:mod_ssl-2.2.15-60.el6.centos.6.x86_64 はインストール済みか最新バージョンです 何もしません Creating virtual environment... Installing Python packages... Had a problem while installing Python packages.
pip prints the following errors:
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 satisfied: argparse==1.4.0 in /opt/eff.org/certbot/venv/lib/python2.6/site-packages (from -r /tmp/tmp.x05LNfWY6T/letsencrypt-auto-requi rements.txt (line 11))
略
Downloading ConfigArgParse-0.12.0.tar.gz (41kB) Error [Errno 12] メモリを確保できません while executing command python setup.py egg_info
OSError: [Errno 12] メモリを確保できません
Certbot has problem setting up the virtual environment.
We were not be able to guess the right solution from your pip output.
Consult https://certbot.eff.org/docs/install.html#problems-with-python-virtual-environment for possible solutions. You may also find some support resources at https://certbot.eff.org/support/ .
[/bash]
と言ってエラーになります。エラーをよくよく見ると、
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
と書いてて、どうもPython のバージョンが古いのでバージョンアップしろと言ってる模様。いろいろ検索してみたら、このサイトを見つけてどうやらPython2.7じゃないとダメそう。
このサイトに書いてある通り、SCLをインストールして、yumでPython2.7をインストールして、その後、再度、「./letsencrypt-auto」すると、すんなりインストールが完了し、ヘルプを表示できました。
その後、以下のコマンドで、SSLを作成します
[bash]certbot-auto certonly --non-interactive --agree-tos --webroot -w /home/bambi1964/public_html -d www.bambi1964.com --email bambi@bambi1964.com[/bash]
この時、失敗しまして、うちは、bambi1964.comではアクセスできませんのでエラーが発生。bambi1964.comを消して、
[bash]certbot-auto certonly --non-interactive --agree-tos --webroot -w /home/bambi1964/public_html -d www.bambi1964.com --email bambi@bambi1964.com[/bash]
で、再度作成。無事作成完了しました。 あとは、httpdに設定すればOK
[bash]<VirtualHost *:443> ServerName www.bambi1964.com DocumentRoot /foo/bar/boo/public_html
<Directory "/foo/bar/boo/public_html/">
Options All
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /hoge/hoge2/cert.pem
SSLCertificateKeyFile /hoge/hoge2/privkey.pem
SSLCertificateChainFile /hoge/hoge2/chain.pem
</VirtualHost>[/bash]
そして、cronに登録して更新を自動化しておく
[bash]00 16 * * 2 root /usr/bin/certbot-auto renew --post-hook "service httpd restart"[/bash]
うちは実はまだ登録していないので、3ヶ月が来る前に登録して更新しておきます。
[pochipp id="11002"]
[pochipp id="11003"]