■ メモ
- 認証局は簡易認証局.
- SSL はパスワードなしで起動させる.
■ ダウンロード
最新版があればそちらをダウンロードする.
ダウンロードしたソースは適当なディレクトリと /usr/src 以下にコピーする.
■ OpenSSL のインストール
$ tar zxvf openssl-0.9.7c.tar.gz
$ cd openssl-0.9.7c
$ ./config
$ make
$ make test
# make install
■ 準備
パスワードの用意.
作業ディレクトリの作成
$ cd ~mondo5/src/
$ mkdir ssl ssl/CA ssl/admin
□ openssl の設定変更
# vi /usr/local/ssl/openssl.cnf
[ CA_default ]
default_days = 400 # how long to certify for
[ req ]
default_bits = 1024 # IE5 以下のためにKEY長を512bitに
[ req_distinguished_name ]
countryName_default = JA
stateOrProvinceName_default = Hokkaido
localityName_default = Sapporo
0.organizationName_default = Earth and Planetaly science
organizationalUnitName_default = Netcom
commonName_default = Netcom
emailAddress_default = epwww@ep.sci.hokudai.ac.jp
■ 認証局の構築
以下では mondo5 になって作業をする.
$ cd ~mondo5/src/ssl/CA
$ export PATH=/usr/local/ssl/bin:$PATH
$ /usr/local/ssl/misc/CA.sh -newca
CA certificate filename (or enter to create)
Making CA certificate ...
Using configuration from /usr/local/ssl/openssl.cnf
Generating a 512 bit RSA private key
.....+++++
................+++++
writing new priate key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:CA のパスワード
Verifying password - Enter PEM pass phrase:CA のパスワード
-----
(中略)
-----
Country Name (2 letter code) [JA]:
State or Province Name (full name) [Hokkaido]:
Locality Name (eg, city) [Sapporo]:
Organization Name (eg, company) [Earth and Planetaly science]:
Organizational Unit Name (eg, section) [Netcom]:
Common Name (eg, YOUR name) [Netcom]:
Email Address [epwww@ep.sci.hokudai.ac.jp]:
■ サーバ証明書の発行要求
Apache-sslにて開示するサーバの 証明書作成作業
$ cd ~mondo5/src/ssl/admin
$ openssl req -new -keyout privatekey.pem -out csr.pem
Using configuration from /usr/local/ssl/openssl.cnf
Generating a 512 bit RSA private key
.++++++++++++
.......++++++++++++
writing new private key to 'privatekey.pem'
Enter PEM pass phrase: サーバ管理者のパスワード
Verifying password - Enter PEM pass phrase: サーバ管理者のパスワード
-----
(中略)
-----
Country Name (2 letter code) [JA]:
State or Province Name (full name) [Hokkaido]:
Locality Name (eg, city) [Sapporo]:
Organization Name (eg, company) [Earth and Planetaly science]:
Organizational Unit Name (eg, section) [Netcom]:
Common Name (eg, YOUR name) [Netcom]:
Email Address [epwww@ep.sci.hokudai.ac.jp]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
作成された server_csr.pem は, CA に認証してもらう為のリクエスト.
serber_privatekey.pem は, サーバの秘密鍵である.
■ サーバ証明書発行
# vi /usr/local/ssl/openssl.cnf
[ usr_cert ]
nsCertType = server
コメントアウトをはずす
$ cd ~mondo5/src/ssl/CA
$ cp ../admin/csr.pem .
$ openssl ca -out cert.pem -infiles csr.pem
Using configuration from /usr/local/ssl/openssl.cnf
Enter PEM pass phrase: CA のパスワード
Check that the request matches the signature
Signature ok
Certificate Details:
---
(中略)
---
Certificate is to be certified until Jun 8 07:20:09 2003 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
server_cert.pem サーバ証明書. 公開鍵, 暗号化の方法, サーバの情報がはいっている
■ Apache-ssl のインストール
apache_1.3.29+ ssl_1.52.tar.gzは、apache_1.3.29 の
ソースツリーのトップで展開しなければならない
$ tar -zxvf apache_1.3.29.tar.gz
$ cd apache_1.3.29
$ tar -zxvf ../apache_1.3.29+ssl_1.52.tar.gz
$ ./FixPatch
うまく行かないときは openssl のディレクトリを指定
Your version of patch is OK.
(略)
Do you want me to apply the OpenSSL EGD patch for you? [n] (Entrer)
(略)
Do you want me to apply the fixed-up Apache-SSL patch for you? [n] y
patching file `src/support/apachectl'
patching file `src/support/suexec.c'
$ ./configure
$ make
# make install
■ Apache-ssl の設定
起動時にパスワードを聞かれないようにする.
$ cd ~mondo5/src/ssl/admin/
$ openssl rsa -in privatekey.pem -out privatekey_nopass.pem
Enter pass phrase for privatekey.pem: サーバ管理者のパスワード
writing RSA key
以上のファイルを/usr/local/ssl/certs/にコピー
# cp privatekey_nopass.pem /usr/local/ssl/certs/privatekey.pem
# cp ../CA/cert.pem /usr/local/ssl/certs/.
# cp ~epwww/src/ssl/CA/demoCA/cacert.pem /usr/local/ssl/private/.
設定ファイルの編集. 内容はここを参照.
# vi /usr/local/apache/conf/httpsd.conf
■ ssl の起動
Apache の設定ファイル httpsd.conf を読み込むようにする.
# /usr/local/apache/bin/httpsd -f /usr/local/apache/conf/httpsd.conf
|