ユーザ名やパスワード等の機密情報をWebブラウザから入力する場合、盗聴される恐れがあるため、Webサーバー間の通信内容を暗号化する。
ここでは、Webサーバーにmod_sslを導入して、URLをhttp://~ではなく、https://~でアクセスすることによって、Webサーバー間の通信内容を暗号化するようにする。
目次 |
[root@host3 ~]# yum -y install mod_ssl ← mod_sslインストール [root@host3 certs]# yum -y install make ← makeインストール
[root@host3 certs]# make server.crt
umask 77 ; \
/usr/bin/openssl genrsa -aes128 2048 > server.key
Generating RSA private key, 2048 bit long modulus
..+++
.........+++
e is 65537 (0x10001)
Enter pass phrase: ← 任意のパスワードを応答※表示はされない
Verifying - Enter pass phrase: ← 任意のパスワードを応答(確認)※表示はされない
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key server.key -x509 -days 3650 -out server.crt -set_serial 0
Enter pass phrase for server.key: ← 上記で応答したパスワードを応答※表示はされない
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:JP ← 国名応答
State or Province Name (full name) []:Tokushima ← 都道府県名応答
Locality Name (eg, city) [Default City]:Tokushima ← 市区町村名応答
Organization Name (eg, company) [Default Company Ltd]:sudachi.jp ← サイト名応答(なんでもいい)
Organizational Unit Name (eg, section) []: ← 空ENTER
Common Name (eg, your name or your server's hostname) []:sudachi.jp ← Webサーバー名応答
Email Address []:xxxx@sudachi.jp ← 管理者メールアドレス応答
[root@host3 certs]# openssl rsa -in server.key -out server.key ← サーバー用秘密鍵からパスワード削除
Enter pass phrase for server.key: ← サーバー用秘密鍵・証明書作成時のパスワード応答※表示はされない writing RSA key
[root@centos certs]# vi /etc/httpd/conf.d/ssl.conf ← ApacheSSL設定ファイル編集 SSLCertificateFile /etc/pki/tls/certs/server.crt ← サーバー用証明書を指定 SSLCertificateKeyFile /etc/pki/tls/certs/server.key ← サーバー用秘密鍵を指定 # General setup for the virtual host, inherited from global configuration #DocumentRoot "/var/www/html" ← #を削除(コメント解除) ↓ DocumentRoot "/var/www/html"
[root@host3 certs]# /etc/rc.d/init.d/httpd restart ← Apache再起動 httpd を停止中: [ OK ] httpd を起動中: [ OK ]