<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Masashi Blog &#187; SSL</title>
	<atom:link href="http://www.masashi.org/blog/category/software/ssl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masashi.org/blog</link>
	<description>日々の四方山話を徒然と･･･</description>
	<lastBuildDate>Fri, 03 Sep 2010 06:53:53 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>SSL Certificates</title>
		<link>http://www.masashi.org/blog/2007/11/30/ssl-certificates/</link>
		<comments>http://www.masashi.org/blog/2007/11/30/ssl-certificates/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 14:23:46 +0000</pubDate>
		<dc:creator>Masashi</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.masashi.org/blog/archives/388</guid>
		<description><![CDATA[今までSSLサイトを自己署名した俗に言う「オレオレ証明書」で運用していたのですが、最近安いSSL Certificates(SSL証明書)が利用できるようになってきたので使ってみました。安い証明書ということで色々調べると [...]]]></description>
			<content:encoded><![CDATA[<p>今までSSLサイトを自己署名した俗に言う「オレオレ証明書」で運用していたのですが、最近安いSSL Certificates(SSL証明書)が利用できるようになってきたので使ってみました。安い証明書ということで色々調べると<a href="http://www.namecheap.com/">NameCheap</a>が扱っている<a href="http://www.namecheap.com/learn/other-services/ssl-certificates.asp">RapidSSLが一番安い</a>みたいです。同じRapidSSLでも<a href="http://www.rapidssl.com/index_ssl.htm">本家だと年間69ドル</a>と高かったり、日本語で扱っている所で30ドルくらいしてます。NameCheapのは3年期限だと年間12.88ドルです。今回はとりあえずということで1年期限で14.88ドルで購入しました。購入手続きをするとSSL証明書取得のリンクがユーザーパネルに現れます。</p>
<p><span id="more-388"></span></p>
<p>まずは下準備。SSL化するドメイン名はwww.sagamiya.comです。秘密鍵(sagamiya.com.key)を作ります。apacheの起動の度にパスフレーズを入力するのを避けたかったのでパスフレーズ無しで作りました。</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># cd /usr/local/etc/apache22</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># openssl genrsa -out sagamiya.<span style="">com</span>.<span style="">key</span> <span style="color:#800000;color:#800000;">1024</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># chmod <span style="color:#800000;color:#800000;">400</span> sagamiya.<span style="">com</span>.<span style="">key</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>これで-----BEGIN RSA PRIVATE KEY-----で始まり-----END RSA PRIVATE KEY-----　で終わる秘密鍵が生成されました。この秘密鍵はサーバー上から外には出さないようにします。rootにしか見えないように chmod 400 します。<br />
次に、この鍵とペアの公開鍵(sagamiya.com.csr)を作ります。<br />
この公開鍵の作成時に証明書に表示される情報の入力が求められます。</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># openssl req -new -key sagamiya.<span style="">com</span>.<span style="">key</span> -out sagamiya.<span style="">com</span>.<span style="">csr</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">You are about to be asked to enter information that will be incorporated</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">into your certificate request.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">What</span> you are about to enter is what is called a Distinguished Name or a DN.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">There</span> are quite a few fields but you can leave some blank</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">For some fields there will be a default value,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">If you enter <span style="color:#CC0000;">'.'</span>, the field will be left blank.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-----</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Country Name <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">2</span> letter code<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>AU<span style="color:#006600; font-weight:bold;">&#93;</span>:←日本なら<span style="color:#CC0000;">"JP"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">State or Province Name <span style="color:#006600; font-weight:bold;">&#40;</span>full name<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>Some-State<span style="color:#006600; font-weight:bold;">&#93;</span>:Queensland ←日本なら都道府県名</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Locality Name <span style="color:#006600; font-weight:bold;">&#40;</span>eg, city<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>:Gold Coast ←都市名</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Organization Name <span style="color:#006600; font-weight:bold;">&#40;</span>eg, company<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>Internet Widgits Pty Ltd<span style="color:#006600; font-weight:bold;">&#93;</span>:Sagamiya.<span style="">com</span>　←組織名</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Organizational Unit Name <span style="color:#006600; font-weight:bold;">&#40;</span>eg, section<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>:　←個人なのでブランク</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Common Name <span style="color:#006600; font-weight:bold;">&#40;</span>eg, YOUR name<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>:www.<span style="">sagamiya</span>.<span style="">com</span>　←SSLで使用するFQDN</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Email Address <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>:　←ブランク</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Please enter the following <span style="color:#CC0000;">'extra'</span> attributes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">to be sent with your certificate request</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">A challenge password <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>:　←ブランク</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">An optional company name <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>:　←ブランク</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>-----BEGIN CERTIFICATE REQUEST-----で始まり-----END CERTIFICATE REQUEST-----で終わる公開鍵が生成されました。 "CERTIFICATE REQUEST"とある通り、認証局(CA)に署名してもらうためのファイルということです。</p>
<p>次に、SSL証明書の申し込みリンクをクリックするとこんな画面が現れます。</p>
<p><a class="imagelink" title="ssl1.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl1.jpg"><img id="image831" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl1.thumbnail.jpg" alt="ssl1.jpg" width="200" height="197" /></a><br />
Select web serverでサーバーの種類を選びます。私の場合は"Apache + MOD SSL"を選びました。そして、Enter csrの窓に先程生成した公開鍵をコピペします。<br />
そして"Next"ボタンを押すと次の画面になります。</p>
<p><a class="imagelink" title="ssl2.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl2.jpg"><img id="image832" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl2.thumbnail.jpg" alt="ssl2.jpg" width="180" height="200" /></a><br />
コピペした公開鍵の内容とドメイン名のドメイン名やwhoisの情報からAPPROVERのe-mailアドレス候補が表示されています。内容を確認してメールアドレスを選択して"Next"ボタンを押します。</p>
<p><a class="imagelink" title="ssl3.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl3.jpg"><img id="image833" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl3.thumbnail.jpg" alt="ssl3.jpg" width="200" height="192" /></a></p>
<p>この画面ではSSL証明書の担当者の情報を入力します。 終わったら"Submit Order"ボタンを押します。</p>
<p><a class="imagelink" title="ssl4.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl4.jpg"><img id="image834" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl4.thumbnail.jpg" alt="ssl4.jpg" width="200" height="194" /></a></p>
<p>この画面で公開鍵に署名してもらうための申し込みが完了です。すぐにドメイン名のAdministratorのメールアドレス宛に下記のようなメールが届きます。何某からSSL証明書の署名の要求が来たがドメイン名の管理者としてこれを許可するかどうかの確認です。</p>
<p><a class="imagelink" title="ssl5.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl5.jpg"><img id="image838" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl5.thumbnail.jpg" alt="ssl5.jpg" width="124" height="200" /></a><br />
私の場合、署名の要求者とドメイン名の管理者が同じ人なので問題ありません。メールにあるリンク先にアクセスしてAPPROVE（承認します）ボタンを押します。</p>
<p><a class="imagelink" title="ssl6.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl6.jpg"><img id="image835" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl6.thumbnail.jpg" alt="ssl6.jpg" width="200" height="197" /></a></p>
<p><a class="imagelink" title="ssl7.jpg" rel="lightbox[pics]" href="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl7.jpg"><img id="image836" class="imageframe imgalignleft" src="http://www.masashi.org/blog/wp-content/uploads/2007/11/ssl7.thumbnail.jpg" alt="ssl7.jpg" width="200" height="105" /></a></p>
<p>これでしばらくすると-----BEGIN CERTIFICATE-----で始まり-----END CERTIFICATE-----で終わる形式の署名済みの証明書がメールが届きます。この証明書の部分をsagamiya.com.crtという名前の ファイルにコピペします。</p>
<p>これでSSL証明書が取得できました。あとは秘密鍵と同じ場所に証明書を置いて chmod 400 し、ApacheのSSL設定をすればOKです。私の環境では 今まで「オレオレ証明書」でSSLを動かしていたので/usr/local/etc/apache22/extra/httpd-ssl.conf の下記の部分を編集してApacheをリスタートするだけで完了です。</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite">
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SSLCertificateFile /usr/local/etc/apache22/sagamiya.<span style="">com</span>.<span style="">crt</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SSLCertificateKeyFile /usr/local/etc/apache22/sagamiya.<span style="">com</span>.<span style="">key</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masashi.org/blog/2007/11/30/ssl-certificates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
