apache

◆参考資料

http://www.atmarkit.co.jp/flinux/index/indexfiles/apache2index.html

SSLの鍵の情報

http://www.rinzo2.jp/~rinzo/apache_ssl/apache_and_ssl_00.htm

◆困ったこと

・デフォルトでSSLが動いている。何で設定されているんだ?

OK!:/etc/httpd/conf.dにssl.confがいた。mod_sslが動作しているようだ。(httpd.confでインクルードされていた)


ドキュメント保存先
DocumentRoot "/var/www/html"

cgiの動作確認スクリプト

#!/usr/bin/perl

# HTTPヘッダを出力
print "Content-type: text/html ";

# HTMLを出力
print "<html> ";
print "<head><title>sample</title></head> ";
print "<body>Hello, CGI World!</body> ";
print "</html> ";

exit;

SSLに関して


★参考URL

http://www.verisign.co.jp/server/help/csr/capache_new.html
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/702apachessl.html

★アパッチの鍵構成
サーバ証明書 /etc/httpd/conf/ssl.crt/server.crt
サーバ用秘密鍵 /etc/httpd/conf/ssl.key/server.key

◆CAの秘密鍵を作成
# openssl genrsa -rand /var/log/maillog -out ca.key 1024
161380 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
......++++++
.++++++
e is 65537 (0x10001)

◆CA証明書の署名要求(CSR)を作成
# openssl req -new -key ca.key -out ca.csr
(省略)
-----
Country Name (2 letter code) [GB]:JP ←2文字国名(JP)
State or Province Name (full name) [Berkshire]:Tokyo ←都道府県
Locality Name (eg, city) [Newbury]:Chiyoda ←区市町村
Organization Name (eg, company) [My Company Ltd]:Example Corp. ←組織名
Organizational Unit Name (eg, section) []:Example Dept. ←部署名
Common Name (eg, your name or your server's hostname) []:Noriyuki
Kitaura ←担当者名またはサーバ名など
Email Address []:kitaura@example.co.jp ←メールアドレス

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ←[Enter]キー
An optional company name []: ←[Enter]キー

◆CA証明書に署名して発行(1年間有効の証明書)
# openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt -days 365
Signature ok
subject=/C=JP/ST=Tokyo/L=Chiyoda/O=Example Corp./OU=Example Dept./CN=Noriyuki
Kitaura/emailAddress=kitaura@example.co.jp
Getting Private key

★サーバ用の証明書
◆サーバ用の秘密鍵
openssl genrsa -rand /var/log/maillog -out server.key 1024
5974 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
...........++++++
........................................................++++++
e is 65537 (0x10001)

◆サーバ用の秘密鍵からサーバ証明書のCSR
# openssl req -new -key server.key -out server.csr
(省略)
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Tokyo
Locality Name (eg, city) [Newbury]:Chiyoda
Organization Name (eg, company) [My Company Ltd]:Example Corp.
Organizational Unit Name (eg, section) []:Example Dept.
Common Name (eg, your name or your server's hostname) []:www.example
.jp ←ホスト名
Email Address []:webmaster@example.jp

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

◆認証局が使用するシリアルナンバーのファイルを作成
# echo 01 > ca.srl

◆証明書を発行
# openssl x509 -req -days 365 -CA ca.crt -CAkey ca.key -in server.csr -out server.crt
Signature ok
subject=/C=JP/ST=Tokyo/L=Chiyoda/O=Example Corp./OU=Example
Dept./CN=example.jp/emailAddress=webmaster@example.jp
Getting CA Private Key

◆鍵のコピー
# cp server.crt /etc/httpd/conf/ssl.crt
# cp server.key /etc/httpd/conf/ssl.key

◆Apacheを再起動


最終更新:2007年03月08日 21:40