使用 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