Apache の SSL 接続を有効にする 02
モジュールを確認する。
% apt-cache search apache | grep ssl apache-ssl - versatile, high-performance HTTP server with SSL support libapache-mod-ssl - Strong cryptography (HTTPS support) for Apache libapache-mod-ssl-doc - Documentation for Apache module mod_ssl libssl0.9.7 - SSL shared libraries libssl0.9.8 - SSL shared libraries
SSLモジュールをインストールする
% sudo apt-get install libapache-mod-ssl Setting up apache-common (1.3.34-4.1+etch1) ... Setting up libapache-mod-ssl (2.8.25-2) ... ./ca-bundle.crt ... Skipped ./snakeoil-dsa.crt ... 5d8360e1.0 ./snakeoil-rsa.crt ... 82ab5372.0 ./snakeoil-ca-dsa.crt ... 0cf14d7d.0 ./snakeoil-ca-rsa.crt ... e52d41d0.0
SSL 用設定ファイルの確認
% ls -l /etc/apache2/mods-available/ | grep ssl -rw-r--r-- 1 root root 1781 Sep 6 18:47 ssl.conf -rw-r--r-- 1 root root 58 Sep 6 18:47 ssl.load
% sudo cp /usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-ssl.conf.gz /etc/apache2/sites-available/ % sudo gunzip /etc/apache2/sites-available/httpd-ssl.conf.gz
シンボリックリンクを作成して httpd-ssl.conf を有効にする
% sudo a2ensite httpd-ssl.conf Site httpd-ssl.conf installed; run /etc/init.d/apache2 reload to enable. % ls -l /etc/apache2/sites-enabled/ | grep ssl lrwxrwxrwx 1 root root 36 Dec 29 22:43 httpd-ssl.conf -> /etc/apache2/sites-available/httpd-ssl.conf
httpd-ssl.conf を編集する
% sudo vi /etc/apache2/sites-available/httpd-ssl.conf SSLCertificateFile /etc/apache2/ssl/apache2.pem SSLCertificateKeyFile /etc/apache2/ssl/apache2.pem % sudo /usr/sbin/apache2 -S % sudo /etc/init.d/apache2 restart
秘密鍵と証明書をコピーして保存する
Apache の SSL 接続を有効にする 01 で生成した秘密鍵と証明書を保存する。
% sudo mkdir -p /etc/apache2/ssl/crt % sudo mkdir /etc/apache2/ssl/pem % sudo cp /usr/lib/ssl/misc/demoCA/cacert.crt /etc/apache2/ssl/crt/ % sudo cp /usr/lib/ssl/misc/demoCA/cacert.pem /etc/apache2/ssl/pem/