そのため情報が古い可能性があります。ご了承ください。m(_ _)m
オレオレ証明書についての詳細は、以下。
オレオレ証明書をオレ専用に使用する(オレ以外には使わない)分には、問題ないと思われる。たぶん。用途はクライアント認証。
作成するに辺り以下のサイトを特に参照させて頂いた。
以下にオレオレ証明書を作成した時の手順記述する。(freebsd-7.2)
% mkdir ssl-self-signed
% cd ssl-self-signed
■ オレオレ証明書用CA(認証局)の作成 (※ 県名等々は適当)
% /usr/src/crypto/openssl/apps/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:
Verifying – Enter PEM pass phrase:
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
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) [au]:JP
State or Province Name (full name) [Some-State]:Kanagawa
Locality Name (eg, city) []:Kawasaki
Organization Name (eg, company) [Internet Widgits Pty Ltd]:foo bar Ltd
Organizational Unit Name (eg, section) []:System
Common Name (eg, YOUR name) []:qos.mine.nu-CA
Email Address []:root@qos.mine.nu
Please enter the following ‘extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
・・・
Write out database with 1 new entries
Data Base Updated
demoCAというディレクトリが出来ているはず。オレオレ証明書用CAの秘密鍵やら公開鍵やらもその中に作成される。
■ オレオレサーバ証明書の作成
% mkdir server-keys
% cd server-keys
● 秘密鍵を作成
% openssl genrsa -des3 -out secret.key 2048
Generating RSA private key, 2048 bit long modulus
…………………………………………………………+++
…………………………..+++
e is 65537 (0x10001)
Enter pass phrase for secret.key:
Verifying – Enter pass phrase for secret.key:
% openssl rsa -in secret.key -out secret-nopass.key
Enter pass phrase for secret.key:
writing RSA key
● CSR(Certificate Signing Request)作成
% openssl req -new -key secret.key -out csr.pem
Enter pass phrase for secret.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
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) [AU]:JP
State or Province Name (full name) [Some-State]:Kanagawa
Locality Name (eg, city) []:Kawasaki
Organization Name (eg, company) [Internet Widgits Pty Ltd]:foo bar Ltd
Organizational Unit Name (eg, section) []:System
Common Name (eg, YOUR name) []:qos.mine.nu
Email Address []:root@qos.mine.nu
Please enter the following ‘extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
● オレオレCAで署名する
% cd ..
% cp /usr/src/crypto/openssl/apps/openssl.cnf .
% vi openssl.cnf
・・・
nsCertType = server ・・・コメントを外す
・・・
% openssl ca -in ./server-keys/csr.pem -out ./server-keys/server.cert -config ./openssl.cnf
Using configuration from ./openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
・・・
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Cert Type:
SSL Server
Netscape Comment:
OpenSSL Generated Certificate
・・・
Sign the certificate? [y/n]:y
CERTIFICATE WILL NOT BE CERTIFIED
■ クライアント証明書の作成
% mkdir client-keys
● 秘密鍵を作成(クライアント証明書用)
% openssl genrsa -des3 -out secret.key 2048
Generating RSA private key, 2048 bit long modulus
……………+++
……………………….+++
e is 65537 (0x10001)
Enter pass phrase for secret.key:
Verifying – Enter pass phrase for secret.key:
● CSR(Certificate Signing Request)作成 (クライアント証明書用)
% openssl req -new -key secret.key -out csr.pem
Enter pass phrase for secret.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
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) [AU]:JP
State or Province Name (full name) [Some-State]:Kanagawa
Locality Name (eg, city) []:Kawasaki
Organization Name (eg, company) [Internet Widgits Pty Ltd]:foo bar Ltd
Organizational Unit Name (eg, section) []:user
Common Name (eg, YO
UR name) []:user
Email Address []:user@qos.mine.nu
Please enter the following ‘extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
● オレオレCAで署名する (クライアント証明書用)
% cd ..
% vi openssl.cnf
・・・
# nsCertType = server ・・・コメントにする
nsCertType = client, email ・・・コメントを外す
・・・
% openssl ca -in ./client-keys/csr.pem -out ./client-keys/client.cert -config ./openssl.cnf
Using configuration from ./openssl.cnf
Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
・・・
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Cert Type:
SSL Client, S/MIME
Netscape Comment:
OpenSSL Generated Certificate
・・・
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
● ブラウザにインポートしやすい形(秘密鍵と証明書のセット)にする
% cd client-keys
% openssl pkcs12 -export -in client.cert -inkey secret.key -out client.p12
出来たclient.p12をSCPとかで、クライアント端末に持ってきて、
ブラウザにインポートする。
サーバ証明書が見知らぬCAで署名されていると、「おまえ誰だよ?」的な感じで警告が出るので、オレオレ証明書用CAの証明書もブラウザにインポートする。demoCA/cacert.pem が、オレオレ証明書用CAの証明書なので、こいつもSCPとかでクライアント端末に持ってきて、インポート。
■ クライアント認証をするためのApache2の設定
- SSLEngine
- SSLCertificateFile ・・・オレオレサーバ証明書
- SSLCertificateKeyFile ・・・オレオレサーバ証明書の秘密鍵
- SSLCACertificateFile ・・・オレオレ証明書用CAの証明書
- SSLVerifyClient ・・・クライアント認証の設定。
辺りを設定する必要がある。
● 設定記述イメージ
Listen 443
NameVirtualHost *:443
SSLEngine on
SSLCertificateFile /home/user/ssl-self-signed/server-keys/server.cert
SSLCertificateKeyFile /home/user/ssl-self-signed/server-keys/secret-nopass.key
SSLCACertificateFile /home/user/ssl-self-signed/demoCA/cacert.pem
SSLVerifyClient require
・・・
(他の設定)
設定完了後、apacheを再起動して、クライアント証明書をインポートしたブラウザでhttpsアクセス。証明書を要求され、インポートした証明書を選択することで正常にアクセスできたら成功。
google chromeはSSLクライアント認証をサポートしてないようなので、IEかfirefoxかOpera辺りで。
Hiya – nice blog post, Are there cheaper SMS text message marketing services 4 shops&stores at California than 12stores.com? l know they only cost nine dollars / thirty days, unfortunately my fellow worker Ty told me there is, unfortunately he couldn’t remember its name. I absolutely start to get suspicion that he remembered wrongly.