「apache」の編集履歴(バックアップ)一覧はこちら
「apache」(2007/03/08 (木) 21:40:54) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
<p>◆参考資料</p>
<p><a href=
"http://www.atmarkit.co.jp/flinux/index/indexfiles/apache2index.html">http://www.atmarkit.co.jp/flinux/index/indexfiles/apache2index.html</a></p>
<p>SSLの鍵の情報</p>
<p><a href=
"http://www.rinzo2.jp/~rinzo/apache_ssl/apache_and_ssl_00.htm">http://www.rinzo2.jp/~rinzo/apache_ssl/apache_and_ssl_00.htm</a><br>
</p>
<p>◆困ったこと</p>
<p>
・デフォルトでSSLが動いている。何で設定されているんだ?</p>
<p>
OK!:/etc/httpd/conf.dにssl.confがいた。mod_sslが動作しているようだ。(httpd.confでインクルードされていた)</p>
<br>
<p>ドキュメント保存先<br>
DocumentRoot "/var/www/html"<br>
<br></p>
<p>cgiの動作確認スクリプト</p>
<p><font face="Courier New" color="#663333">#!/usr/bin/perl<br>
<br>
# HTTPヘッダを出力<br>
print "Content-type: text/html ";<br>
<br>
# HTMLを出力<br>
print "<html> ";<br>
print "<head><title>sample</title></head> ";<br>
print "<body>Hello, CGI World!</body> ";<br>
print "</html> ";<br>
<br>
exit;</font></p>
<p><font face="Courier New" color="#663333">SSLに関して</font></p>
<hr>
<p><font face="Courier New" color="#663333">★参考URL<br>
<a href=
"http://www.atmarkit.co.jp/flinux/rensai/linuxtips/702apachessl.html">http://www.atmarkit.co.jp/flinux/rensai/linuxtips/702apachessl.html</a></font></p>
<p><font face="Courier New" color="#663333">★アパッチの鍵構成<br>
サーバ証明書 /etc/httpd/conf/ssl.crt/server.crt<br>
サーバ用秘密鍵 /etc/httpd/conf/ssl.key/server.key</font></p>
<p><font face="Courier New" color="#663333">◆CAの秘密鍵を作成<br>
# openssl genrsa -rand /var/log/maillog -out ca.key 1024<br>
161380 semi-random bytes loaded<br>
Generating RSA private key, 1024 bit long modulus<br>
......++++++<br>
.++++++<br>
e is 65537 (0x10001)</font></p>
<p><font face="Courier New" color=
"#663333">◆CA証明書の署名要求(CSR)を作成<br>
# openssl req -new -key ca.key -out ca.csr<br>
(省略)<br>
-----<br>
Country Name (2 letter code) [GB]:JP ←2文字国名(JP)<br>
State or Province Name (full name) [Berkshire]:Tokyo ←都道府県<br>
Locality Name (eg, city) [Newbury]:Chiyoda ←区市町村<br>
Organization Name (eg, company) [My Company Ltd]:Example
Corp. ←組織名<br>
Organizational Unit Name (eg, section) []:Example Dept. ←部署名<br>
Common Name (eg, your name or your server's hostname) []:Noriyuki<br>
Kitaura ←担当者名またはサーバ名など<br>
Email Address []:kitaura@example.co.jp ←メールアドレス</font></p>
<p><font face="Courier New" color="#663333">Please enter the following 'extra'
attributes<br>
to be sent with your certificate request<br>
A challenge password []: ←[Enter]キー<br>
An optional company name []: ←[Enter]キー</font></p>
<p><font face="Courier New" color=
"#663333">◆CA証明書に署名して発行(1年間有効の証明書)<br>
# openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt -days 365<br>
Signature ok<br>
subject=/C=JP/ST=Tokyo/L=Chiyoda/O=Example Corp./OU=Example Dept./CN=Noriyuki
<a href=
"mailto:Kitaura/emailAddress=kitaura@example.co.jp">Kitaura/emailAddress=kitaura@example.co.jp</a><br>
Getting Private key</font></p>
<p><font face="Courier New" color="#663333">★サーバ用の証明書<br>
◆サーバ用の秘密鍵<br>
openssl genrsa -rand /var/log/maillog -out server.key 1024<br>
5974 semi-random bytes loaded<br>
Generating RSA private key, 1024 bit long modulus<br>
...........++++++<br>
........................................................++++++<br>
e is 65537 (0x10001)</font></p>
<p><font face="Courier New" color=
"#663333">◆サーバ用の秘密鍵からサーバ証明書のCSR<br>
# openssl req -new -key server.key -out server.csr<br>
(省略)<br>
-----<br>
Country Name (2 letter code) [GB]:JP<br>
State or Province Name (full name) [Berkshire]:Tokyo<br>
Locality Name (eg, city) [Newbury]:Chiyoda<br>
Organization Name (eg, company) [My Company Ltd]:Example Corp.<br>
Organizational Unit Name (eg, section) []:Example Dept.<br>
Common Name (eg, your name or your server's hostname) []:www.example<br>
.jp ←ホスト名<br>
Email Address []:webmaster@example.jp</font></p>
<p><font face="Courier New" color="#663333">Please enter the following 'extra'
attributes<br>
to be sent with your certificate request<br>
A challenge password []:<br>
An optional company name []:</font></p>
<p><font face="Courier New" color=
"#663333">◆認証局が使用するシリアルナンバーのファイルを作成<br>
# echo 01 > ca.srl</font></p>
<p><font face="Courier New" color="#663333">◆証明書を発行<br>
# openssl x509 -req -days 365 -CA ca.crt -CAkey ca.key -in server.csr -out
server.crt<br>
Signature ok<br>
subject=/C=JP/ST=Tokyo/L=Chiyoda/O=Example Corp./OU=Example <a href=
"mailto:Dept./CN=example.jp/emailAddress=webmaster@example.jp">Dept./CN=example.jp/emailAddress=webmaster@example.jp</a><br>
Getting CA Private Key</font></p>
<p><font face="Courier New" color="#663333">◆鍵のコピー<br>
# cp server.crt /etc/httpd/conf/ssl.crt<br>
# cp server.key /etc/httpd/conf/ssl.key</font></p>
<p><font face="Courier New" color="#663333">◆Apacheを再起動</font></p>
<hr>
<p><font color="#000000">◆参考資料</font></p>
<p><a href=
"http://www.atmarkit.co.jp/flinux/index/indexfiles/apache2index.html"><font color="#000000">
http://www.atmarkit.co.jp/flinux/index/indexfiles/apache2index.html</font></a></p>
<p><font color="#000000">SSLの鍵の情報</font></p>
<p><a href=
"http://www.rinzo2.jp/~rinzo/apache_ssl/apache_and_ssl_00.htm"><font color=
"#000000">http://www.rinzo2.jp/~rinzo/apache_ssl/apache_and_ssl_00.htm</font></a><br>
</p>
<p><font color="#000000">◆困ったこと</font></p>
<p><font color=
"#000000">・デフォルトでSSLが動いている。何で設定されているんだ?</font></p>
<p><font color=
"#000000">OK!:/etc/httpd/conf.dにssl.confがいた。mod_sslが動作しているようだ。(httpd.confでインクルードされていた)</font></p>
<br>
<p><font color="#000000">ドキュメント保存先<br>
DocumentRoot "/var/www/html"<br>
<br></font></p>
<p><font color="#000000">cgiの動作確認スクリプト</font></p>
<p><font face="Courier New" color="#000000">#!/usr/bin/perl<br>
<br>
# HTTPヘッダを出力<br>
print "Content-type: text/html ";<br>
<br>
# HTMLを出力<br>
print "<html> ";<br>
print "<head><title>sample</title></head> ";<br>
print "<body>Hello, CGI World!</body> ";<br>
print "</html> ";<br>
<br>
exit;</font></p>
<p><font face="Courier New" color="#000000">SSLに関して</font></p>
<hr>
<p><font face="Courier New" color="#000000">★参考URL</font></p>
<p><font face="Courier New"><a href=
"http://www.verisign.co.jp/server/help/csr/capache_new.html"><font color=
"#000000">http://www.verisign.co.jp/server/help/csr/capache_new.html</font></a><br>
<a href=
"http://www.atmarkit.co.jp/flinux/rensai/linuxtips/702apachessl.html"><font color="#000000">
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/702apachessl.html</font></a></font></p>
<p><font face="Courier New" color="#000000">★アパッチの鍵構成<br>
サーバ証明書 /etc/httpd/conf/ssl.crt/server.crt<br>
サーバ用秘密鍵 /etc/httpd/conf/ssl.key/server.key</font></p>
<p><font face="Courier New" color="#000000">◆CAの秘密鍵を作成<br>
# openssl genrsa -rand /var/log/maillog -out ca.key 1024<br>
161380 semi-random bytes loaded<br>
Generating RSA private key, 1024 bit long modulus<br>
......++++++<br>
.++++++<br>
e is 65537 (0x10001)</font></p>
<p><font face="Courier New" color=
"#000000">◆CA証明書の署名要求(CSR)を作成<br>
# openssl req -new -key ca.key -out ca.csr<br>
(省略)<br>
-----<br>
Country Name (2 letter code) [GB]:JP ←2文字国名(JP)<br>
State or Province Name (full name) [Berkshire]:Tokyo ←都道府県<br>
Locality Name (eg, city) [Newbury]:Chiyoda ←区市町村<br>
Organization Name (eg, company) [My Company Ltd]:Example
Corp. ←組織名<br>
Organizational Unit Name (eg, section) []:Example Dept. ←部署名<br>
Common Name (eg, your name or your server's hostname) []:Noriyuki<br>
Kitaura ←担当者名またはサーバ名など<br>
Email Address []:kitaura@example.co.jp ←メールアドレス</font></p>
<p><font face="Courier New" color="#000000">Please enter the following 'extra'
attributes<br>
to be sent with your certificate request<br>
A challenge password []: ←[Enter]キー<br>
An optional company name []: ←[Enter]キー</font></p>
<p><font face="Courier New"><font color=
"#000000">◆CA証明書に署名して発行(1年間有効の証明書)<br>
# openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt -days 365<br>
Signature ok<br>
subject=/C=JP/ST=Tokyo/L=Chiyoda/O=Example Corp./OU=Example
Dept./CN=Noriyuki</font> <a href=
"mailto:Kitaura/emailAddress=kitaura@example.co.jp"><font color=
"#000000">Kitaura/emailAddress=kitaura@example.co.jp</font></a><br>
<font color="#000000">Getting Private key</font></font></p>
<p><font face="Courier New" color="#000000">★サーバ用の証明書<br>
◆サーバ用の秘密鍵<br>
openssl genrsa -rand /var/log/maillog -out server.key 1024<br>
5974 semi-random bytes loaded<br>
Generating RSA private key, 1024 bit long modulus<br>
...........++++++<br>
........................................................++++++<br>
e is 65537 (0x10001)</font></p>
<p><font face="Courier New" color=
"#000000">◆サーバ用の秘密鍵からサーバ証明書のCSR<br>
# openssl req -new -key server.key -out server.csr<br>
(省略)<br>
-----<br>
Country Name (2 letter code) [GB]:JP<br>
State or Province Name (full name) [Berkshire]:Tokyo<br>
Locality Name (eg, city) [Newbury]:Chiyoda<br>
Organization Name (eg, company) [My Company Ltd]:Example Corp.<br>
Organizational Unit Name (eg, section) []:Example Dept.<br>
Common Name (eg, your name or your server's hostname) []:www.example<br>
.jp ←ホスト名<br>
Email Address []:webmaster@example.jp</font></p>
<p><font face="Courier New" color="#000000">Please enter the following 'extra'
attributes<br>
to be sent with your certificate request<br>
A challenge password []:<br>
An optional company name []:</font></p>
<p><font face="Courier New" color=
"#000000">◆認証局が使用するシリアルナンバーのファイルを作成<br>
# echo 01 > ca.srl</font></p>
<p><font face="Courier New"><font color="#000000">◆証明書を発行<br>
# openssl x509 -req -days 365 -CA ca.crt -CAkey ca.key -in server.csr -out
server.crt<br>
Signature ok<br>
subject=/C=JP/ST=Tokyo/L=Chiyoda/O=Example Corp./OU=Example</font> <a href=
"mailto:Dept./CN=example.jp/emailAddress=webmaster@example.jp"><font color=
"#000000">Dept./CN=example.jp/emailAddress=webmaster@example.jp</font></a><br>
<font color="#000000">Getting CA Private Key</font></font></p>
<p><font face="Courier New" color="#000000">◆鍵のコピー<br>
# cp server.crt /etc/httpd/conf/ssl.crt<br>
# cp server.key /etc/httpd/conf/ssl.key</font></p>
<p><font face="Courier New" color="#000000">◆Apacheを再起動</font></p>
<hr>