Fedra2SSL
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#contents
* SSL用証明書の作成(Linux編) [#o09cc8bd]
- ここで、作成した証明書は、ApacheやPostfix、Courier-IMAP...
- http://acorn.zive.net/~oyaji/www/certs_linux.htm を元...
** プライベート認証局(CA)の作成 [#tf742cda]
*** 事前準備 [#qfdb1a94]
- openssl-perl のインストール
[root@power root]# yum install openssl-perl
- /usr/share/ssl/openssl.cnf の設定
[ usr_cert ]
&ref(server.cr
# 最初にサーバ証明書を作成するため、「nsCertType」を「se...
# とするため、コメントアウトを外して有効にする。
# This is OK for an SSL server.
# nsCertType = server
nsCertType = server
[ v3_ca ]
# CA証明書作成時の証明書のタイプをSSL/E-mail用と指定する...
#「nsCertType」を「sslCA, emailCA」とするため、コメント...
# Some might want this also
# nsCertType = sslCA, emailCA
nsCertType = sslCA, emailCA
- 作業用ディレクトリを作成します
[root@power root]# mkdir /usr/local/certs
*** CA用秘密鍵 (cakey.pem) とCA用証明書 (cacert.pem) の作...
- ''COLOR(RED){プライベート認証局(CA) のパスフレーズを "...
[root@power root]# cd /usr/local/certs/
[root@power certs]# /usr/share/ssl/misc/CA.pl -newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
.......++++++
...++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase: ← "munakatafreedmanhisao"
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will...
into your certificate request.
What you are about to enter is what is called a Distingu...
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Kanagawa
Locality Name (eg, city) [Newbury]:Yokohama
Organization Name (eg, company) [My Company Ltd]:Private...
Organizational Unit Name (eg, section) []:Admin
Common Name (eg, your name or your server's hostname) []...
Email Address []:server_admin@hmuna.com
- この作業で以下のようなディレクトリ・ファイルが作成され...
/usr/local/certs [ ルートディレクトリ ]
|
└ demoCA [ 各種証明書等のルートディレ...
|
├ certs [ 証明書等のディレクトリ...
|
├ crl [ 破棄証明書一覧用のディレ...
|
├ newcerts [ クライアント証明書(...
| |
| ├ xxxxx..pem [ クライアント...
| | :
| └ xxxxx..pem [ クライアント...
|
├ private [ CA用の秘密鍵用ディレ...
| |
| └ cakey.pem [ CA用の秘密鍵 ]
|
├ cacert.pem [ CA用の証明書 ]
├ index.txt [ クライアント証...
└ serial [ クライアント証明書用...
*** CA証明書をブラウザにインポートするための ca.der ファ...
[root@power certs]# openssl x509 -inform pem -in ./demoC...
- ここで作成した ca.der をブラウザに登録する方法 → ht...
** サーバ用証明書の作成 [#t258c727]
- ApacheやPostfix、ProFTPD等で使用する サーバ証明書を作する
- ''COLOR(RED){[注意]: サーバ証明書を作成する場合、CA証...
*** サーバ用秘密鍵(server.key)の作成 [#scdea863]
- 鍵長1024ビットでサーバ用秘密鍵を作成
[root@power certs]# openssl genrsa -out server.key 1024
Generating RSA private key, 1024 bit long modulus
...++++++
...++++++
e is 65537 (0x10001)
*** サーバ用公開鍵 (server.csr) の作成 [#k30b3861]
- CAに送るデジタル証明書のリクエストファイルを作成
[root@power certs]# openssl req -new -key server.key -ou...
You are about to be asked to enter information that will...
into your certificate request.
What you are about to enter is what is called a Distingu...
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Kanagawa
Locality Name (eg, city) [Newbury]:Yokohama
Organization Name (eg, company) [My Company Ltd]:power.h...
Organizational Unit Name (eg, section) []:Admin
Common Name (eg, your name or your server's hostname) []...
Email Address []:server_admin@hmuna.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ← 何も入れずに Enter
An optional company name []: ← 何も入れずに Enter
[root@power certs]#
- ここのホスト名(上の例では www.hmuna.com )は、必ずhttps:...
- ''COLOR(RED){今回 SSL の Virtual server で2種類のエン...
- wiki 用の server.csr を別に作成する。
- wiki virtualhost 用の公開鍵(wiki_server.csr) の作成
[root@power certs]# openssl req -new -key server.key -ou...
You are about to be asked to enter information that will...
into your certificate request.
What you are about to enter is what is called a Distingu...
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Kanagawa
Locality Name (eg, city) [Newbury]:Yokohama
Organization Name (eg, company) [My Company Ltd]:wiki.hm...
Organizational Unit Name (eg, section) []:Admin
Common Name (eg, your name or your server's hostname) []...
Email Address []:server_admin@hmuna.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
*** サーバ用証明書 (server.crt) の作成 [#u9f06045]
- 認証局の証明書とキーを使って、X.509サーバ証明書の作成と...
- 認証局が使用するシリアルナンバーファイルがないので、dem...
[root@power certs]# echo 01 > ./demoCA/ca-cert.srl
[root@power certs]# cat ./demoCA/ca-cert.srl
01
[root@power certs]# openssl x509 -CA ./demoCA/cacert.pem...
-CAserial ./demoCA/ca-cert.srl -req -in server.csr -out ...
Signature ok
subject=/C=JP/ST=Kanagawa/L=Yokohama/O=hmuna.com/OU=Admi...
Getting CA Private Key
Enter pass phrase for ./demoCA/private/cakey.pem: ← CA用...
[root@power certs]#
- wiki.hmuna.com の中で www.hmuna.com の証明書を指定する...
[root@power certs]# openssl x509 -CA ./demoCA/cacert.pem...
-CAserial ./demoCA/ca-cert.srl -req -in wiki_server.csr ...
Signature ok
subject=/C=JP/ST=Kanagawa/L=Yokohama/O=hmuna.com/OU=Admi...
/emailAddress=munakata@hmuna.com
Getting CA Private Key
Enter pass phrase for ./demoCA/private/cakey.pem: ← muna...
[root@power certs]# openssl x509 -CA ./demoCA/cacert.pem
-CAkey ./demoCA/private/cakey.pem
-CAserial ./demoCA/ca-cert.srl -req -in webmail_server.c...
-out webmail_server.crt
Signature ok
subject=/C=JP/ST=Kanagawa/L=Yokohama/O=hmuna.com/OU=Admi...
/emailAddress=munakata@hmuna.com
Getting CA Private Key
Enter pass phrase for ./demoCA/private/cakey.pem: ← muna...
- www 用(server.crt)とwiki 用(wiki_server.crt)が別に作...
[root@power certs]# ls -l
合計 52
drwxr-xr-x 6 root root 4096 1月 15 21:27 demoCA
-rw-r--r-- 1 root root 1864 1月 15 21:33 mail.pem
-rw-r--r-- 1 root root 1864 1月 15 19:50 mail.pem_...
-rw-r--r-- 1 root root 973 1月 15 21:32 mail_serv...
-rw-r--r-- 1 root root 725 1月 15 20:23 mail_serv...
-rw------- 1 apache apache 23 1月 15 19:51 secret_wi...
-rw------- 1 apache apache 55 1月 15 19:51 secret_wi...
-rw------- 1 apache apache 54 1月 15 19:51 secret_ww...
-rw-r--r-- 1 root root 973 1月 15 21:31 server.crt
-rw-r--r-- 1 root root 725 1月 15 19:46 server.csr
-rw-r--r-- 1 root root 891 1月 15 19:44 server.key
-rw-r--r-- 1 root root 973 1月 15 21:31 wiki_serv...
-rw-r--r-- 1 root root 725 1月 15 19:47 wiki_serv...
** メール用証明書の作成 [#ld2ceebd]
- 以下の手順でメール用(Courier-IMAP)の証明書を作成
*** メール用証明書 (mail.pem) の作成 [#t9349da8]
- メール用証明書 (mail.pem) を、サーバ証明書と鍵から作成
- ここで問題発生、今回サーバーの DNS エントリーはプライマ...
が登録されており、www.hmuna.com と wiki.hmuna.com は別名(...
構成となっている。メールサーバーがSSL通信に引用する証明書...
mail.hmuna.com を期待しているので、ここで www.hmuna.com ...
証明書からメール証明書を作成すると、メール送受信時にエラ...
- この問題の対策のために mail_server.csr を作成してから m...
作成して、ここからメール用証明書を作成した。 (2005-1-14)
[root@power certs]# (cat mail_server.crt ; cat server.ke...
// ** クライアント用証明書等のバックアップ [#v4cc4d19]
// - CA.plを使用して、クライアント証明書を発行するとリク...
// - 中でも、リクエストファイルは後述するクライアント証明...
// -- (実際には、./demoCA/newcerts配下にバックアップされ...
// - 以下に、バックアップの一例を示すが何らかの方法でクラ...
// - ここでは、demoCA配下のcertsディレクトリにユーザ毎の...
// - 間違えて、連続してクライアントを作成してしまった場合...
// - シリアル番号をテキストベースで管理するのもひとつの手...
//
// [root@power certs]# mkdir ./demoCA/certs/muna
// [root@power certs]# mv new* ./demoCA/certs/muna/
// mv: cannot stat `new*': そのようなファイルやディレクト...
// [root@power certs]# mv *.p12 ./demoCA/certs/muna/
// mv: cannot stat `*.p12': そのようなファイルやディレク...
// [root@power certs]#
//
// - 参照したページでは クライアント証明書を作成しており...
// ** クライアント用証明書の失効処理 [#j14d2ffb]
// - クライアント証明書で運用するようなケースではセキュリ...
// - 以下に、失効処理を示すが、ここで作成されたcrl.pem(証...
// - まず、失効処理用のcrlnumberを作成し、失効したいクラ...
// - 失効処理を行うと、index.textは以下のように行頭がRに...
//
// R 051003025313Z 041003031948Z FB4C837477EB7B41
// unknown /C=JP/ST=Tokyo/L=Edogawa/O=Acorn/OU=user/CN=oy...
* 各証明書 (2005-1-14 時点) [#l2841c1a]
- サーバー用秘密鍵 (server.key) → &ref(server.key);
- サーバー用証明書 (server.crt) → &ref(server.crt);
- サーバー用公開鍵 (server.csr) → &ref(server.csr);
- サーバー用証明書 [Wiki virtual server] (wiki_server.crt...
- サーバー用公開鍵 [Wiki virtual server] (wiki_server.csr...
- サーバー用証明書 [mail server] (mail_server.crt) → &ref...
- サーバー用公開鍵 [mail server] (mail_server.csr) → &ref...
- メール用 証明書 (mail.pem) → &ref(mail.pem);
- クライアントに登録する CA 証明書 → &ref(ca.der);
終了行:
#contents
* SSL用証明書の作成(Linux編) [#o09cc8bd]
- ここで、作成した証明書は、ApacheやPostfix、Courier-IMAP...
- http://acorn.zive.net/~oyaji/www/certs_linux.htm を元...
** プライベート認証局(CA)の作成 [#tf742cda]
*** 事前準備 [#qfdb1a94]
- openssl-perl のインストール
[root@power root]# yum install openssl-perl
- /usr/share/ssl/openssl.cnf の設定
[ usr_cert ]
&ref(server.cr
# 最初にサーバ証明書を作成するため、「nsCertType」を「se...
# とするため、コメントアウトを外して有効にする。
# This is OK for an SSL server.
# nsCertType = server
nsCertType = server
[ v3_ca ]
# CA証明書作成時の証明書のタイプをSSL/E-mail用と指定する...
#「nsCertType」を「sslCA, emailCA」とするため、コメント...
# Some might want this also
# nsCertType = sslCA, emailCA
nsCertType = sslCA, emailCA
- 作業用ディレクトリを作成します
[root@power root]# mkdir /usr/local/certs
*** CA用秘密鍵 (cakey.pem) とCA用証明書 (cacert.pem) の作...
- ''COLOR(RED){プライベート認証局(CA) のパスフレーズを "...
[root@power root]# cd /usr/local/certs/
[root@power certs]# /usr/share/ssl/misc/CA.pl -newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
.......++++++
...++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase: ← "munakatafreedmanhisao"
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will...
into your certificate request.
What you are about to enter is what is called a Distingu...
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Kanagawa
Locality Name (eg, city) [Newbury]:Yokohama
Organization Name (eg, company) [My Company Ltd]:Private...
Organizational Unit Name (eg, section) []:Admin
Common Name (eg, your name or your server's hostname) []...
Email Address []:server_admin@hmuna.com
- この作業で以下のようなディレクトリ・ファイルが作成され...
/usr/local/certs [ ルートディレクトリ ]
|
└ demoCA [ 各種証明書等のルートディレ...
|
├ certs [ 証明書等のディレクトリ...
|
├ crl [ 破棄証明書一覧用のディレ...
|
├ newcerts [ クライアント証明書(...
| |
| ├ xxxxx..pem [ クライアント...
| | :
| └ xxxxx..pem [ クライアント...
|
├ private [ CA用の秘密鍵用ディレ...
| |
| └ cakey.pem [ CA用の秘密鍵 ]
|
├ cacert.pem [ CA用の証明書 ]
├ index.txt [ クライアント証...
└ serial [ クライアント証明書用...
*** CA証明書をブラウザにインポートするための ca.der ファ...
[root@power certs]# openssl x509 -inform pem -in ./demoC...
- ここで作成した ca.der をブラウザに登録する方法 → ht...
** サーバ用証明書の作成 [#t258c727]
- ApacheやPostfix、ProFTPD等で使用する サーバ証明書を作する
- ''COLOR(RED){[注意]: サーバ証明書を作成する場合、CA証...
*** サーバ用秘密鍵(server.key)の作成 [#scdea863]
- 鍵長1024ビットでサーバ用秘密鍵を作成
[root@power certs]# openssl genrsa -out server.key 1024
Generating RSA private key, 1024 bit long modulus
...++++++
...++++++
e is 65537 (0x10001)
*** サーバ用公開鍵 (server.csr) の作成 [#k30b3861]
- CAに送るデジタル証明書のリクエストファイルを作成
[root@power certs]# openssl req -new -key server.key -ou...
You are about to be asked to enter information that will...
into your certificate request.
What you are about to enter is what is called a Distingu...
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Kanagawa
Locality Name (eg, city) [Newbury]:Yokohama
Organization Name (eg, company) [My Company Ltd]:power.h...
Organizational Unit Name (eg, section) []:Admin
Common Name (eg, your name or your server's hostname) []...
Email Address []:server_admin@hmuna.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ← 何も入れずに Enter
An optional company name []: ← 何も入れずに Enter
[root@power certs]#
- ここのホスト名(上の例では www.hmuna.com )は、必ずhttps:...
- ''COLOR(RED){今回 SSL の Virtual server で2種類のエン...
- wiki 用の server.csr を別に作成する。
- wiki virtualhost 用の公開鍵(wiki_server.csr) の作成
[root@power certs]# openssl req -new -key server.key -ou...
You are about to be asked to enter information that will...
into your certificate request.
What you are about to enter is what is called a Distingu...
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Kanagawa
Locality Name (eg, city) [Newbury]:Yokohama
Organization Name (eg, company) [My Company Ltd]:wiki.hm...
Organizational Unit Name (eg, section) []:Admin
Common Name (eg, your name or your server's hostname) []...
Email Address []:server_admin@hmuna.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
*** サーバ用証明書 (server.crt) の作成 [#u9f06045]
- 認証局の証明書とキーを使って、X.509サーバ証明書の作成と...
- 認証局が使用するシリアルナンバーファイルがないので、dem...
[root@power certs]# echo 01 > ./demoCA/ca-cert.srl
[root@power certs]# cat ./demoCA/ca-cert.srl
01
[root@power certs]# openssl x509 -CA ./demoCA/cacert.pem...
-CAserial ./demoCA/ca-cert.srl -req -in server.csr -out ...
Signature ok
subject=/C=JP/ST=Kanagawa/L=Yokohama/O=hmuna.com/OU=Admi...
Getting CA Private Key
Enter pass phrase for ./demoCA/private/cakey.pem: ← CA用...
[root@power certs]#
- wiki.hmuna.com の中で www.hmuna.com の証明書を指定する...
[root@power certs]# openssl x509 -CA ./demoCA/cacert.pem...
-CAserial ./demoCA/ca-cert.srl -req -in wiki_server.csr ...
Signature ok
subject=/C=JP/ST=Kanagawa/L=Yokohama/O=hmuna.com/OU=Admi...
/emailAddress=munakata@hmuna.com
Getting CA Private Key
Enter pass phrase for ./demoCA/private/cakey.pem: ← muna...
[root@power certs]# openssl x509 -CA ./demoCA/cacert.pem
-CAkey ./demoCA/private/cakey.pem
-CAserial ./demoCA/ca-cert.srl -req -in webmail_server.c...
-out webmail_server.crt
Signature ok
subject=/C=JP/ST=Kanagawa/L=Yokohama/O=hmuna.com/OU=Admi...
/emailAddress=munakata@hmuna.com
Getting CA Private Key
Enter pass phrase for ./demoCA/private/cakey.pem: ← muna...
- www 用(server.crt)とwiki 用(wiki_server.crt)が別に作...
[root@power certs]# ls -l
合計 52
drwxr-xr-x 6 root root 4096 1月 15 21:27 demoCA
-rw-r--r-- 1 root root 1864 1月 15 21:33 mail.pem
-rw-r--r-- 1 root root 1864 1月 15 19:50 mail.pem_...
-rw-r--r-- 1 root root 973 1月 15 21:32 mail_serv...
-rw-r--r-- 1 root root 725 1月 15 20:23 mail_serv...
-rw------- 1 apache apache 23 1月 15 19:51 secret_wi...
-rw------- 1 apache apache 55 1月 15 19:51 secret_wi...
-rw------- 1 apache apache 54 1月 15 19:51 secret_ww...
-rw-r--r-- 1 root root 973 1月 15 21:31 server.crt
-rw-r--r-- 1 root root 725 1月 15 19:46 server.csr
-rw-r--r-- 1 root root 891 1月 15 19:44 server.key
-rw-r--r-- 1 root root 973 1月 15 21:31 wiki_serv...
-rw-r--r-- 1 root root 725 1月 15 19:47 wiki_serv...
** メール用証明書の作成 [#ld2ceebd]
- 以下の手順でメール用(Courier-IMAP)の証明書を作成
*** メール用証明書 (mail.pem) の作成 [#t9349da8]
- メール用証明書 (mail.pem) を、サーバ証明書と鍵から作成
- ここで問題発生、今回サーバーの DNS エントリーはプライマ...
が登録されており、www.hmuna.com と wiki.hmuna.com は別名(...
構成となっている。メールサーバーがSSL通信に引用する証明書...
mail.hmuna.com を期待しているので、ここで www.hmuna.com ...
証明書からメール証明書を作成すると、メール送受信時にエラ...
- この問題の対策のために mail_server.csr を作成してから m...
作成して、ここからメール用証明書を作成した。 (2005-1-14)
[root@power certs]# (cat mail_server.crt ; cat server.ke...
// ** クライアント用証明書等のバックアップ [#v4cc4d19]
// - CA.plを使用して、クライアント証明書を発行するとリク...
// - 中でも、リクエストファイルは後述するクライアント証明...
// -- (実際には、./demoCA/newcerts配下にバックアップされ...
// - 以下に、バックアップの一例を示すが何らかの方法でクラ...
// - ここでは、demoCA配下のcertsディレクトリにユーザ毎の...
// - 間違えて、連続してクライアントを作成してしまった場合...
// - シリアル番号をテキストベースで管理するのもひとつの手...
//
// [root@power certs]# mkdir ./demoCA/certs/muna
// [root@power certs]# mv new* ./demoCA/certs/muna/
// mv: cannot stat `new*': そのようなファイルやディレクト...
// [root@power certs]# mv *.p12 ./demoCA/certs/muna/
// mv: cannot stat `*.p12': そのようなファイルやディレク...
// [root@power certs]#
//
// - 参照したページでは クライアント証明書を作成しており...
// ** クライアント用証明書の失効処理 [#j14d2ffb]
// - クライアント証明書で運用するようなケースではセキュリ...
// - 以下に、失効処理を示すが、ここで作成されたcrl.pem(証...
// - まず、失効処理用のcrlnumberを作成し、失効したいクラ...
// - 失効処理を行うと、index.textは以下のように行頭がRに...
//
// R 051003025313Z 041003031948Z FB4C837477EB7B41
// unknown /C=JP/ST=Tokyo/L=Edogawa/O=Acorn/OU=user/CN=oy...
* 各証明書 (2005-1-14 時点) [#l2841c1a]
- サーバー用秘密鍵 (server.key) → &ref(server.key);
- サーバー用証明書 (server.crt) → &ref(server.crt);
- サーバー用公開鍵 (server.csr) → &ref(server.csr);
- サーバー用証明書 [Wiki virtual server] (wiki_server.crt...
- サーバー用公開鍵 [Wiki virtual server] (wiki_server.csr...
- サーバー用証明書 [mail server] (mail_server.crt) → &ref...
- サーバー用公開鍵 [mail server] (mail_server.csr) → &ref...
- メール用 証明書 (mail.pem) → &ref(mail.pem);
- クライアントに登録する CA 証明書 → &ref(ca.der);
ページ名: