<?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>認証局 | 徒然なるままに</title>
	<atom:link href="https://www.seichan.org/tag/%e8%aa%8d%e8%a8%bc%e5%b1%80/feed" rel="self" type="application/rss+xml" />
	<link>https://www.seichan.org</link>
	<description>徒然と日々の出来事(ネタ)を書いていこうかと．主に FreeBSD，Unix系の話題が中心ですが，その他の話題もあつかってみたり．</description>
	<lastBuildDate>Thu, 04 Apr 2024 22:46:31 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>
	<item>
		<title>PHPki で簡単証明書運用 (5) 【管理ユーザのメンテナンスとCRLの取得】</title>
		<link>https://www.seichan.org/2014/02/post-486.html</link>
					<comments>https://www.seichan.org/2014/02/post-486.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Sun, 16 Feb 2014 15:08:27 +0000</pubDate>
				<category><![CDATA[PHPki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[証明書]]></category>
		<category><![CDATA[認証局]]></category>
		<guid isPermaLink="false">http://www.seichan.org/blog/?p=486</guid>

					<description><![CDATA[先日の「PHPki で簡単証明書運用 (4) 【作成した証明書を管理する】」の続きです．今回はCRLの取得と，管理ユーザのメンテナンスについて解説します． 目次 管理ユーザのメンテナンスhtpasswd ファイルのオーナ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">先日の「<a href="https://www.seichan.org/2014/02/post-448.html" target="_blank">PHPki で簡単証明書運用 (4) 【作成した証明書を管理する】</a>」の続きです．<br>今回はCRLの取得と，管理ユーザのメンテナンスについて解説します．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">管理ユーザのメンテナンス</a><ol><li><a href="#toc2" tabindex="0">htpasswd ファイルのオーナ・グループの変更</a></li><li><a href="#toc3" tabindex="0">管理画面へのアクセス</a></li><li><a href="#toc4" tabindex="0">ユーザの追加またはパスワード変更</a></li><li><a href="#toc5" tabindex="0">ユーザの削除</a></li><li><a href="#toc6" tabindex="0">ユーザ一覧の表示</a></li></ol></li><li><a href="#toc7" tabindex="0">CRLの取得</a><ol><li><a href="#toc8" tabindex="0">管理画面へアクセス</a></li><li><a href="#toc9" tabindex="0">CRLの表示</a></li><li><a href="#toc10" tabindex="0">CRL のダウンロード</a></li></ol></li><li><a href="#toc11" tabindex="0">一般利用者向けのインタフェース</a><ol><li><a href="#toc12" tabindex="0">管理インタフェースへのアクセス</a></li><li><a href="#toc13" tabindex="0">証明書の検索，表示，ダウンロード</a></li><li><a href="#toc14" tabindex="0">CA 証明書のダウンロード</a></li><li><a href="#toc15" tabindex="0">CA 証明書の表示</a></li><li><a href="#toc16" tabindex="0">CRL のダウンロード</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">管理ユーザのメンテナンス</span></h2>



<p class="wp-block-paragraph">管理ユーザのメンテナンスも PHPki で行う事が可能です．ただ，実際は htpasswd を編集しているだけですので Apache の htpasswd を直接実行する形でも問題はないと思います．<br>ここではせっかくですので PHPki 上から実施する方法を解説します．</p>



<h3 class="wp-block-heading"><span id="toc2">htpasswd ファイルのオーナ・グループの変更</span></h3>



<p class="wp-block-paragraph">これも不具合の一つですが，<span style="color: #993300;"><strong>普通にセットアップを進めると htpasswd ファイルのオーナが root となり，管理画面経由での修正が行えません．</strong></span>従いまして，管理画面経由でのユーザ情報修正を行う場合<span style="color: #993300;"><strong>事前準備が必要となります</strong></span>．</p>



<p class="wp-block-paragraph">SSH などでコンソールアクセスし，パスワードファイルを修正しましょう．<br>パスワードファイルは「<a title="PHPki で簡単証明書運用 (1)  【PHPki の修正と導入 (修正版)】" href="https://www.seichan.org/2014/01/post-375.html">PHPki で簡単証明書運用 (1) 【PHPki の修正と導入 (修正版)】</a>」での「<em><strong>Enter the location of your PHPki password (i.e. /etc/phpkipasswd):</strong></em>」で入力したパスになります．</p>



<p class="wp-block-paragraph">分からなくなってしまった場合は，PHPki を展開したディレクトリ以下の /ca/.htaccess などを開いて確認する事が可能です．<br><em><strong>.htaccess</strong> </em>の <em><strong>AuthUserFile</strong></em> 行にあるファイルパスがパスワードファイルとなります．</p>



<p class="wp-block-paragraph">このファイルを Apache 実行ユーザ (www など) に所有者を変更しましょう．次のような形で chown コマンドを実行してください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># chown www:www /usr/local/www/phpki-0.83/phpkipasswd</pre>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading"><span id="toc3">管理画面へのアクセス</span></h3>



<p class="wp-block-paragraph">証明書の作成と似ていますが，Apacheの Alias で設定した URL に /admin をつけてブラウザでアクセスしてください．証明書の管理の際と同様 Basic 認証のダイアログが表示されますので，ユーザ情報を入力して次に進んでください．<br>こんな感じのログイントップ画面が表示されれば管理画面アクセスは完了です．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki020.jpg"><img fetchpriority="high" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki020.jpg" alt="phpki020" class="wp-image-494"/></a></figure>



<h3 class="wp-block-heading"><span id="toc4">ユーザの追加またはパスワード変更</span></h3>



<p class="wp-block-paragraph">管理画面メニューの「<span style="color: #993300;"><strong>Add User or Change Password</strong></span>」をクリックすると，ユーザの追加または既存ユーザのパスワード変更を行うことができます．<br>ユーザ管理画面は次の画面となります．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki021.jpg"><img decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki021.jpg" alt="phpki021" class="wp-image-495"/></a></figure>



<p class="wp-block-paragraph">入力項目は次のとおりとなります．入力項目を全て入力後「<span style="color: #993300;"><strong>Submit</strong></span>」ボタンをクリックして次へ進めてください．</p>



<ol class="wp-block-list">
<li><span style="color: #993300;"><strong>UserID</strong></span><br>既存のユーザ名を入力するか，新規ユーザ名を入力します．既存のユーザ名の場合はパスワード変更，新規ユーザ名の場合はユーザ追加となります．</li>



<li><span style="color: #993300;"><strong>Password</strong></span><br>新しいパスワードを入力します．</li>



<li><span style="color: #993300;"><strong>Verify Password</strong></span><br>確認の為，もう一度パスワードを入力します．</li>
</ol>



<p class="wp-block-paragraph">ユーザの追加が成功すると，次の画面のような表示となり「<em><strong>Adding password for user [追加のユーザ名]</strong></em>」という表示があります．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki022.jpg"><img decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki022.jpg" alt="phpki022" class="wp-image-496"/></a></figure>



<p class="wp-block-paragraph">また，パスワード変更の場合は次の画面表示で「<em><strong>Updating password for user [変更したユーザ名]</strong></em>」の表示があります．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki023.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki023.jpg" alt="phpki023" class="wp-image-490"/></a></figure>



<h3 class="wp-block-heading"><span id="toc5">ユーザの削除</span></h3>



<p class="wp-block-paragraph">ユーザを削除する場合は管理画面メニューの「<span style="color: #993300;"><strong>Remove User</strong></span>」より行う事ができます．クリックすると次の画面に移動します．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki024.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki024.jpg" alt="phpki024" class="wp-image-491"/></a></figure>



<p class="wp-block-paragraph">削除したいユーザ名を入力し「<span style="color: #993300;"><strong>Submit</strong></span>」をクリックしてください．削除が成功すると，次の画面表示となり「<em><strong>Deleting password for user [削除したユーザ名]</strong></em>」の表示があります．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki025.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki025.jpg" alt="phpki025" class="wp-image-492"/></a></figure>



<h3 class="wp-block-heading"><span id="toc6">ユーザ一覧の表示</span></h3>



<p class="wp-block-paragraph">作成されているユーザの一覧を表示するには管理画面メニューの「<span style="color: #993300;"><strong>List Password File Contents</strong></span>」より行う事が出来ます．クリックすると次の画面表示となり，ユーザ一覧が表示されます．<br><span style="color: #993300; font-size: x-small;"><strong>正直，htpasswd ファイルそのままですのでやっつけ仕事すぎな気がしています&#8230;</strong></span></p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki026.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki026.jpg" alt="phpki026" class="wp-image-493"/></a></figure>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc7">CRLの取得</span></h2>



<p class="wp-block-paragraph">CRL(Certificate Revocation List) 失効した証明書のリストの取得について解説します．</p>



<h3 class="wp-block-heading"><span id="toc8">管理画面へアクセス</span></h3>



<p class="wp-block-paragraph">証明書の作成と同様，Apacheの Alias で設定した URL に /ca をつけてブラウザでアクセスしてください．<br>こんな感じのログイントップ画面が表示されれば管理画面アクセスは完了です．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki027.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki027.jpg" alt="phpki027" class="wp-image-498"/></a></figure>



<h3 class="wp-block-heading"><span id="toc9">CRLの表示</span></h3>



<p class="wp-block-paragraph">今リストされている一覧をテキストとして表示したい場合は「<span style="color: #993300;"><strong>Update &amp; View the Certificate Revocation List</strong></span>」より確認することが出来ます．クリックすると次のような画面となり，CRL の一覧が表示されます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki028.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki028.jpg" alt="phpki028" class="wp-image-499"/></a></figure>



<p class="wp-block-paragraph">CRL はシリアル番号で管理されており「<span style="color: #993300;"><strong>Revoked Certificates</strong></span>」以下にリストされます．実際にこれらシリアル番号はどの証明書だったのかを確認したい場合は管理画面トップの「<span style="color: #993300;"><strong>Manage Certificates</strong></span>」より<em><strong>失効(Revoke)</strong></em> となっている証明書の詳細を確認してください．</p>



<h3 class="wp-block-heading"><span id="toc10">CRL のダウンロード</span></h3>



<p class="wp-block-paragraph">CRL をダウンロードするには「<span style="color: #993300;"><strong>Download the Certificate Revocation List</strong></span>」をクリックする事でダウンロードが行えます．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc11">一般利用者向けのインタフェース</span></h2>



<p class="wp-block-paragraph">今までは管理者アクセスでの利用を紹介していましたが，認証無しの一般利用者向けのインタフェースも用意されています．一般利用者は表示またはダウンロードのみが可能となっています．</p>



<h3 class="wp-block-heading"><span id="toc12">管理インタフェースへのアクセス</span></h3>



<p class="wp-block-paragraph">証明書の作成と同様，Apacheの Alias で設定した URL にブラウザでアクセスしてください．今までは /ca などをつけていましたが今回はなにもつけません．<br>こんな感じのログイントップ画面が表示されれば管理画面アクセスは完了です．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki029.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki029.jpg" alt="phpki029" class="wp-image-500"/></a></figure>



<p class="wp-block-paragraph">各メニューは次のとおりです．</p>



<ul class="wp-block-list">
<li><strong>Search for a Certificate</strong><br>作成済みの証明書の検索，表示とダウンロードが出来ます．管理者向けインタフェースでは常に一覧として表示されていましたが，一般向けインタフェースでは検索よりマッチしたものだけの表示となります．</li>



<li><span style="color: #993300;"><strong>Download Our Root Certificate</strong></span><br>CA 証明書のダウンロードが出来ます．</li>



<li><span style="color: #993300;"><strong>Display Our Root Certificate (PEM Encoded)</strong></span><br>PEM 形式でエンコードされた CA 証明書を表示します．</li>



<li><span style="color: #993300;"><strong>Download Our Certificate Revocation List</strong></span><br>CRL をダウンロードできます．</li>
</ul>



<h3 class="wp-block-heading"><span id="toc13">証明書の検索，表示，ダウンロード</span></h3>



<p class="wp-block-paragraph">作成済みの証明書の検索と，マッチした証明書の表示またはダウンロードを行うには「<span style="color: #993300;"><strong>Search for a Certificate</strong></span>」を利用します．クリックすると次のような検索画面が表示されます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki030.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki030.jpg" alt="phpki030" class="wp-image-501"/></a></figure>



<p class="wp-block-paragraph">検索バーに証明書の名前を入力し「<span style="color: #993300;"><strong>Find It!</strong></span>」をクリックすると，入力と一致した証明書が次のような画面で一覧で表示されます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki031.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki031.jpg" alt="phpki031" class="wp-image-502"/></a></figure>



<p class="wp-block-paragraph"><span style="color: #993300;"><strong>虫眼鏡アイコン</strong></span>をクリックする事で詳細の表示，<span style="color: #993300;"><strong>ダウンロードアイコン</strong></span>をクリックすることでダウンロードが行えます．</p>



<p class="wp-block-paragraph">セキュリティ上の懸念ですが，これら証明書はパスワードで保護されていますので，これ自体が流出してもパスワードが漏れない限りは不正利用が出来ない．という事でこの実装にしているものと思われます．</p>



<h3 class="wp-block-heading"><span id="toc14">CA 証明書のダウンロード</span></h3>



<p class="wp-block-paragraph">CA 証明書をダウンロードしたい場合は「<span style="color: #993300;"><strong>Download Our Root Certificate</strong></span>」より行えます．<strong>クリックすると通常のブラウザの場合証明書のインストールを促される</strong>と思います．<strong>ファイルとして取得したい場合は右クリックからリンク先ファイルのダウンロード</strong>を行ってください．</p>



<h3 class="wp-block-heading"><span id="toc15">CA 証明書の表示</span></h3>



<p class="wp-block-paragraph">CA 証明書を PEM 形式で表示するには「<span style="color: #993300;"><strong>Display Our Root Certificate (PEM Encoded)</strong></span>」より行えます．クリックすると次のような PEM 形式で出力された画面が表示されます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki032.jpg"><img loading="lazy" decoding="async" width="679" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki032.jpg" alt="phpki032" class="wp-image-503"/></a></figure>



<h3 class="wp-block-heading"><span id="toc16">CRL のダウンロード</span></h3>



<p class="wp-block-paragraph">CRL をダウンロードするには「Download Our Certificate Revocation List」より行えます．クリックするとファイルダウンロードが開始されます．</p>



<p class="wp-block-paragraph">以上，若干駆け足で進んだ部分もありますが，PHP で証明書管理を行うソフトウェア PHPki の紹介となります．<br>導入部分の不具合などを修正した改変バージョンを今作成中ですので，そのうち公開したいと思っています．</p>



<p class="wp-block-paragraph">お付き合いありがとうございました．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2014/02/post-486.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHPki で簡単証明書運用 (4) 【作成した証明書を管理する】</title>
		<link>https://www.seichan.org/2014/02/post-448.html</link>
					<comments>https://www.seichan.org/2014/02/post-448.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Thu, 06 Feb 2014 16:28:21 +0000</pubDate>
				<category><![CDATA[PHPki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[証明書]]></category>
		<category><![CDATA[認証局]]></category>
		<guid isPermaLink="false">http://www.seichan.org/blog/?p=448</guid>

					<description><![CDATA[先日の「PHPki で簡単証明書運用 (3) 【署名されたサーバ証明書を作る】」の続きです．今回はタイトルのとおり，証明書の管理について纏めます．どんなものでもそうですが，管理が一番大事です．ましてや証明書ですからより慎 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">先日の「<a href="https://www.seichan.org/2014/02/post-423.html" target="_blank">PHPki で簡単証明書運用 (3) 【署名されたサーバ証明書を作る】</a>」の続きです．<br>今回はタイトルのとおり，証明書の管理について纏めます．<br>どんなものでもそうですが，管理が一番大事です．ましてや証明書ですからより慎重に行いましょう．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h3 class="wp-block-heading"><span id="toc1">管理画面へアクセス</span></h3>



<p class="wp-block-paragraph">証明書の作成と同様，Apacheの Alias で設定した URL に /ca をつけてブラウザでアクセスしてください．この画面は以前もアクセスしていると思いますので，認証を通過しログイントップより解説します．<br>こんな感じのログイントップ画面が表示されれば管理画面アクセスは完了です．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki013.jpg"><img loading="lazy" decoding="async" width="689" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki013.jpg" alt="phpki013" class="wp-image-470"/></a></figure>



<h3 class="wp-block-heading"><span id="toc2">証明書の管理</span></h3>



<p class="wp-block-paragraph">管理画面メニューの「<span style="color: #993300;"><strong>Manage Certificates</strong></span>」をクリックすると，証明書の管理を行うことができます．<br>証明書管理画面は次の画面となります．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki015.jpg"><img loading="lazy" decoding="async" width="689" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki015.jpg" alt="phpki015" class="wp-image-474"/></a></figure>



<p class="wp-block-paragraph">右側に4つのアイコンが用意されており、それぞれ次の作業で使用します．</p>



<ol class="wp-block-list">
<li><span style="color: #993300;"><strong>虫眼鏡</strong></span><br>選択した証明書の詳細内容を表示する</li>



<li><span style="color: #993300;"><strong>ダウンロード</strong></span><br>選択した証明書を証明書形式を指定してダウンロードする</li>



<li><span style="color: #993300;"><strong>無効化・失効</strong></span><br>選択した証明書を失効させ，証明書失効リストに失効情報を記載する</li>



<li><span style="color: #993300;"><strong>更新</strong></span><br>選択した証明書の有効期限を更新する</li>
</ol>



<h3 class="wp-block-heading"><span id="toc3">証明書の詳細内容を表示する</span></h3>



<p class="wp-block-paragraph">「<span style="color: #993300;"><strong>虫眼鏡アイコン</strong></span>」をクリックすると、次のように詳細情報を表示できます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki016.jpg"><img loading="lazy" decoding="async" width="689" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki016.jpg" alt="phpki016" class="wp-image-475"/></a></figure>



<p class="wp-block-paragraph">管理画面のトップで表示されるサマリはあまり多くの情報が載っていませんので，証明書の失効や更新を行う前にここで詳細情報を確認しましょう．<br>主な確認ポイントは次のとおりになるかと思います．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>Serial Number</strong></span></li>
</ul>



<p class="wp-block-paragraph">この画面上では「<strong>1048578 (0x100002)</strong>」が該当します．通常は意識することはありませんが，失効した場合のCRL(証明書失効リスト)は失効した証明書のシリアル番号で管理されますので，失効させたい場合は意識した方が良いでしょう．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>Issuer</strong></span></li>
</ul>



<p class="wp-block-paragraph">PHPki で管理している以上，PHPki の Root CA が載りますので，これも通常意識する必要はありませんが，きちんと<strong> PHPki の Root CA で署名されていること</strong>を確認しておきましょう．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>Certificate purposes</strong></span></li>
</ul>



<p class="wp-block-paragraph">証明書の種類がここでわかります．SSLサーバ証明書の場合は「<span style="color: #993300;"><strong>SSL Server</strong></span>」と「<strong>Netscape SSL Server</strong>」が「<span style="color: #993300;"><strong>Yes</strong></span>」になります．<br>証明書を多数管理すると，場合によっては同じホスト名で複数の証明書を作成することになります．その場合，失効，更新を行う際に間違って意図しない証明書を操作してしまう可能性が出てきますので，実施しようとしている証明書なのか，必ず確認しましょう．</p>



<p class="wp-block-paragraph">参考までに，<span style="color: #993300;"><strong>Certificate purposes</strong> </span>はこのような形でリストされています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">SSL client : No
SSL client CA : No
SSL server : Yes
SSL server CA : No
Netscape SSL server : Yes
Netscape SSL server CA : No
S/MIME signing : No
S/MIME signing CA : No
S/MIME encryption : No
S/MIME encryption CA : No
CRL signing : No
CRL signing CA : No
Any Purpose : Yes
Any Purpose CA : Yes
OCSP helper : Yes
OCSP helper CA : No</pre>



<h3 class="wp-block-heading"><span id="toc4">証明書のダウンロード</span></h3>



<p class="wp-block-paragraph">「<span style="color: #993300;"><strong>ダウンロード</strong></span>」アイコンをクリックすると，このような画面に移動します．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki017.jpg"><img loading="lazy" decoding="async" width="689" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki017.jpg" alt="phpki017" class="wp-image-479"/></a></figure>



<p class="wp-block-paragraph">証明書作成時に <strong>PEM</strong> 形式でダウンロードすることが出来ましたが，ダウンロードを忘れた場合や他の形式でダウンロードしたい場合，ここから実施します．ダウンロード出来る証明書タイプは次のとおりです．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>PKCS#12 Bundle</strong></span></li>
</ul>



<p class="wp-block-paragraph"><strong>PKCS#12 は IIS や Java の証明書として利用される形式</strong>で，<strong>秘密鍵と証明書を１つのファイルに格納する形式です</strong>．Apache では扱えません．Apache で扱うには PKCS#12 を PEM に変換する必要がありますので，最初から PEM で取得したほうがはやいです．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>PEM Certificate</strong></span></li>
</ul>



<p class="wp-block-paragraph"><strong>PEM 形式の証明書</strong>です．ダウンロードするファイルには証明書のみが含まれます．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>PEM Key</strong></span></li>
</ul>



<p class="wp-block-paragraph"><strong>PEM 形式の秘密鍵 (Private Key)</strong> です．ダウンロードするファイルには秘密鍵のみが含まれます．</p>



<ul class="wp-block-list">
<li><span style="color: #993300;"><strong>PEM Bundle</strong></span></li>
</ul>



<p class="wp-block-paragraph"><strong>PEM 形式の秘密鍵と証明書</strong>です．ダウンロードするファイルには秘密鍵，証明書の順番で含まれます．</p>



<ul class="wp-block-list">
<li><strong>PEM Bundle w/Root</strong></li>
</ul>



<p class="wp-block-paragraph"><strong>PEM 形式の秘密鍵と証明書，および CA 証明書が含まれます</strong>．ダウンロードするファイルには秘密鍵，証明書，CA 証明書の順番で含まれます．</p>



<p class="wp-block-paragraph">PKCS#12 は形式として秘密鍵と証明書がセットになっていますので悩む必要はないとおもいますが，PEM 形式は無駄に複数の方法があります．こちらは利用形態に合わせてダウンロードすることになります．<br><strong>一番手っ取り早いのは「<span style="color: #993300;">PEM Bundle w/Root</span>」でダウンロードすること</strong>です．秘密鍵と証明書を分けたい．という場合は必要に応じて，後でファイルを分割することで対応が出来ますので，都度取得や配布の手間がありません．</p>



<p class="wp-block-paragraph">また，<strong>運用として秘密鍵と証明書を明示的に分けて依頼者に渡したい</strong>．というような場合は「<span style="color: #993300;"><strong>PEM Certificate</strong></span>」と「<span style="color: #993300;"><strong>PEM Key</strong></span>」のそれぞれをダウンロードして提供する．という形になります．</p>



<p class="wp-block-paragraph"><strong>最終的にはどのような運用を行うのか</strong>．を検討したうえでダウンロード方法を決定して頂ければ問題はないでしょう．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h3 class="wp-block-heading"><span id="toc5">証明書の失効</span></h3>



<p class="wp-block-paragraph">「<span style="color: #993300;"><strong>失効</strong></span>」アイコンをクリックすると，このような画面が表示されます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki018.jpg"><img loading="lazy" decoding="async" width="689" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki018.jpg" alt="phpki018" class="wp-image-477"/></a></figure>



<p class="wp-block-paragraph"><strong>単純明快で「<span style="color: #993300;">Yes</span>」もしくは「<span style="color: #993300;">Cancel</span>」しかありません</strong>．<strong>当然「<span style="color: #993300;">Yes</span>」をクリックすると失効してしまいます．</strong></p>



<p class="wp-block-paragraph">しかし，理解しておく必要がある点として，<strong>失効したからといってもその失効した証明書が有効なのか無効なのかをリアルタイムにクライアントは判断できません</strong>．<br><strong>CRL(証明書失効リスト)</strong> をクライアントに配布するか，各自取得してもらうか．などのアクションを取って明示的にCRLを更新するまでは，有効なものとして扱われます．</p>



<p class="wp-block-paragraph">従って，<strong>どのようにCRLの更新を行うのか．の運用方法はあらかじめ検討しておく必要があります</strong>．</p>



<p class="wp-block-paragraph">とは言え，後述の「<strong>証明書の更新</strong>」に詳細を書きますがリアルタイムで CRL の更新・配布する仕組みを作ってしまうと PHPki の場合は運用が破たんしてしまいます&#8230;</p>



<h3 class="wp-block-heading"><span id="toc6">証明書の更新</span></h3>



<p class="wp-block-paragraph">「<span style="color: #993300;"><strong>更新</strong></span>」アイコンをクリックすると，このような画面が表示されます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki019.jpg"><img loading="lazy" decoding="async" width="689" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki019.jpg" alt="phpki019" class="wp-image-480"/></a></figure>



<p class="wp-block-paragraph">「<span style="color: #993300;"><strong>Certificate Password</strong></span>」に<strong>証明書作成時のパスワード</strong>(CA 証明書ではなく，更新する証明書のパスワード)を入力，「<span style="color: #993300;"><strong>Certificate Life</strong></span>」で<strong>更新する有効期間を選択</strong>し「<strong>Submit Request</strong>」ボタンをクリックすることで<strong>期限が更新された証明書が作成されます</strong>．</p>



<p class="wp-block-paragraph">注意点として，<strong>新しい証明書が作成された段階で既存の証明書は失効されてしまいます</strong>．従ってCRL(証明書失効リスト)をどのように配布するのか．をあらかじめ検討しておく必要があります．</p>



<p class="wp-block-paragraph"><span style="color: #993300; font-size: medium;"><strong>また，合わせて注意しなければならない点があります</strong></span>．<br>本当に注意する必要があると思いましたので，大きくしてみました&#8230;</p>



<p class="wp-block-paragraph"><strong>間違ったパスワードを入力して証明書の更新を試みた</strong>場合，<strong>新しい証明書が作成出来ない</strong>のは当然として，<span style="color: #993300;"><strong>既存の証明書も失効されてしまいます</strong></span>．</p>



<p class="wp-block-paragraph">ですので，その場合はあらためてすぐに，<span style="color: #993300;"><strong>失効した証明書から更新をかけて正しい証明書を作成する</strong></span>必要があります．<br>その為，上述の「証明書の失効」のところでリアルタイムにCRLを更新・配布する仕組みがあると破たんすると書いています&#8230;</p>



<p class="wp-block-paragraph"><span style="color: #993300; font-size: x-small;"><strong><span class="fz-14px">この動きはどうなんだ? と思うのですが&#8230;</span></strong></span></p>



<p class="wp-block-paragraph">以上，証明書の管理でした．次は CRL と PHPki のアカウント管理ついて書こうと思います．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2014/02/post-448.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHPki で簡単証明書運用 (3) 【署名されたサーバ証明書を作る】</title>
		<link>https://www.seichan.org/2014/02/post-423.html</link>
					<comments>https://www.seichan.org/2014/02/post-423.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Sat, 01 Feb 2014 19:19:04 +0000</pubDate>
				<category><![CDATA[PHPki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[証明書]]></category>
		<category><![CDATA[認証局]]></category>
		<guid isPermaLink="false">http://www.seichan.org/blog/?p=423</guid>

					<description><![CDATA[さて，先日の「PHPki で簡単証明書運用 (2) 【初期設定と Root CA 証明書作成】」の続きです．今回はタイトルのとおり，サーバ証明書を作ります． 管理画面へアクセス Apacheの Alias で設定した U [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">さて，先日の「<a href="https://www.seichan.org/2014/02/post-387.html" target="_blank">PHPki で簡単証明書運用 (2) 【初期設定と Root CA 証明書作成】</a>」の続きです．<br>今回はタイトルのとおり，サーバ証明書を作ります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h3 class="wp-block-heading"><span id="toc1">管理画面へアクセス</span></h3>



<p class="wp-block-paragraph">Apacheの Alias で設定した URL に /ca をつけてブラウザでアクセスしてください．多分こんな形で Forbidden になると思います．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki007.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-438" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki007.jpg" alt="phpki007" width="158" height="160"></a></p>



<p class="wp-block-paragraph">どのような形でも良いので HTTPS アクセスが可能な Web Server 環境であれば https://[サーバ名 or アドレス]/phpki/ca の形で SSL アクセスすると次のような認証画面が表示されます．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki008.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-433" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki008.jpg" alt="phpki008" width="316" height="90"></a></p>



<p class="wp-block-paragraph">ここのユーザ，パスワードは「secure.sh」実行時に指定したユーザ名とパスワードを入力してください．認証が成功するとこのようなトップ画面が表示されます．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki009.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-434" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki009.jpg" alt="phpki009" width="158" height="160"></a></p>



<p class="wp-block-paragraph">Web サーバの SSL 設定は，PHPki で証明書を作ってからやるんだ!! という方は .htaccess ファイルを修正して一時的に SSL(HTTPS) ではなく，通常の HTTP アクセスを可能なように設定しましょう．</p>



<p class="wp-block-paragraph">PHPki のソースを展開したディレクトリ以下に ca というディレクトリがあります．この ca ディレクトリ以下に .htaccess ファイルがありますので，このファイルを修正します．修正は簡単で，一番下の行の SSLRequreSSL をコメントアウトします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">AuthName &amp;amp;amp;amp;amp;amp;amp;quot;Restricted Area&amp;amp;amp;amp;amp;amp;amp;quot;
AuthType Basic
AuthUserFile &amp;amp;amp;amp;amp;amp;amp;quot;/usr/local/www/phpkipasswd-master&amp;amp;amp;amp;amp;amp;amp;quot;
require valid-user
SSLRequireSSL</pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">AuthName &amp;amp;amp;amp;amp;amp;amp;quot;Restricted Area&amp;amp;amp;amp;amp;amp;amp;quot;
AuthType Basic
AuthUserFile &amp;amp;amp;amp;amp;amp;amp;quot;/usr/local/www/phpkipasswd-master&amp;amp;amp;amp;amp;amp;amp;quot;
require valid-user
#SSLRequireSSL</pre>



<p class="wp-block-paragraph">に変更します．</p>



<p class="wp-block-paragraph">修正後あらためてブラウザでアクセスしてください．HTTP でも認証画面が表示され，認証が成功すると上述の管理画面トップが表示されます．</p>



<h3 class="wp-block-heading"><span id="toc2">署名されたサーバ証明書を作成する</span></h3>



<p class="wp-block-paragraph">さて，いよいよ本題です．<br>管理画面トップの「<span style="color: #993300;"><strong>Create a New Certificate</strong></span>」をクリックしてください．クリックすると「<span style="color: #993300;"><strong>Certificate Request Form</strong></span>」画面に移動します．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki0101.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-439" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki0101.jpg" alt="phpki010" width="157" height="160"></a></p>



<p class="wp-block-paragraph">ここから必要項目を入力していくのですが，アスタリスク(＊) が付いている項目は必須項目です．全部についています&#8230;<br>じゃぁ，全て必須項目って注釈で良いじゃないか!! と思いつつ，各項目を入力して行きましょう．</p>



<ul class="wp-block-list">
<li><strong>Common Name</strong></li>
</ul>



<p class="wp-block-paragraph">証明書を発行するサーバのホスト名を FQDN で入力します．たとえば，<span style="color: #993300;"><strong>www.seichan.org</strong></span> 等です．</p>



<p class="wp-block-paragraph">Tip として，ワイルドカード証明書を作る場合は *.seichan.org など，ホスト名部分をアスタリスク(*) にすることで作成出来ます．<br>利用頻度は低いと思いますが，IP<strong>アドレスを入力して設定することも可能です</strong>．アドレスが変わるということは良くある話ですので&#8230;</p>



<ul class="wp-block-list">
<li><strong>E-mail Address</strong></li>
</ul>



<p class="wp-block-paragraph">証明書を発行するサーバの管理者のメールアドレスを入力します．証明書内に埋め込まれますので外部に公開する場合などでは，恥ずかしいアドレスは避けましょう．</p>



<ul class="wp-block-list">
<li><strong>Organization (Company/Agency)</strong></li>
</ul>



<p class="wp-block-paragraph">組織名，通常は会社名の英文字正式名称を入力します．</p>



<ul class="wp-block-list">
<li><strong>Department/Unit</strong></li>
</ul>



<p class="wp-block-paragraph">所属名や部署名を英文字で入力します．OpenSSLで証明書を作成する際の Organizational Unit Name になります．</p>



<ul class="wp-block-list">
<li><strong>Locality (City/County)</strong></li>
</ul>



<p class="wp-block-paragraph">市町村名を英文字で入力します．</p>



<ul class="wp-block-list">
<li><strong>State/Province</strong></li>
</ul>



<p class="wp-block-paragraph">都道府県名を英文字で入力します．</p>



<ul class="wp-block-list">
<li><strong>Country</strong></li>
</ul>



<p class="wp-block-paragraph">2文字の国コードを入力します．日本の場合は「JP」です．</p>



<ul class="wp-block-list">
<li><strong>Certificate Password</strong></li>
</ul>



<p class="wp-block-paragraph">この証明書のパスワードを設定します．Root CA パスワードや，管理画面アクセス用のパスワードでは無いので注意してください．</p>



<ul class="wp-block-list">
<li><strong>Certificate Life</strong></li>
</ul>



<p class="wp-block-paragraph">証明書の有効期限を選択します．Root CA 証明書でも書きましたが，あまり長いのも本来は良くないことですので適切な有効年数を指定してください．</p>



<ul class="wp-block-list">
<li><strong>Key Size</strong></li>
</ul>



<p class="wp-block-paragraph">鍵長を選択します．大きいサイズの方が暗号強度が高いという事になります．Root CA と同等か一段低い程度で十分かと思います．</p>



<ul class="wp-block-list">
<li><strong>Certificate Use</strong></li>
</ul>



<p class="wp-block-paragraph">一番重要な箇所です．証明書を作成するにあたっての利用用途を選択します．<strong>Web サーバなどの SSL 証明書であれば</strong>「<span style="color: #993300;"><strong>SSL Server</strong></span>」<strong>を選択してください</strong>．下に選択項目と利用用途を表としてまとめましたので，よろしければ合わせてご参照ください．</p>



<p class="wp-block-paragraph">「SSL Server」を選択した場合，追加で2つの入力フォームが出現します．</p>



<ul class="wp-block-list">
<li><strong>Alternative DNS Names</strong></li>
</ul>



<p class="wp-block-paragraph">「Common Name」で入力したFQDN以外でも同じ証明書を利用したい場合はここに1行 1FQDN で入力します．上でワイルドカード署名書についてふれましたが，ワイルドカードだと範囲が広すぎる場合が多い為，ここのフィールドで必要分のみ設定した方がセキュアです．</p>



<ul class="wp-block-list">
<li><strong>IP&#8217;s</strong></li>
</ul>



<p class="wp-block-paragraph">「Common Name」で入力したIPアドレス以外でも同じ証明書を利用したい場合はここに1行 1IPで入力します．</p>



<p class="wp-block-paragraph">入力が完了したら「<span style="color: #993300;"><strong>Submitt Request</strong></span>」ボタンをクリックしてください．</p>



<p class="wp-block-paragraph">続いて入力内容の確認画面へ移りますので，入力内容の確認後問題があれば「Go Back」ボタンを，問題が無い場合は「<span style="color: #993300;"><strong>Yes! Create and Download</strong></span>」ボタンをクリックします．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki011.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-436" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki011.jpg" alt="phpki011" width="157" height="160"></a></p>



<p class="wp-block-paragraph">「<span style="color: #993300;"><strong>Yes! Create and Download</strong></span>」ボタンをクリックした後は内部的に証明書が作成，署名されます．その後，ブラウザのダウンロード画面が表示されますのでダウンロードしてください．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki012.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-437" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki012.jpg" alt="phpki012" width="152" height="120"></a></p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h3 class="wp-block-heading"><span id="toc3">証明書のパスワード除去</span></h3>



<p class="wp-block-paragraph">先ほどダウンロードした証明書は当然そのまま利用可能です．ですが，パスワードが埋め込まれている為，証明書を利用する (Apache などの) サービスやデーモンを起動させる際，毎回パスワード入力が必要となります．<br>パスワード入力を行う方が安全なことは間違いないのですが，それは知っているけど楽したい!! という方はパスワードを除去しちゃいましょう．</p>



<p class="wp-block-paragraph">パスワードの除去は PHPki では出来ないため，openssl コマンドで実施します．次のようなコマンドでパスワードを除去できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">openssl rsa -in www.seichan.org.pem -out www.seichan.org_nopwd.pem
Enter pass phrase for www.seichan.org.pem: [パスワード]</pre>



<p class="wp-block-paragraph">この場合パスワード有りの証明書ファイル「www.seichan.org.pem」からパスワードを除去し，「www.seichan.org_nopwd.pem」として証明書を作成しています．パスワード無しの証明書を使用するよう，ソフトウェアの設定を変更してください．</p>



<h3 class="wp-block-heading"><span id="toc4">証明書とRSA秘密鍵の分離</span></h3>



<p class="wp-block-paragraph">先ほどダウンロードした証明書はRSA秘密鍵とサーバ証明書がひとつのファイルに収められています．このまま利用することが可能なソフトウェアではそのまま利用しても問題はありません．ただ，分離して管理したい場合や，ひとつのファイルに纏められていると利用できないソフトウェアの場合は分離する必要があります．<br>これは通常のエディタで対応することが可能です．<br><strong>「<span style="color: #993300;">&#8212;&#8211;BEGIN RSA PRIVATE KEY&#8212;&#8211;</span>」から始まりその直後の「<span style="color: #993300;">&#8212;&#8211;END CERTIFICATE&#8212;&#8211;</span>」までが RSA秘密鍵</strong>となり，<strong>「<span style="color: #993300;">&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;</span>」から「<span style="color: #993300;">&#8212;&#8211;END CERTIFICATE&#8212;&#8211;</span>」までがサーバ証明書</strong>になります．</p>



<p class="wp-block-paragraph">これらの区切り文字を含んだ形でそれぞれのファイルとして保存することで分離出来ます．長くなるので間を端折りますが，次のような形のファイルを作成するということです．</p>



<ul class="wp-block-list">
<li><strong>RSA秘密鍵</strong></li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,D8B9BA859B623F2E
qBlaPoF5ludJ1Fta8fhgH1BZOVMV1VDN+m+EXM2R5mepam6WSuFfJXZBaJLaokPK
kwLCkpVdpzAXBxkOZJ8IevENqa0+hSR0N0jNsP3uK6cKtkkMgvkeGYRTpN36YNPc
....
XRptZ7V5dYEw2IUD7v/4qnM1mLxRLH6HLgI4iiY73XVXgfIsgfeNkh3C+g5v/Je4
-----END RSA PRIVATE KEY-----</pre>



<ul class="wp-block-list">
<li><strong>サーバ証明書</strong></li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">-----BEGIN CERTIFICATE-----
MIIG9jCCBd6gAwIBAgIDEAABMA0GCSqGSIb3DQEBDQUAMIG0MQswCQYDVQQGEwJK
UDEOMAwGA1UECBMFVG9reW8xEjAQBgNVBAcTCVNoaW5hZ2F3YTEcMBoGA1UEChMT
U2VpY2hhbiBIb21lIFNlcnZlcjEeMBwGA1UECxMVQ2VydGlmaWNhdGUgQXV0aG9y
...
Y0sfGwIhmoxAbNNKLN0uuRI/Us0T4Yils4yE
-----END CERTIFICATE-----</pre>



<h3 class="wp-block-heading"><span id="toc5">証明書種別のまとめ</span></h3>



<p class="wp-block-paragraph">付録として，各証明書種別の詳細な説明が記載されているサイトの URL をリンクしました．</p>



<figure class="wp-block-table"><table><tbody><tr><td><span style="font-size: x-small;"><strong>証明書種別</strong></span></td><td><span style="font-size: x-small;"><strong>利用用途</strong></span></td><td><span style="font-size: x-small;"><strong>詳細説明サイト</strong></span></td></tr><tr><td><span style="font-size: small;">E-mail, SSL Client</span></td><td><span style="font-size: small;">クライアント証明書</span></td><td><a rel="noopener" href="https://jp.globalsign.com/service/clientcert/knowledge/" target="_blank"><span style="font-size: small;">クライアント証明書とは (GlobalSign)</span></a></td></tr><tr><td><span style="font-size: small;">E-mail, SSL Client, Code Signing</span></td><td><span style="font-size: small;">コードサイニング証明書</span></td><td><a rel="noopener" href="http://yougo.ascii.jp/caltar/%E3%82%B3%E3%83%BC%E3%83%89%E3%82%B5%E3%82%A4%E3%83%8B%E3%83%B3%E3%82%B0" target="_blank"><span style="font-size: small;">コードサイニング (ASCIIデジタル用語辞典)</span></a></td></tr><tr><td><span style="font-size: small;">SSL Server</span></td><td><span style="font-size: small;">サーバ証明書</span></td><td><span class="removed_link" title="https://jp.globalsign.com/service/ssl/knowledge/"><span style="font-size: small;">SSLサーバ証明書とは (GlobalSign)</span></span></td></tr><tr><td><span style="font-size: small;">VPN Client Only</span></td><td><span style="font-size: small;">VPNクライアント用証明書</span></td><td><a rel="noopener" href="http://www.openvpn.jp/document/authentication-methods/" target="_blank"><span style="font-size: small;">OpenVPNで使用できる認証方法 (OpenVPN.JP)</span></a></td></tr><tr><td><span style="font-size: small;">VPN Server Only</span></td><td><span style="font-size: small;">VPNサーバ用証明書</span></td><td><a rel="noopener" href="http://www.openvpn.jp/document/authentication-methods/" target="_blank"><span style="font-size: small;">OpenVPNで使用できる認証方法 (OpenVPN.JP)</span></a></td></tr><tr><td><span style="font-size: small;">VPN Client, VPN Server</span></td><td><span style="font-size: small;">VPNクライアント・サーバ証明書(兼用)</span></td><td><a rel="noopener" href="http://www.openvpn.jp/document/authentication-methods/" target="_blank"><span style="font-size: small;">OpenVPNで使用できる認証方法 (OpenVPN.JP)</span></a></td></tr><tr><td><span style="font-size: small;">Time Stamping</span></td><td><span style="font-size: small;">タイムスタンプ局証明書</span></td><td><a rel="noopener" href="http://itpro.nikkeibp.co.jp/article/COLUMN/20060222/230396/" target="_blank"><span style="font-size: small;">電子文書の「タイムスタンプ」を解説する (IT Pro)</span></a></td></tr></tbody></table></figure>



<p class="wp-block-paragraph">なぜ「VPN Client Only」と「VPN Server Only」および「VPN Client, VPN Server」の説明サイトが同じ場所を指しているか．ですが，単純に PHPki のコード上，これら3つの処理の違いが無いからです&#8230;<br><span style="color: #993300;"><strong>単純にわかりやすいように名前を分けたのか，何か意図があって分けているのかが不明です&#8230;</strong></span></p>



<p class="wp-block-paragraph">以上，サーバ証明書を作る．でした．次回はそれら証明書の管理についてふれたいと思います．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2014/02/post-423.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHPki で簡単証明書運用 (2)  【初期設定と Root CA 証明書作成】</title>
		<link>https://www.seichan.org/2014/02/post-387.html</link>
					<comments>https://www.seichan.org/2014/02/post-387.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Fri, 31 Jan 2014 18:00:45 +0000</pubDate>
				<category><![CDATA[PHPki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[証明書]]></category>
		<category><![CDATA[認証局]]></category>
		<guid isPermaLink="false">http://www.seichan.org/blog/?p=387</guid>

					<description><![CDATA[さて，先日の「PHPki で簡単証明書運用 (1) 【修正版】」の続きです．以降は基本的にはブラウザでの操作がメインになります． RootCA 証明書を作成する Apacheの Alias で設定した URL にブラウザ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">さて，先日の「<a href="https://www.seichan.org/2014/01/post-375.html" target="_blank">PHPki で簡単証明書運用 (1) 【修正版】</a>」の続きです．以降は基本的にはブラウザでの操作がメインになります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h3 class="wp-block-heading">RootCA 証明書を作成する</h3>



<p class="wp-block-paragraph">Apacheの Alias で設定した URL にブラウザでアクセスすると，こんなトップ画面が表示されますので，画面右上の「<span style="color: #993300;"><strong>Setup</strong></span>」をクリックしてください．<br><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki001.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-395" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki001.jpg" alt="phpki001" width="160" height="170"></a></p>



<p class="wp-block-paragraph">すると，次の画面の「<span style="color: #993300;"><strong>Certificate Authority Initial Setup</strong></span>」が表示され，ここで RootCA の必要情報を入力して行きます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki002.jpg"><img loading="lazy" decoding="async" width="658" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki002.jpg" alt="phpki002" class="wp-image-396"/></a></figure>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki003.jpg"><img loading="lazy" decoding="async" width="658" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki003.jpg" alt="phpki003" class="wp-image-397"/></a></figure>



<p class="wp-block-paragraph">　　</p>



<p class="wp-block-paragraph">入力項目と各項目の説明は次のとおりです．</p>



<ul class="wp-block-list">
<li><strong>Organization</strong></li>
</ul>



<p class="wp-block-paragraph">組織名，通常は会社名の英文字正式名称を入力します．<br>なお，GlobalSign の Root CA の場合「GlobalSign」が入力されています．</p>



<ul class="wp-block-list">
<li><strong>Department/Unit</strong></li>
</ul>



<p class="wp-block-paragraph">所属名や部署名を英文字で入力します．OpenSSLでの自己認証局を作成する際の Organizational Unit Name になります．<br>なお，GlobalSign の Root CA の場合「GlobalSign Root CA &#8211; R3」等が入力されています．</p>



<ul class="wp-block-list">
<li><strong>Common Name</strong></li>
</ul>



<p class="wp-block-paragraph">認証局の名前を英文字で入力します．サーバ証明書では無いのでここはホスト名(FQDN)である必要はありません．むしろ，証明書の表示をした際にわかりやすい名前にすべきです．<br>GlobalSign の Root CA の場合「GlobalSign」が入力されています．</p>



<ul class="wp-block-list">
<li><strong>Technical Contact E-mail Address</strong></li>
</ul>



<p class="wp-block-paragraph">認証局を管理する所属が持つメールアドレスを入力します．PHPkiはメールアドレスの正当性を正規表現でチェックしていますので，正しいメールアドレス形式で入力してください．</p>



<ul class="wp-block-list">
<li><strong>Locality</strong></li>
</ul>



<p class="wp-block-paragraph">市町村名を英文字で入力します．</p>



<ul class="wp-block-list">
<li><strong>State/Province</strong></li>
</ul>



<p class="wp-block-paragraph">都道府県名を英文字で入力します．</p>



<ul class="wp-block-list">
<li><strong>Country</strong></li>
</ul>



<p class="wp-block-paragraph">2文字の国コードを入力します．日本の場合は「JP」です．</p>



<ul class="wp-block-list">
<li><strong>Password</strong></li>
</ul>



<p class="wp-block-paragraph">当然パスワードを入力します．このパスワードは今後サーバ証明書の署名等で利用しますので，推測しづらいけれど使いやすいパスワードが理想です．</p>



<ul class="wp-block-list">
<li><strong>Certificate Life</strong></li>
</ul>



<p class="wp-block-paragraph">Root CA 証明書の有効年数を選択します．あまり長いのも本来は良くないことですので適切な有効年数を指定してください。<br>とはいえ，大体は自己認証局って長めで作っちゃいますよね&#8230;</p>



<ul class="wp-block-list">
<li><strong>Key Size</strong></li>
</ul>



<p class="wp-block-paragraph">鍵長を選択します．大きいサイズの方が暗号強度が高いという事になりますが，2048bit もあれば十分じゃないでしょうか</p>



<ul class="wp-block-list">
<li><strong>Certficate Authority Base URL</strong></li>
</ul>



<p class="wp-block-paragraph">認証局の URL を入力します．URL は最後に / (スラッシュ) で終える必要があります．今現在アクセスしている URL を入力で問題はありません．</p>



<ul class="wp-block-list">
<li><strong>Certificate Authority CRL Distribution Points</strong></li>
</ul>



<p class="wp-block-paragraph">CRL (失効した証明書のリスト) を配布するポイントを入力します．上述の Base URL からの続きを入力するのですが，デフォルトのままで問題ありません．</p>



<ul class="wp-block-list">
<li><strong>Certificate Authority Revocation Check URL</strong></li>
</ul>



<p class="wp-block-paragraph">証明書の失効を確認する為の URL を入力します．こちらも上述の Base URL からの続きを入力するのですが，デフォルトのままで問題ありません．</p>



<ul class="wp-block-list">
<li><strong>Certificate Authority Policy URL</strong></li>
</ul>



<p class="wp-block-paragraph">認証局のポリシー (ステートメント・声明) を記載した URL を入力します．こちらも上述の Base URL からの続きを入力します．デフォルトのままで問題ありません．</p>



<ul class="wp-block-list">
<li><strong>Root Certificate Comment</strong></li>



<li><strong>Email Certificate Comment</strong></li>



<li><strong>Email/Signing Certificate Comment</strong></li>



<li><strong>SSL Server Certificate Comment</strong></li>



<li><strong>Time Stamping Certificate Comment</strong></li>
</ul>



<p class="wp-block-paragraph">ルート証明書，電子メール証明書などのコメント属性に埋め込む文字列を入力します．英文字で好きな文字列を入力してかまいません．以上が認証局の証明書等の入力項目となります．次に，保存場所等のシステム情報を「<span style="color: #993300;"><strong>Configuration Options</strong></span>」に入力していきます．</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki004.jpg"><img loading="lazy" decoding="async" width="658" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki004.jpg" alt="phpki004" class="wp-image-398"/></a></figure>



<ul class="wp-block-list">
<li><strong>Storage Directory</strong></li>
</ul>



<p class="wp-block-paragraph">証明書などのファイルを保存する場所を入力します．Apache Web Server の DocumentRoot の外 (Web ブラウザでアクセスが出来ない場所) を指定しましょう．ここで入力したディレクトリはあらかじめ作成しておく必要があります．<br>また，作成したディレクトリは，Web Server のユーザ権限で読み書き出来るように，ディレクトリオーナーを Apache 動作ユーザに変更します (chown www など)．また，他のユーザがアクセス出来ないようにパーミッションを絞ってください (chmod 700)．</p>



<ul class="wp-block-list">
<li><strong>Location of OpenSSL Executable</strong></li>
</ul>



<p class="wp-block-paragraph">openssl コマンドのパスを入力します．which openssl で表示されるパス名を入力しましょう．殆どの場合はデフォルトで大丈夫です．</p>



<ul class="wp-block-list">
<li><strong>Enter the location of your PHPki password</strong></li>
</ul>



<p class="wp-block-paragraph">前に「secure.sh」を実行した時に入力したパスワードファイルのパスを入力します．secure.sh で入れているのにここで入力させる意味がぶっちゃけ良くわかりません．なんで統合していないのか&#8230;</p>



<ul class="wp-block-list">
<li><strong>File Upload Prefix</strong></li>
</ul>



<p class="wp-block-paragraph">ここでプレフィックスを指定すると，ファイルをアップロードする際に必要であればプレフィックスを付けることが出来ます．複数の認証局を運用している場合などの環境では，どの認証局で署名したかわかりやすくなるとは思います．</p>



<ul class="wp-block-list">
<li><strong>Page Header Title</strong></li>
</ul>



<p class="wp-block-paragraph">PHPki のページヘッダのタイトルを設定します．英文字で好きな文字列に変更してかまいません．</p>



<ul class="wp-block-list">
<li><strong>Help Document Contact Info</strong></li>
</ul>



<p class="wp-block-paragraph">ヘルプページに埋め込む問い合わせ先情報を入力します．こちらも好きなように入力して構いません．</p>



<p class="wp-block-paragraph">以上でシステムの設定項目も終了です．「<span style="color: #993300;"><strong>Submit</strong></span>」ボタンをクリックするとこれら入力項目が反映され，Root CA 証明書が作成されます．<br><strong>「<span style="color: #993300;">Submit</span>」をクリックする前にディレクトリの作成を忘れないようにしましょう．</strong>正しく処理が完了すると次の画面が表示されます．「Procceed To The PHPki Main Menu」ボタンをクリックすると，PHPki トップ画面へ移動します。</p>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki005.jpg"><img loading="lazy" decoding="async" width="658" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki005.jpg" alt="phpki005" class="wp-image-399"/></a></figure>



<figure class="wp-block-image"><a href="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki006.jpg"><img loading="lazy" decoding="async" width="658" height="700" src="https://www.seichan.org/blog/wp-content/uploads/2014/02/phpki006.jpg" alt="phpki006" class="wp-image-400"/></a></figure>



<p class="wp-block-paragraph">　　</p>



<p class="wp-block-paragraph">トップ画面に移動でき，PUBLIC CONTENT MENU が表示されれば正常です。「Download Our Root Certificate」のリンクをクリックすると先ほど作成した Root CA 証明書がダウンロード出来ます．</p>



<p class="wp-block-paragraph">今回も長くなってしまったので，次回にまわします．次回はようやくサーバ証明書等の発行です．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2014/02/post-387.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHPki で簡単証明書運用 (1)  【PHPki の修正と導入 (修正版)】</title>
		<link>https://www.seichan.org/2014/01/post-375.html</link>
					<comments>https://www.seichan.org/2014/01/post-375.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Wed, 29 Jan 2014 18:39:10 +0000</pubDate>
				<category><![CDATA[PHPki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[証明書]]></category>
		<category><![CDATA[認証局]]></category>
		<guid isPermaLink="false">http://www.seichan.org/blog/?p=375</guid>

					<description><![CDATA[先日「PHPki で簡単証明書運用 (1)」を書いたのですが、これで取得したバージョンだと色々不具合があることがわかりました．導入方法含めて修正した方が良いと思ったので，別記事として修正版を書きなおします&#8230;  [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">先日「<a title="PHPki で簡単証明書運用 (1)" href="https://www.seichan.org/2014/01/post-347.html" target="_blank">PHPki で簡単証明書運用 (1)</a>」を書いたのですが、これで取得したバージョンだと色々不具合があることがわかりました．導入方法含めて修正した方が良いと思ったので，別記事として修正版を書きなおします&#8230;</p>



<p class="wp-block-paragraph">証明書を管理するのって大変ですよね．openssl のコマンドってよく使うコマンド群ではないので覚えづらいのと，作った物の管理もしづらかったり．<br>そんな怠惰な人にぴったりなのが「PHPki (PHPki Digital Certificate Authority)」です．PHPki は PHP で作成されている OpenSSL の Web フロントエンドです．<br>リンクしている大本のサイトにライブデモがありますので，どんなもんかちらっと見て頂ければと．<br>今回は，PHPki の導入と使い方を纏めたいと思います．利用開始までの手順がちょっと面倒なので備忘録を兼ねて&#8230;<br></p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-10" checked><label class="toc-title" for="toc-checkbox-10">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">ダウンロードとインストール</a><ol><li><a href="#toc2" tabindex="0">Makefile を修正して make distclean を実行する</a></li><li><a href="#toc3" tabindex="0">PHP ファイル群を修正する</a></li><li><a href="#toc4" tabindex="0">root ユーザで secure.sh を修正してから実行</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">ダウンロードとインストール</span></h2>



<p class="wp-block-paragraph">PHPki は Sourceforge で配布されています．「<a rel="noopener" href="http://sourceforge.net/projects/phpki/" target="_blank">http://sourceforge.net/projects/phpki/</a>」にアクセスしてダウンロードすることが可能です．最新版は 2014/01/30 現在 phpki-0.83.tar.gz なのですが，これが<span style="color: #993300;"><strong>結構不具合があることがわかりました</strong></span>．</p>



<p class="wp-block-paragraph">したがって，Sourceforge からのダウンロードではなく GitHub 「<a rel="noopener" href="https://github.com/radicand/phpki" target="_blank">https://github.com/radicand/phpki</a>」から最新のコードを取得することをお薦めします．<br>GitHub の画面右側に「<a rel="noopener" href="https://github.com/radicand/phpki/archive/master.zip" target="_blank">Download ZIP</a>」がありますので，これをクリックする事で最新のソースを zip 化してダウンロードすることが可能です．ファイル名は master.zip になります．</p>



<p class="wp-block-paragraph">取得したら Web サーバ上で展開します．Seichan の環境だと Ports で導入した Apache が動いていて，こういった物は <em><strong>/usr/local/www</strong></em> 以下において <em><strong>httpd.conf</strong></em> で <em><strong>Alias</strong></em> を設定する感じですので，例はそのような形で書きます．<br>RHEL 系の Linux だと <em><strong>/var/www</strong></em> とかだったと思いますが，そのあたり配置は自由です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cd /usr/local/www
# unzip /home/seichan/master.zip
Archive:  /home/seichan/master.zip
d phpki-master
 extracting: phpki-master/.htaccess
 extracting: phpki-master/CHANGELOG
 extracting: phpki-master/LICENSE.TXT
 extracting: phpki-master/Makefile
 extracting: phpki-master/README.md
 extracting: phpki-master/TODO
 extracting: phpki-master/about.php</pre>



<p class="wp-block-paragraph">Seichan の環境の場合は，先に書いたとおり Apache の Alais 設定ファイルとして <strong>/usr/local/etc/apache22/Includes</strong> 以下にファイルを作成します．<br><span style="color: #993300;"><strong>AllowOverride all</strong></span> は PHPki の Readme に記載されていますのでその通り追加しています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Alias /phpki083 "/usr/local/www/phpki-master"
&lt;Directory "/usr/local/www/phpki-master">
  Options none
  AllowOverride all
  Order Deny,Allow
  Allow from all
&lt;/Directory></pre>



<p class="wp-block-paragraph">以上が完了したら，ブラウザでアクセスし，正常に表示されるところまで確認してください．<br>よくある PHP 関連のソフトウェアは，この後ブラウザでアクセスして設定．という形なのですが，残念ながらこのままアクセスしてもうまく動作しませんので，以下の作業を続けて行います．</p>



<h3 class="wp-block-heading"><span id="toc2">Makefile を修正して make distclean を実行する</span></h3>



<p class="wp-block-paragraph">Linux の場合は修正の必要が無いかもしれません．次の2つの行 (32行目，34行目) の chown の個所を修正します．</p>



<p class="wp-block-paragraph">修正前</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">find . ! -type d -follow -exec chown $(UID).$(GID) {} \;
find . -type d -follow -exec chown $(UID).$(GID) {} \;</pre>



<p class="wp-block-paragraph">修正後</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">find . ! -type d -follow -exec chown $(UID):$(GID) {} \;
find . -type d -follow -exec chown $(UID):$(GID) {} \;</pre>



<p class="wp-block-paragraph">修正が終わったら，make distclean を実行します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># make distclean
find . -name .*.swp -follow -exec rm -f {} \;
find . -name test.php -exec rm -f {} \;
find . -name phpinfo.php -exec rm -f {} \;
find . -name "deleteme*" -exec rm -f {} \;
find . -name "newcert*.???" -exec rm -f {} \;</pre>



<p class="wp-block-paragraph">なぜ先に make distclean を行うのか．という理由ですが，zip を展開しただけの状態では .htaccess の構文が間違っている他，パーミッションの初期化をしてくれるからです．<br>これを実行しないと後々ハマることになるので必ず実施しましょう．</p>



<h3 class="wp-block-heading"><span id="toc3">PHP ファイル群を修正する</span></h3>



<p class="wp-block-paragraph">phpki-0.83 と違ってそんなに数はないのですが，一部 PHP 開始タグが <em><strong>&lt;?php</strong></em> ではなく <em><strong>&lt;?</strong></em> と，<span style="color: #993300;"><strong>short_open_tag</strong></span> が有効なことを想定した記述があります．<br>実行する環境で <span style="color: #993300;"><strong>short_open_tag</strong></span> が有効であれば問題はありませんが，無効な環境の場合，各ファイルを書き換えるか <strong><span style="color: #993300;">short_open_tag</span></strong> を有効にしてあげてください．先に修正した <em><strong>.htaccess</strong></em> に次の一文を追加してあげれば <strong><span style="color: #993300;">short_open_tag</span></strong> の対応が完了となります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">php_flag short_open_tag on</pre>



<p class="wp-block-paragraph">ファイルを修正したい．という人は次のファイルを修正してください．</p>



<ul class="wp-block-list">
<li>help.php の9行目から12行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;a href=&lt;?=BASE_URL?>help/PKI_basics.html>&lt;h3>PKI and E-mail Encryption- A Brief Explanation&lt;/h3>&lt;/a>
&lt;a href=&lt;?=BASE_URL?>help/cacert_install_ie.html>&lt;h3>Installing Our Root Certificate For Use With Outlook and Outlook Express&lt;/h3>&lt;/a>
&lt;p>&lt;a href=&lt;?=BASE_URL?>help/usercert_install_ie.html>&lt;h3>Installing Your Personal E-mail Certificate For Use With Outlook and Outlook Express&lt;/h3>&lt;/a>
&lt;p>&lt;a href=&lt;?=BASE_URL?>help/glossary.html>&lt;h3>Glossary&lt;/h3>&lt;/a></pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;a href=&lt;?php echo BASE_URL?>help/PKI_basics.html>&lt;h3>PKI and E-mail Encryption- A Brief Explanation&lt;/h3>&lt;/a>
&lt;a href=&lt;?php echo BASE_URL?>help/cacert_install_ie.html>&lt;h3>Installing Our Root Certificate For Use With Outlook and Outlook Express&lt;/h3>&lt;/a>
&lt;p>&lt;a href=&lt;?php echo BASE_URL?>help/usercert_install_ie.html>&lt;h3>Installing Your Personal E-mail Certificate For Use With Outlook and Outlook Express&lt;/h3>&lt;/a>
&lt;p>&lt;a href=&lt;?php echo BASE_URL?>help/glossary.html>&lt;h3>Glossary&lt;/h3>&lt;/a></pre>



<ul class="wp-block-list">
<li>help.php の14行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?</pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php</pre>



<ul class="wp-block-list">
<li>about.php の13行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Web application for managing a &lt;a href=&lt;?=BASE_URL?>help/glossary.html#PKI target=help/glossary></pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Web application for managing a &lt;a href=&lt;?php echo BASE_URL?>help/glossary.html#PKI target=help/glossary></pre>



<ul class="wp-block-list">
<li>ca/help.php の367行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?=$config[getting_help]?></pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php echo $config[getting_help]?></pre>



<ul class="wp-block-list">
<li>ca/help.php の371行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?</pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php</pre>



<ul class="wp-block-list">
<li>ca/request_cert.php の362行目，366行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;td>Alternative DNS Names&lt;br>(only one per Line)&lt;/td>&lt;td>&lt;textarea name=dns_names cols=30 rows=5>&lt;?= htvar($dns_names) ?>&lt;/textarea>&lt;/td>
&lt;td>IP's&lt;br>(only one per Line)&lt;/td>&lt;td>&lt;textarea name=ip_addr cols=30 rows=5>&lt;?= htvar($ip_addr) ?>&lt;/textarea>&lt;/td></pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;td>Alternative DNS Names&lt;br>(only one per Line)&lt;/td>&lt;td>&lt;textarea name=dns_names cols=30 rows=5>&lt;?php echo htvar($dns_names) ?>&lt;/textarea>&lt;/td>
&lt;td>IP's&lt;br>(only one per Line)&lt;/td>&lt;td>&lt;textarea name=ip_addr cols=30 rows=5>&lt;?php echo htvar($ip_addr) ?>&lt;/textarea>&lt;/td></pre>



<h3 class="wp-block-heading"><span id="toc4">root ユーザで secure.sh を修正してから実行</span></h3>



<p class="wp-block-paragraph">展開したディレクトリ直下に <em><strong>secure.sh</strong></em> というファイルがあります．実行したいところではあるのですが，一番大事なところが間違っているので修正します．</p>



<ul class="wp-block-list">
<li>secure.sh の65行目</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">user=${x:-apache}</pre>



<p class="wp-block-paragraph">を</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">owner=${x:-apache}</pre>



<p class="wp-block-paragraph">修正後，secure.sh を実行します．ただ，残念ながら(?) /bin/bash と先頭行に記載されています．ただ，<span style="color: #993300;"><strong>/bin/bash ではなく /bin/sh でも動作します</strong></span>ので，<span style="color: #993300;"><strong>bash が未導入の環境の場合は先頭行を /bin/sh に変更して実行してください</strong></span>．</p>



<p class="wp-block-paragraph">実行すると以下のような表示とともに，次の確認・入力項目が現れます．それぞれ環境に合わせて入力してください．</p>



<ul class="wp-block-list">
<li><em><strong>Enter the location of your PHPki password (i.e. /etc/phpkipasswd):</strong></em></li>
</ul>



<p class="wp-block-paragraph">パスワードファイルをどこに作るか聞かれますので，パスを指定します．本環境の場合，Apache の DocumentRoot 以外に展開して Alias で設定をしていますので，展開したディレクトリ (<em><strong>/usr/local/www/phpki-0.83/phpkipasswd</strong></em>) の一つ上のディレクトリにパスワードファイルを作成しています．</p>



<ul class="wp-block-list">
<li><em><strong>Enter a user id:</strong></em></li>



<li><em><strong>New password:</strong></em></li>



<li><em><strong>Re-type new password:</strong></em></li>
</ul>



<p class="wp-block-paragraph">管理者アカウント名を入力します．普段使いの管理者ユーザ名を指定してください．Seichan はとりあえず admin としています&#8230;<br>また，パスワードの入力も聞かれますので，2回入力してください．</p>



<ul class="wp-block-list">
<li><em><strong>See the README file for more information about the &#8216;pkiadmin&#8217; user.</strong></em></li>



<li><em><strong>New password</strong></em>:</li>



<li><em><strong>Re-type new password:</strong></em></li>
</ul>



<p class="wp-block-paragraph">いまいち理由がわからないのですが，デフォルトで pkiadmin というユーザも作成されます．これのパスワードも設定してください．</p>



<ul class="wp-block-list">
<li><em><strong>Enter the user ID your web server runs as [apache]:</strong></em></li>



<li><em><strong>Enter the group ID your web server runs as [apache]:</strong></em></li>
</ul>



<p class="wp-block-paragraph">Apache Web Server が動作するユーザID/グループID の指定が促されます．FreeBSD だと www というアカウントが Web Server 用アカウントですので www と指定していますが，これは環境に合わせてください．</p>



<ul class="wp-block-list">
<li><em><strong>Enter the IP or subnet address [192.168.0.0/16] which will be allowed access to the user admin module in under ./admin:</strong></em></li>
</ul>



<p class="wp-block-paragraph">admin という URL/ディレクトリ以下へのアクセスを許可するネットワークを指定してください．admin 以下の URL にアクセスして証明書の作成等を行いますので，許可している所からのアクセスに留めることが必要です．</p>



<p class="wp-block-paragraph">通しで実行した結果を以下に貼り付けます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># ./secure.sh

This application is designed to be an easy to use "certificate factory"
requiring minimum human intervention to administer.  It is intended for
use within a trusted INTRAnet for the creation and management of x.509
e-mail digital certificates by departmental managers.  IT IS NOT INTENDED
FOR USE OVER THE INTERNET.

This application stores private keys within a sub-directory, making them
potentially susceptible to compromise.  Extra care has been taken in the
design of this application to protect the security of your certificates,
on the condition that you INSTALL IT AS THE ROOT USER.  However, no
software is 100% secure.

Enter the location of your PHPki password (i.e. /etc/phpkipasswd): /usr/local/www/phpki-0.83/phpkipasswd

The file you specified does not yet exist.
Let's create it and add your first user.
Enter a user id: admin
Creating the admin user account...
New password:
Re-type new password:
Adding password for user admin
Creating the administrator account...
See the README file for more information about the
'pkiadmin' user.
New password:
Re-type new password:
Adding password for user pkiadmin

Enter the user ID your web server runs as [apache]: www

Enter the group ID your web server runs as [apache]: www

Enter the IP or subnet address [192.168.0.0/16] which will be allowed access
to the user admin module in under ./admin: 192.168.0.0/16

Working...
Done.</pre>



<p class="wp-block-paragraph">ベタな設定はこれで完了で，以降は Web アクセスして実施可能となります．キリが良いところになったので，次回にまわします&#8230;</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2014/01/post-375.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHPki で簡単証明書運用 (1)</title>
		<link>https://www.seichan.org/2014/01/post-347.html</link>
					<comments>https://www.seichan.org/2014/01/post-347.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Mon, 13 Jan 2014 17:11:39 +0000</pubDate>
				<category><![CDATA[PHPki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[証明書]]></category>
		<category><![CDATA[認証局]]></category>
		<guid isPermaLink="false">http://www.seichan.org/blog/?p=347</guid>

					<description><![CDATA[この記事は phpki-0.83.tar.gz を元に書きましたが，不具合多数の為最新のソースコードを取得して導入する方法に切り替えました．「PHPki で簡単証明書運用 (1) 【修正版】」に更新した記事を掲載していま [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><strong><span style="color: #993300; font-size: medium;">この記事は phpki-0.83.tar.gz を元に書きましたが，不具合多数の為最新のソースコードを取得して導入する方法に切り替えました．「<span style="color: #993300;"><a href="https://www.seichan.org/2014/01/post-375.html" target="_blank">PHPki で簡単証明書運用 (1) 【修正版】</a></span>」に更新した記事を掲載していますのでそちらを参照ください．</span></strong></p>



<p class="wp-block-paragraph"><strong><span style="color: #993300; font-size: medium;">以下はログとしておいてありますが，まったく参考になりません&#8230;</span></strong></p>



<p class="wp-block-paragraph">証明書を管理するのって大変ですよね．openssl のコマンドってよく使うコマンド群ではないので覚えづらいのと，作った物の管理もしづらかったり．<br>そんな怠惰な人にぴったりなのが「<a rel="noopener" href="http://phpki.sourceforge.net/" target="_blank">PHPki (PHPki Digital Certificate Authority)</a>」です．PHPki は PHP で作成されている OpenSSL の Web フロントエンドです．<br>リンクしている大本のサイトにライブデモがありますので，どんなもんかちらっと見て頂ければと．<br>今回は，PHPki の導入と使い方を纏めたいと思います．利用開始までの手順がちょっと面倒なので備忘録を兼ねて&#8230;</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-12" checked><label class="toc-title" for="toc-checkbox-12">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">ダウンロードとインストール</a><ol><li><a href="#toc2" tabindex="0">php.ini を修正する</a></li><li><a href="#toc3" tabindex="0">.htaccess を正しく修正する</a></li><li><a href="#toc4" tabindex="0">PHP ファイル群を修正する</a></li><li><a href="#toc5" tabindex="0">root ユーザで secure.sh を実行</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">ダウンロードとインストール</span></h2>



<p class="wp-block-paragraph">PHPki は Sourceforge で配布されています．「<a rel="noopener" href="http://sourceforge.net/projects/phpki/" target="_blank">http://sourceforge.net/projects/phpki/</a>」にアクセスし，最新の tarball を取得してください．<br># 最新のといっても，phpki-0.83.tar.gz が最新だと思いますし，0.83 は 2011/12 に公開されたようですので，だいぶ経っちゃっていますが&#8230;</p>



<p class="wp-block-paragraph">取得したら Web サーバ上で展開します．Seichan の環境だと Ports で導入した Apache が動いていて，こういった物は <em><strong>/usr/local/www</strong></em> 以下において <em><strong>httpd.conf</strong></em> で <em><strong>Alias</strong></em> を設定する感じですので，例はそのような形で書きます．<br>RHEL 系の Linux だと <em><strong>/var/www</strong></em> とかだったと思いますが，そのあたり配置は自由です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cd /usr/local/www
# tar xvf /home/seichan/phpki-0.83.tar.gz</pre>



<p class="wp-block-paragraph">Seichan の環境の場合は，先に書いたとおり Apache の Alais 設定ファイルとして <strong>/usr/local/etc/apache22/Includes</strong> 以下にファイルを作成します．<br><span style="color: #993300;"><strong>AllowOverride all</strong></span> は PHPki の Readme に記載されていますのでその通り追加しています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Alias /phpki083 "/usr/local/www/phpki-0.83"
&lt;Directory "/usr/local/www/phpki-0.83">
  Options none
  AllowOverride all
  Order Deny,Allow
  Allow from all
&lt;/Directory></pre>



<p class="wp-block-paragraph">よくある PHP 関連のソフトウェアは，この後ブラウザでアクセスして設定．という形なのですが，残念ながらこのままアクセスしてもうまく動作しませんので，以下の作業を続けて行います．</p>



<h3 class="wp-block-heading"><span id="toc2">php.ini を修正する</span></h3>



<p class="wp-block-paragraph">PHPki は POST メソッドで結構大きいデータを流します．その為，<span style="color: #993300;"><strong>register_long_arrays</strong></span> が有効である必要がありますので必要に応じて <span style="color: #993300;"><strong>register_long_arrays</strong></span> を <span style="color: #993300;"><strong>On</strong></span> にしてください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">register_long_arrays = On</pre>



<h3 class="wp-block-heading"><span id="toc3">.htaccess を正しく修正する</span></h3>



<p class="wp-block-paragraph">展開したディレクトリ直下に <em><strong>.htaccess</strong></em> ファイルが作成されていますが，このファイルの書式が正しくありません．<br>元のファイルはこの様な形で記述されていると思います．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">-e Options FollowSymLinks
-e php_flag register_globals off
-e php_flag register_long_arrays on
-e AddType application/x-x509-ca-cert .crt  .pem
-e AddType application/pkix-crl    .crl
-e AddType application/pkix-cert   .cer .der</pre>



<p class="wp-block-paragraph"><span style="color: #993300;"><strong>上述の設定を下の記述に修正してください．</strong></span></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Options FollowSymLinks
php_flag register_globals off
php_flag register_long_arrays on
AddType application/x-x509-ca-cert .crt  .pem
AddType application/pkix-crl    .crl
AddType application/pkix-cert   .cer .der</pre>



<h3 class="wp-block-heading"><span id="toc4">PHP ファイル群を修正する</span></h3>



<p class="wp-block-paragraph">良い/悪いの判断はおいておいて，PHP 開始タグが <em><strong>&lt;?php</strong></em> ではなく <em><strong>&lt;?</strong></em> と，<span style="color: #993300;"><strong>short_open_tag</strong></span> が有効なことを想定した記述があちこちにあります．ですので，実行する環境で <span style="color: #993300;"><strong>short_open_tag</strong></span> が有効であれば問題はありませんが，無効な環境の場合，各ファイルを書き換えるか <strong><span style="color: #993300;">short_open_tag</span></strong> を有効にしてあげてください．先に修正した <em><strong>.htaccess</strong></em> に次の一文を追加してあげれば対応が完了となります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">php_flag short_open_tag on</pre>



<h3 class="wp-block-heading"><span id="toc5">root ユーザで secure.sh を実行</span></h3>



<p class="wp-block-paragraph">展開したディレクトリ直下に <em><strong>secure.sh</strong></em> というファイルがありますので，これを実行します．残念ながら(?) /bin/bash と先頭行に記載されています．ただ，<span style="color: #993300;"><strong>/bin/bash ではなく /bin/sh でも動作します</strong></span>ので，<span style="color: #993300;"><strong>bash が未導入の環境の場合は先頭行を /bin/sh に変更して実行してください</strong></span>．</p>



<p class="wp-block-paragraph">実行すると以下のような表示とともに，次の確認・入力項目が現れます．それぞれ環境に合わせて入力してください．</p>



<ul class="wp-block-list">
<li><em><strong>Enter the location of your PHPki password (i.e. /etc/phpkipasswd):</strong></em></li>
</ul>



<p class="wp-block-paragraph">パスワードファイルをどこに作るか聞かれますので，パスを指定します．本環境の場合，Apache の DocumentRoot 以外に展開して Alias で設定する流れにしていますので，展開したディレクトリ (<em><strong>/usr/local/www/phpki-0.83/phpkipasswd</strong></em>) 以下にパスワードファイルを作成しています．</p>



<ul class="wp-block-list">
<li><em><strong>Enter a user id:</strong></em></li>



<li><em><strong>New password:</strong></em></li>



<li><em><strong>Re-type new password:</strong></em></li>
</ul>



<p class="wp-block-paragraph">管理者アカウント名を入力します．普段使いの管理者ユーザ名を指定してください．Seichan はとりあえず admin としています&#8230;<br>また，パスワードの入力も聞かれますので，2回入力してください．</p>



<ul class="wp-block-list">
<li><em><strong>See the README file for more information about the &#8216;pkiadmin&#8217; user.</strong></em></li>



<li><em><strong>New password</strong></em>:</li>



<li><em><strong>Re-type new password:</strong></em></li>
</ul>



<p class="wp-block-paragraph">いまいち理由がわからないのですが，デフォルトで pkiadmin というユーザも作成されます．これのパスワードも設定してください．</p>



<ul class="wp-block-list">
<li><em><strong>Enter the user ID your web server runs as [apache]:</strong></em></li>



<li><em><strong>Enter the group ID your web server runs as [apache]:</strong></em></li>
</ul>



<p class="wp-block-paragraph">Apache Web Server が動作するユーザID/グループID の指定が促されます．FreeBSD だと www というアカウントが Web Server 用アカウントですので www と指定していますが，これは環境に合わせてください．</p>



<ul class="wp-block-list">
<li><em><strong>Enter the IP or subnet address [192.168.0.0/16] which will be allowed access to the user admin module in under ./admin:</strong></em></li>
</ul>



<p class="wp-block-paragraph">admin という URL/ディレクトリ以下へのアクセスを許可するネットワークを指定してください．admin 以下の URL にアクセスして証明書の作成等を行いますので，許可している所からのアクセスに留めることが必要です．</p>



<p class="wp-block-paragraph">通しで実行した結果を以下に貼り付けます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># ./secure.sh

This application is designed to be an easy to use "certificate factory"
requiring minimum human intervention to administer.  It is intended for
use within a trusted INTRAnet for the creation and management of x.509
e-mail digital certificates by departmental managers.  IT IS NOT INTENDED
FOR USE OVER THE INTERNET.

This application stores private keys within a sub-directory, making them
potentially susceptible to compromise.  Extra care has been taken in the
design of this application to protect the security of your certificates,
on the condition that you INSTALL IT AS THE ROOT USER.  However, no
software is 100% secure.

Enter the location of your PHPki password (i.e. /etc/phpkipasswd): /usr/local/www/phpki-0.83/phpkipasswd

The file you specified does not yet exist.
Let's create it and add your first user.
Enter a user id: admin
Creating the admin user account...
New password:
Re-type new password:
Adding password for user admin
Creating the administrator account...
See the README file for more information about the
'pkiadmin' user.
New password:
Re-type new password:
Adding password for user pkiadmin

Enter the user ID your web server runs as [apache]: www

Enter the group ID your web server runs as [apache]: www

Enter the IP or subnet address [192.168.0.0/16] which will be allowed access
to the user admin module in under ./admin: 192.168.0.0/16

Working...
Done.</pre>



<p class="wp-block-paragraph">ベタな設定はこれで完了で，以降は Web アクセスして実施可能となります．キリが良いところになったので，次回にまわします&#8230;</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2014/01/post-347.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
