| >> HOME >> FC5 MENU >> Webサーバー間通信暗号化 (Apache + mod_ssl) |
 |
|
|
|
|
|
|
|
|
|
|
| |
[root@linux ~]# yum -y install mod_ssl
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
core [1/3]
core 100% |=========================| 1.1 kB 00:00
updates [2/3]
updates 100% |=========================| 951 B 00:00
extras [3/3]
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mod_ssl to pack into transaction set.
mod_ssl-2.2.2-1.0.i386.rp 100% |=========================| 25 kB 00:00
---> Package mod_ssl.i386 1:2.2.2-1.0 set to be updated
--> Running transaction check
--> Processing Dependency: libnal.so.1 for package: mod_ssl
--> Processing Dependency: libdistcache.so.1 for package: mod_ssl
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for distcache to pack into transaction set.
distcache-1.4.5-13.i386.r 100% |=========================| 9.3 kB 00:00
---> Package distcache.i386 0:1.4.5-13 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mod_ssl i386 1:2.2.2-1.0 updates 99 k
Installing for dependencies:
distcache i386 1.4.5-13 core 120 k
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 219 k
Downloading Packages:
(1/2): distcache-1.4.5-13 100% |=========================| 120 kB 00:00
(2/2): mod_ssl-2.2.2-1.0. 100% |=========================| 99 kB 00:02
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: distcache ######################### [1/2]
Installing: mod_ssl ######################### [2/2]
Installed: mod_ssl.i386 1:2.2.2-1.0
Dependency Installed: distcache.i386 0:1.4.5-13
Complete!
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# cd /etc/httpd/conf/
[root@linux conf]# openssl genrsa -des3 -out ca.key -rand rand.dat 1024
0 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
...............++++++
.................++++++
e is 65537 (0x10001)
Enter pass phrase for ca.key: xxxxxxxxxxxxxx
Verifying - Enter pass phrase for ca.key: xxxxxxxxxxxxxx 
|
|
|
| |
|
|
| |
|
|
| |
[root@linux conf]# openssl req -new -x509 -days 365 -key ca.key -out ca.crt
Enter pass phrase for ca.key: xxxxxxxxxxxxxx
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) [GB]: JP
State or Province Name (full name) [Berkshire]: Chiba
Locality Name (eg, city) [Newbury]: Ichikawa
Organization Name (eg, company) [My Company Ltd]: Private_CA
Organizational Unit Name (eg, section) []: Admin
Common Name (eg, your name or your server's hostname) []: mountainbigroad.jp
Email Address []: webmaster@mountainbigroad.jp 
|
|
|
| |
|
|
| |
|
|
| |
[root@linux conf]# openssl genrsa -des3 -out server.key -rand rand.dat 1024
0 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
.......++++++
...................................................................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key: xxxxxxxxxxxxxx
Verifying - Enter pass phrase for server.key: xxxxxxxxxxxxxx 
|
|
|
| |
|
|
| |
|
|
| |
[root@linux conf]# openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key: xxxxxxxxxxxxxx
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) [GB]: JP
State or Province Name (full name) [Berkshire]: Chiba
Locality Name (eg, city) [Newbury]: Ichikawa
Organization Name (eg, company) [My Company Ltd]: MY_SERVER
Organizational Unit Name (eg, section) []: Admin
Common Name (eg, your name or your server's hostname) []: mountainbigroad.jp
Email Address []: webmaster@mountainbigroad.jp
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []: 
|
|
|
| |
|
|
| |
|
|
| |
[root@linux conf]# openssl rsa -in server.key -out server.key
Enter pass phrase for server.key: xxxxxxxxxxxxxx
writing RSA key
|
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# wget http://www.modssl.org/source/mod_ssl-2.8.27-1.3.36.tar.gz
--03:22:03-- http://www.modssl.org/source/mod_ssl-2.8.27-1.3.36.tar.gz
=> `mod_ssl-2.8.27-1.3.36.tar.gz'
www.modssl.org をDNSに問いあわせています... 195.30.6.168
www.modssl.org|195.30.6.168|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 820,432 (801K) [application/x-tar]
100%[=====================================================================>] 820,432 97.49K/s ETA 00:00
03:22:16 (75.98 KB/s) - `mod_ssl-2.8.27-1.3.36.tar.gz' を保存しました [820432/820432]
[root@linux ~]# tar xvfz mod_ssl-2.8.27-1.3.36.tar.gz
mod_ssl-2.8.27-1.3.36/ANNOUNCE
mod_ssl-2.8.27-1.3.36/CHANGES
:
:
mod_ssl-2.8.27-1.3.36/pkg.sslsup/mkcert.sh
mod_ssl-2.8.27-1.3.36/pkg.sslsup/sslsup.patch
|
|
|
| |
|
|
| |
[root@linux conf]# /root/mod_ssl-2.8.27-1.3.36/pkg.contrib/sign.sh server.csr
CA signing: server.csr -> server.crt:
Using configuration from ca.config
Enter pass phrase for ./ca.key: xxxxxxxxxxxxxx
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'JP'
stateOrProvinceName :PRINTABLE:'Chiba'
localityName :PRINTABLE:'Ichikawa'
organizationName :T61STRING:'Private_Server'
organizationalUnitName:PRINTABLE:'Admin'
commonName :PRINTABLE:'mountainbigroad.jp'
emailAddress :IA5STRING:'webmaster@mountainbigroad.jp'
Certificate is to be certified until Jul 6 18:24:05 2007 GMT (365 days)
Sign the certificate? [y/n]: y
1 out of 1 certificate requests certified, commit? [y/n]: y
Write out database with 1 new entries
Data Base Updated
CA verifying: server.crt <-> CA cert
server.crt: OK
|
|
|
| |
|
|
| |
|
|
| |
[root@linux conf]# openssl x509 -inform pem -in ca.crt -outform der -out ca.der 
|
|
|
| |
|
|
| |
[root@linux conf]# chmod -c -R 400 server.* ca.*
`server.crt' のモードを 0400 (r--------) に変更しました
`server.csr' のモードを 0400 (r--------) に変更しました
`server.key' のモードを 0400 (r--------) に変更しました
`ca.crt' のモードを 0400 (r--------) に変更しました
`ca.db.certs' のモードを 0400 (r--------) に変更しました
`ca.db.certs/01.pem' のモードを 0400 (r--------) に変更しました
`ca.db.index' のモードを 0400 (r--------) に変更しました
`ca.db.serial' のモードを 0400 (r--------) に変更しました
`ca.der' のモードを 0400 (r--------) に変更しました
`ca.key' のモードを 0400 (r--------) に変更しました
|
|
|
|
|
|
| |
|
|
| |
[root@linux ~]# vi /etc/httpd/conf.d/ssl.conf
:
# General setup for the virtual host, inherited from global configuration
DocumentRoot "/var/www/html"
#ServerName www.example.com:443
:
:
# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A test
# certificate can be generated with `make certificate' under
# built time. Keep in mind that if you've both a RSA and a DSA
# certificate you can configure both in parallel (to also allow
# the use of DSA ciphers, etc.)
SSLCertificateFile /etc/httpd/conf/server.crt
#SSLCertificateFile /etc/httpd/conf/ssl.crt/server-dsa.crt
# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/httpd/conf/server.key
#SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server-dsa.key
:
:
|
|
|
|
|
|
| |
|
|
| |
[root@linux ~]# service httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]
|
|
|
|
|
|
| |
|
|
| |  |
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
| |  |
|
| |
|
|
| |
|
|
| |  |
|
| |
|
|
| |  |
|
| |
|
|
| |
|
|
| |  |
|
| |
|
|
| |  |
|
| |
|
|
| |  |
|
| |  |
|
|
|
|
| |
|
|
 |
|
 |
 |