建立一个可信任的单位根签证 (Root CA)

小弟在 更安全的的连线 Apache + SSL (new window) 使用 OpenSSL 签证中心为 IIS 做伺服器签证 (new window) 的文章中,有说明了如何使用 OpenSSL 来为凭证做签证,你可以使用自己的 CA 做凭证。但是这种情况一遇到大量的的凭证签章,就会变得无从管理,且自行签证的凭证也有可能会有假冒的问题。

在这篇文章里,我会说明如何使用 OpenSSL 建立一个凭证中心的专用凭证,并且汇入到 Windows Client 中,之后若有需要使用到 SSL 签证的情况之下,只要由凭证中心做签证,其它的 Windows Client 就会自动信任而不需要次的新增凭证。

建立凭证之前

确认凭证中心的主机名称

凭证中心的主机名称非常重要,这有关系著 Client 在做查寻时的主机比对,若是不对不符那么就无法受到信认。

凭证主机的时间

由於凭证是有时效性的,所以在做凭证签核时,时间是非常重要的,你可以参考 让系统更准时 - 使用 NTP 效对时间 (new window) 这篇文章来做时间的调校。 你可使用下列方式得到目前主机时间,查看时间是否正确。

0001
0002
0003
root # date
Tue Feb 20 22:26:52 CST 2007
root #

DNS 对应

当然凭证中心的主机名称一旦确认,那么 DNS 就必需有合适的对应才行,否则会找不到主机。你可使用下列方式查看 DNS 是否正确。

0001
0002
0003
root # host ca.l-penguin.idv.tw
ca.l-penguin.idv.tw has address 192.168.1.82
root #

建立 Root CA

建立一个 Root CA,因为这个 Root CA 是所有凭证的基础,所以我们需要在建立一个有密码保护的私有金钥。

0001
0002
0003
0004
0005
0006
0007
0008
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 #

使用 Root CA 的私有金钥做出一个 X.509 的凭证。

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
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_password
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]:Taiwan
Locality Name (eg, city) [Newbury]:Taipei County
Organization Name (eg, company) [My Company Ltd]:l-penguin Corp.
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:ca.l-penguin.idv.tw
Email Address []:steven@l-penguin.idv.tw
root #

保护金钥

金钥是 SSL 加密中非常中要的一个资讯演算重点,你应该要保管好这个金钥并且不要让他外流,只有相关的使用者可以读取。

0001
0002
root # chmod 600 ca.l-penguin.idv.tw.key
root #

在 Windows 汇入 Root CA。

一旦产生出了根信认签证后,你可以使用 Windows 把这个凭证加入到 Windows 的“受信认的发行者”项目里,信任任何由 ca.l-penguin.idv.tw 所签核的凭证。

把 ca.l-penguin.idv.tw 汇入到“受信认的发行者”。

广 告

接受 ca.l-penguin.idv.tw.crt 的凭证。

若出现安全性警告的话,请按“是”。

签查是否已汇入凭证。

广 告

将 Root CA 汇入 Firefox

在 Firefox 设定选项中,点选“进阶 > 检视凭证清单”,再选择凭证所在。

将 Root CA 汇入 Thunderbird

在 Thunderbird 选项中,点选进阶,选择管理凭证。

汇入所信任的凭证档案。

02/21/2007


首页