使用 OpenSSL 簽證中心為 IIS 做伺服器簽證
要讓 IIS 做 CA 憑證不難,但是要為該憑證做簽證到是有點麻煩,你可以使用 MS 的憑證中心來做這件事情,但如果你的單位已經有 Linux Based 憑證中心,那麼也可以直接使用。
建立專有憑證中心的私有金鑰
你很有可能已經有簽證中心,也有了該簽證中心的簽證檔,如果真的是如此的話,就可以跳過此一步驟,否則請依下所示來建立一個憑證中心的私有金鑰。請注意,你也可以使用 更安全的的連線 Apache + SSL (new window) 中已經生產出金鑰。
做好憑證之後,理應只有 root 或有權限的人可以讀取這個憑證。
請使用剛剛生產的私有金鑰做一個簽證檔。
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
root # openssl genrsa -des3 -out ca.l-penguin.idv.tw.key 1024
Generating RSA private key, 1024 bit long modulus
............................................++++++
.............++++++
e is 65537 (0x10001)
Enter pass phrase for ca.l-penguin.idv.tw.key: your_password
Verifying - Enter pass phrase for ca.l-penguin.idv.tw.key: your_password
root # ls<
ca.l-penguin.idv.tw.key
root #
0001
0002
root # chmod 400 ca.l-penguin.idv.tw.key
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
root # openssl req -new -key ca.l-penguin.idv.tw.key -x509 -days 1095 -out ca.l-penguin.idv.tw.crt
Enter pass phrase for ca.l-penguin.idv.tw.key: your_passowrd
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) [GB]:TW
State or Province Name (full name) [Berkshire]:Taipei
Locality Name (eg, city) [Newbury]:Taipei
Organization Name (eg, company) [My Company Ltd]:l-penguin Corp.
Organizational Unit Name (eg, section) []:CA
Common Name (eg, your name or your server's hostname) []:ca.l-penguin.idv.tw
Email Address []:steven@l-penguin.idv.tw
0001
root # chmod 400 ca.l-penguin.idv.tw.crt
廣 告 |
接下來使用 ca.l-penguin.idv.tw 去做 web.l-penguin.idv.tw 的簽證。
0001 0002 0003 0004 0005 0006 |
root # openssl x509 -req -days 365 -in web.l-penguin.idv.tw.csr -CA ca.l-penguin.idv.tw.crt -CAkey ca.l-penguin.idv.tw.key -CAcreateserial -out web.l-penguin.idv.tw.crt Signature ok subject=/CN=web.l-penguin.idv.tw/OU=Web/O=l-penguin Corp./L=Taipei/ST=Taiwan/C=TW Getting CA Private Key Enter pass phrase for ca.l-penguin.idv.tw.key:your_password root # |
02/18/2007