webサーバを利用したサーバ認証とクライアント認証
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
#contents
* 目的 [#bee53ac7]
apacheを利用して、サーバ認証とクライアント認証を実施する。~
サーバにルートCAから発行されたサーバ証明書を配置、クライ...
** 前提 [#n487eeb6]
[[OpenSSLによるPKI構築]]を利用してルート証明書、中間証明...
** サーバ証明書によるサーバの正当性確認 [#fdba14dd]
*** webサーバ証明書の作成(ルート認証局で発行) [#m2cb0cc2]
~/ca/websvに作成するものとする。
[ubuntu@pki ~ca]$ mkdir ~/ca/websv
[ubuntu@pki ~ca]$ cd ~/ca/websv
- 秘密鍵を保管しておくフォルダを作成しておく
[ubuntu@pki ~websv]$ mkdir private
- 署名要求を作成(同時に秘密鍵も生成)
秘密鍵の作成と同時にCSRを作成する方法だと、秘密鍵単独で作...
[ubuntu@pki ~websv]$ openssl req -config ../configs/open...
Generating a 2048 bit RSA private key
..+++
...........................................................
writing new private key to 'private/websvkey.pem'
Enter PEM pass phrase:
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) [JP]:JP
State or Province Name (full name) []:Tokyo
Organization Name (eg, company) []:Prosper2
Organizational Unit Name (eg, section) []:web server
Common Name (e.g. server FQDN or YOUR name) []:websv.pro...
[ubuntu@pki ~websv]$
- 秘密鍵のパスフレーズを除去
秘密鍵にパスフレーズが含まれている場合、webサーバ起動時に...
これを除去しておく
[ubuntu@pki ~websv]$ openssl rsa -in private/websvkey.pe...
Enter pass phrase for private/websvkey.pem:
writing RSA key
[ubuntu@pki ~websv]$
- 署名要求をルートCAへ送付
同一ホストの別ディレクトリで構築しているだけなので、単純...
遠隔ホストであれば、scpやテキストをコピペでもOK
[ubuntu@pki ~websv]$ cp websvcsr.pem ../RootCA
- ルートCAで署名要求にサイン
[ubuntu@pki ~websv]$ cd ../RootCA
[ubuntu@pki ~RootCA]$ openssl ca -config ../configs/open...
Using configuration from ../configs/openssl_sign.cnf
Enter pass phrase for private/RootCA_key.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 3 (0x3)
Validity
Not Before: Jul 12 23:49:27 2013 GMT
Not After : Aug 11 23:49:27 2013 GMT
Subject:
countryName = JP
stateOrProvinceName = Tokyo
organizationName = Prosper2
organizationalUnitName = web server
commonName = websv.prosper2.org
X509v3 extensions:
X509v3 Subject Key Identifier:
5E:25:4E:08:B5:8E:42:EA:6C:4E:64:8E:1A:1...
X509v3 Authority Key Identifier:
keyid:B1:0F:66:B2:40:FD:F4:3E:12:31:03:E...
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key ...
Certificate is to be certified until Aug 11 23:49:27 201...
Write out database with 1 new entries
Data Base Updated
[ubuntu@pki ~RootCA]$ cp websvcrt.pem ../websv
[ubuntu@pki ~RootCA]$ cd ../websv
- サーバ証明書のバイナリを作成
証明書に不要な情報(Certificate:~~)があるので、これを...
[ubuntu@pki ~websv]$ openssl x509 -in websvcrt.pem -out ...
[ubuntu@pki ~websv]$ openssl x509 -inform PEM -outform D...
[ubuntu@pki ~websv]$
*** webサーバ設定 [#o50f4e30]
apache2の設定を実施する。
- 設定ファイル
apache2のSSL用設定ファイルを修正する。
[ubuntu@pki ~websv]$ sudo vi /etc/apache2/sites-availabl...
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil....
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoi...
SSLCertificateFile /home/ubuntu/ssl/websv/websvcrt.pem
SSLCertificateKeyFile /home/ubuntu/ssl/websv/private/web...
- SSLの有効化
[ubuntu@pki ~websv]$ sudo a2enmod ssl
[ubuntu@pki ~websv]$ sudo a2ensite default-ssl
[ubuntu@pki ~websv]$ sudo /etc/init.d/apache2 restart
*** クライアント設定 [#e9f11f33]
前の手順で作成しておいたルート証明書をクライアント(ブラ...
*** 接続テスト [#x880cb09]
実際にブラウザから接続してみて、セキュリティ警告がでない...
ちなみに、上記のままのCSRだと、FQDNが正しくないと警告がで...
** クライアント証明書による接続クライアントの制限 [#g7c4a...
*** クライアント証明書の作成(中間認証局で発行) [#m2cb0c...
~/ca/clientに作成するものとする。
[ubuntu@pki ~ca]$ mkdir ~/ca/client
[ubuntu@pki ~ca]$ cd ~/ca/client
- 秘密鍵を保管しておくフォルダを作成しておく
[ubuntu@pki ~client]$ mkdir private
- 署名要求を作成(同時に秘密鍵も生成)
秘密鍵の作成と同時にCSRを作成する方法だと、秘密鍵単独で作...
[ubuntu@pki ~client]$ openssl req -config ../configs/ope...
Generating a 2048 bit RSA private key
................+++
..........................+++
writing new private key to 'private/clientkey.pem'
Enter PEM pass phrase:
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) [JP]:JP
State or Province Name (full name) []:Tokyo
Organization Name (eg, company) []:Prosper2
Organizational Unit Name (eg, section) []:Client Certifi...
Common Name (e.g. server FQDN or YOUR name) []:Client Ce...
ubuntu@SVRootCA01:~/ca/client$ ls
- 署名要求を中間CAへ送付
同一ホストの別ディレクトリで構築しているだけなので、単純...
遠隔ホストであれば、scpやテキストをコピペでもOK
[ubuntu@pki ~client]$ cp clientcsr.pem ../InterCA
- 中間CAで署名要求にサイン
[ubuntu@pki ~client]$ cd ../InterCA
[ubuntu@pki ~InterCA]$ openssl ca -config ../configs/ope...
Using configuration from ../configs/openssl_sign.cnf
Enter pass phrase for private/InterCA_key.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Jul 13 03:47:34 2013 GMT
Not After : Aug 12 03:47:34 2013 GMT
Subject:
countryName = JP
stateOrProvinceName = Tokyo
organizationName = Prosper2
organizationalUnitName = Client Certificate
commonName = Client Certificate
X509v3 extensions:
X509v3 Subject Key Identifier:
4C:E7:6B:0E:D0:8A:7D:48:15:FB:3D:9E:EA:9...
X509v3 Authority Key Identifier:
keyid:94:15:EC:04:A1:25:24:82:18:13:DF:0...
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key ...
X509v3 Extended Key Usage:
TLS Web Client Authentication
Certificate is to be certified until Aug 12 03:47:34 201...
Write out database with 1 new entries
Data Base Updated
[ubuntu@pki ~InterCA]$ cp clientcrt.pem ../client
[ubuntu@pki ~InterCA]$ cd ../client
- クライアント証明書のバイナリを作成
[ubuntu@pki ~client]$ openssl pkcs12 -export -inkey priv...
Enter pass phrase for private/clientkey.pem:
Enter Export Password:
Verifying - Enter Export Password:
[ubuntu@pki ~client]$
*** webサーバ設定 [#vfb7d5a2]
apache2の設定を実施する。
- 設定ファイル
apache2のSSL用設定ファイルを修正する。
[ubuntu@pki ~client]$ sudo vi /etc/apache2/sites-availab...
#SSLCACertificatePath /etc/ssl/certs/
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
SSLCACertificatePath /home/ubuntu/ssl/RootCA/
SSLCACertificateFile /home/ubuntu/ssl/RootCA/RootCA_crt....
#SSLVerifyClient require
#SSLVerifyDepth 10
SSLVerifyClient require
SSLVerifyDepth 2
- 設定の有効化
[ubuntu@pki ~client]$ sudo /etc/init.d/apache2 restart
*** クライアント設定 [#s6a2325e]
前の手順で作成しておいた中間証明書をクライアント(ブラウ...
前の手順で作成しておいたクライアント証明書をクライアント...
*** 接続テスト [#x880cb09]
実際にブラウザから接続してみて、セキュリティ警告がでない...
~
~
~
#counter
終了行:
#contents
* 目的 [#bee53ac7]
apacheを利用して、サーバ認証とクライアント認証を実施する。~
サーバにルートCAから発行されたサーバ証明書を配置、クライ...
** 前提 [#n487eeb6]
[[OpenSSLによるPKI構築]]を利用してルート証明書、中間証明...
** サーバ証明書によるサーバの正当性確認 [#fdba14dd]
*** webサーバ証明書の作成(ルート認証局で発行) [#m2cb0cc2]
~/ca/websvに作成するものとする。
[ubuntu@pki ~ca]$ mkdir ~/ca/websv
[ubuntu@pki ~ca]$ cd ~/ca/websv
- 秘密鍵を保管しておくフォルダを作成しておく
[ubuntu@pki ~websv]$ mkdir private
- 署名要求を作成(同時に秘密鍵も生成)
秘密鍵の作成と同時にCSRを作成する方法だと、秘密鍵単独で作...
[ubuntu@pki ~websv]$ openssl req -config ../configs/open...
Generating a 2048 bit RSA private key
..+++
...........................................................
writing new private key to 'private/websvkey.pem'
Enter PEM pass phrase:
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) [JP]:JP
State or Province Name (full name) []:Tokyo
Organization Name (eg, company) []:Prosper2
Organizational Unit Name (eg, section) []:web server
Common Name (e.g. server FQDN or YOUR name) []:websv.pro...
[ubuntu@pki ~websv]$
- 秘密鍵のパスフレーズを除去
秘密鍵にパスフレーズが含まれている場合、webサーバ起動時に...
これを除去しておく
[ubuntu@pki ~websv]$ openssl rsa -in private/websvkey.pe...
Enter pass phrase for private/websvkey.pem:
writing RSA key
[ubuntu@pki ~websv]$
- 署名要求をルートCAへ送付
同一ホストの別ディレクトリで構築しているだけなので、単純...
遠隔ホストであれば、scpやテキストをコピペでもOK
[ubuntu@pki ~websv]$ cp websvcsr.pem ../RootCA
- ルートCAで署名要求にサイン
[ubuntu@pki ~websv]$ cd ../RootCA
[ubuntu@pki ~RootCA]$ openssl ca -config ../configs/open...
Using configuration from ../configs/openssl_sign.cnf
Enter pass phrase for private/RootCA_key.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 3 (0x3)
Validity
Not Before: Jul 12 23:49:27 2013 GMT
Not After : Aug 11 23:49:27 2013 GMT
Subject:
countryName = JP
stateOrProvinceName = Tokyo
organizationName = Prosper2
organizationalUnitName = web server
commonName = websv.prosper2.org
X509v3 extensions:
X509v3 Subject Key Identifier:
5E:25:4E:08:B5:8E:42:EA:6C:4E:64:8E:1A:1...
X509v3 Authority Key Identifier:
keyid:B1:0F:66:B2:40:FD:F4:3E:12:31:03:E...
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key ...
Certificate is to be certified until Aug 11 23:49:27 201...
Write out database with 1 new entries
Data Base Updated
[ubuntu@pki ~RootCA]$ cp websvcrt.pem ../websv
[ubuntu@pki ~RootCA]$ cd ../websv
- サーバ証明書のバイナリを作成
証明書に不要な情報(Certificate:~~)があるので、これを...
[ubuntu@pki ~websv]$ openssl x509 -in websvcrt.pem -out ...
[ubuntu@pki ~websv]$ openssl x509 -inform PEM -outform D...
[ubuntu@pki ~websv]$
*** webサーバ設定 [#o50f4e30]
apache2の設定を実施する。
- 設定ファイル
apache2のSSL用設定ファイルを修正する。
[ubuntu@pki ~websv]$ sudo vi /etc/apache2/sites-availabl...
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil....
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoi...
SSLCertificateFile /home/ubuntu/ssl/websv/websvcrt.pem
SSLCertificateKeyFile /home/ubuntu/ssl/websv/private/web...
- SSLの有効化
[ubuntu@pki ~websv]$ sudo a2enmod ssl
[ubuntu@pki ~websv]$ sudo a2ensite default-ssl
[ubuntu@pki ~websv]$ sudo /etc/init.d/apache2 restart
*** クライアント設定 [#e9f11f33]
前の手順で作成しておいたルート証明書をクライアント(ブラ...
*** 接続テスト [#x880cb09]
実際にブラウザから接続してみて、セキュリティ警告がでない...
ちなみに、上記のままのCSRだと、FQDNが正しくないと警告がで...
** クライアント証明書による接続クライアントの制限 [#g7c4a...
*** クライアント証明書の作成(中間認証局で発行) [#m2cb0c...
~/ca/clientに作成するものとする。
[ubuntu@pki ~ca]$ mkdir ~/ca/client
[ubuntu@pki ~ca]$ cd ~/ca/client
- 秘密鍵を保管しておくフォルダを作成しておく
[ubuntu@pki ~client]$ mkdir private
- 署名要求を作成(同時に秘密鍵も生成)
秘密鍵の作成と同時にCSRを作成する方法だと、秘密鍵単独で作...
[ubuntu@pki ~client]$ openssl req -config ../configs/ope...
Generating a 2048 bit RSA private key
................+++
..........................+++
writing new private key to 'private/clientkey.pem'
Enter PEM pass phrase:
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) [JP]:JP
State or Province Name (full name) []:Tokyo
Organization Name (eg, company) []:Prosper2
Organizational Unit Name (eg, section) []:Client Certifi...
Common Name (e.g. server FQDN or YOUR name) []:Client Ce...
ubuntu@SVRootCA01:~/ca/client$ ls
- 署名要求を中間CAへ送付
同一ホストの別ディレクトリで構築しているだけなので、単純...
遠隔ホストであれば、scpやテキストをコピペでもOK
[ubuntu@pki ~client]$ cp clientcsr.pem ../InterCA
- 中間CAで署名要求にサイン
[ubuntu@pki ~client]$ cd ../InterCA
[ubuntu@pki ~InterCA]$ openssl ca -config ../configs/ope...
Using configuration from ../configs/openssl_sign.cnf
Enter pass phrase for private/InterCA_key.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Jul 13 03:47:34 2013 GMT
Not After : Aug 12 03:47:34 2013 GMT
Subject:
countryName = JP
stateOrProvinceName = Tokyo
organizationName = Prosper2
organizationalUnitName = Client Certificate
commonName = Client Certificate
X509v3 extensions:
X509v3 Subject Key Identifier:
4C:E7:6B:0E:D0:8A:7D:48:15:FB:3D:9E:EA:9...
X509v3 Authority Key Identifier:
keyid:94:15:EC:04:A1:25:24:82:18:13:DF:0...
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key ...
X509v3 Extended Key Usage:
TLS Web Client Authentication
Certificate is to be certified until Aug 12 03:47:34 201...
Write out database with 1 new entries
Data Base Updated
[ubuntu@pki ~InterCA]$ cp clientcrt.pem ../client
[ubuntu@pki ~InterCA]$ cd ../client
- クライアント証明書のバイナリを作成
[ubuntu@pki ~client]$ openssl pkcs12 -export -inkey priv...
Enter pass phrase for private/clientkey.pem:
Enter Export Password:
Verifying - Enter Export Password:
[ubuntu@pki ~client]$
*** webサーバ設定 [#vfb7d5a2]
apache2の設定を実施する。
- 設定ファイル
apache2のSSL用設定ファイルを修正する。
[ubuntu@pki ~client]$ sudo vi /etc/apache2/sites-availab...
#SSLCACertificatePath /etc/ssl/certs/
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
SSLCACertificatePath /home/ubuntu/ssl/RootCA/
SSLCACertificateFile /home/ubuntu/ssl/RootCA/RootCA_crt....
#SSLVerifyClient require
#SSLVerifyDepth 10
SSLVerifyClient require
SSLVerifyDepth 2
- 設定の有効化
[ubuntu@pki ~client]$ sudo /etc/init.d/apache2 restart
*** クライアント設定 [#s6a2325e]
前の手順で作成しておいた中間証明書をクライアント(ブラウ...
前の手順で作成しておいたクライアント証明書をクライアント...
*** 接続テスト [#x880cb09]
実際にブラウザから接続してみて、セキュリティ警告がでない...
~
~
~
#counter
ページ名: