9.7 使用PKI证书方法进行IKE协商认证典型配置
【需求】
分部1和分部2通过野蛮IPSec的方式连接到中心,使用PKI证书方法进行IKE协商认证。
【组网图】
【配置脚本】
中心配置脚本 |
# # ike local-name center
/中心ike的local-name为:center/ # pki domain
1
/创建PKI Domain 1/ ca identifier
test
/ca服务器的名称,可在win2003命令行中输入certutil查看名称,也可进入“证书服务”查看/ certificate request url http://61.1.1.1/certsrv/mscep/mscep.dll /动态注册地址/ certificate request from ra
/Windows2003仅支持RA模式/ certificate request entity
test /指定申请证书所用的实体名称/ certificate request mode auto key-length 1024
/指定证书申请为自动发起方式/ root-certificate
fingerprint sha1 0a95f5baf77bd24f0defd9688d56191ba31cfa90 /指定CA 中心服务器的“指纹”,以在自动申请证书时验证CA中心服务器的合法性,该指纹可在CA服务器上的证书看到,为“缩略图”对应的字符串,注意不要有空格/ crl url http://61.1.1.1/certenroll/test.crl
/指定CRL库的URL位置/ # pki entity
test /创建PKI
实体 test/ common-name
test
/配置实体的通用名/ organization-unit tsc
/配置实体所属组织部门名称/ organization
h3c
/配置实体所属组织名称/ locality bj
/配置实体所在城市名称/ country
CN
/配置实体所属的国家代码/ # radius scheme system # domain system # ike proposal 1 authentication-method rsa-signature
/指定认证方法为PKI数字签名方法/ # ike peer branch1
/配置到分部1的ike peer/ exchange-mode aggressive
/设置IPSec为野蛮方式/ id-type name
/选择名字作为ike协商过程中使用的ID/ remote-name
branch1
/分部1的名字为branch1/ certificate domain
1
/引用PKI domain 1/ # ike peer branch2
/配置到分部2的ike peer/ exchange-mode aggressive pre-shared-key abc id-type name remote-name branch2 certificate domain 1 # ipsec proposal 1
/定义ipsec proposal/ # ipsec policy center 10 isakmp
/配置到分部1的ipsec policy/ security acl 3001
/指定安全策略所引用的访问控制列表号/ ike-peer
branch1
/引用ike peer/ proposal 1
/引用ipsec proposal/ # ipsec policy center 20 isakmp
/到分部2的配置和分部1的配置类似/ security acl 3002 ike-peer branch2 proposal 1 # acl number 3001
/定义从中心到分部1的内网数据流/ rule 0 permit ip source 192.168.1.0 0.0.0.255
destination 192.168.2.0 0.0.0.255 acl number 3002
/定义从中心到分部2的内网数据流/ rule 0 permit ip source 192.168.1.0 0.0.0.255 destination
192.168.2.0 0.0.0.255 # interface Serial2/0 link-protocol ppp ip address 202.101.1.2 255.255.255.252 ipsec policy
center
/在公网出口上应用IPSec policy/ # interface NULL0 # interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 /中心的内网地址/ # ip route-static 0.0.0.0 0.0.0.0
202.101.1.1 preference 60 # user-interface con 0 user-interface vty 0 4 # return |
分部1配置脚本 |
# sysname Branch1 # ike local-name
branch1
/分部1的ike的local-name为:branch1/ # pki domain
1 /创建PKI
Domain 1/ ca identifier
test
/#ca服务器的名称,可在win2003命令行中输入certutil查看名称,也可进入“证书服务”查看/ certificate request url http://61.1.1.1/certsrv/mscep/mscep.dll /动态注册地址/ certificate request from ra
/Windows2003仅支持RA模式/ certificate request entity
test /指定申请证书所用的实体名称/ certificate request mode auto key-length
1024 /指定证书申请为自动发起方式/ root-certificate
fingerprint sha1 0a95f5baf77bd24f0defd9688d56191ba31cfa90 /指定CA 中心服务器的“指纹”,以在自动申请证书时验证CA中心服务器的合法性,该指纹可在CA服务器上的证书看到,为“缩略图”对应的字符串,注意不要有空格/ crl url http://61.1.1.1/certenroll/test.crl
/指定CRL库的URL位置/ # pki entity
test /创建PKI
实体 test/ common-name test
/配置实体的通用名/ organization-unit tsc
/配置实体所属组织部门名称/ organization
h3c
/配置实体所属组织名称/ locality bj
/配置实体所在城市名称/ country
CN
/配置实体所属的国家代码/ # radius scheme system # domain system # ike proposal 1 authentication-method rsa-signature
/指定认证方法为PKI数字签名方法/ # ike peer center
/配置到中心的ike peer/ exchange-mode aggressive
/设置IPSec为野蛮方式/ id-type
name
/选择名字作为ike协商过程中使用的ID/ remote-name
center
/对端的名字为center/ remote-address 202.101.1.2
/对端的地址为202.101.1.2(中心的公网地址)/ certificate domain
1
/引用PKI domain 1/ # ipsec proposal 1
/定义ipsec proposal/ # ipsec policy branch1 10 isakmp /配置到中心的ipsec policy/ security acl 3001
/指定安全策略所引用的访问控制列表号/ ike-peer
center
/引用ike peer/ proposal 1
/引用ipsec proposal/ # acl number 3001
/定义从分部1到中心的内网数据流/ rule 0 permit ip source 192.168.2.0 0.0.0.255
destination 192.168.1.0 0.0.0.255 # interface Serial2/0 link-protocol ppp ip address 202.101.2.2 255.255.255.252 ipsec policy
branch1
/在公网出口上应用IPSec policy/ # interface NULL0 # interface Ethernet0/0
/配置分部1的内网地址/ ip address 192.168.2.1 255.255.255.0 # ip route-static 0.0.0.0 0.0.0.0
202.101.2.1 preference 60 # user-interface con 0 user-interface vty 0 4 # return |
分部2配置脚本 |
分部2的配置和分部1类似 |
【验证】
当在分部1上执行“ping –a 192.168.2.1 192.168.1.1”时,就会触发分部1自动去CA获取证书,获取完证书后,试图与中心建立IKE和IPSEC,也会触发中心也去获取证书。当双方获取完证书互相验证后,就会顺利建立IPSEC隧道了。
【配置要点】
1、需要调整路由器的时间和CA Server上的时间一致,最好使用NTP来实现时钟的同步。
【提示】
一、如何配置Windows 2003做为CA
1、安装“证书服务”
单击“开始”--->“设置”“控制面板”--->“添加/删除程序” --->“添加/删除 Windows 组件” --->选中“证书服务”复选框
2、创建独立根CA
3、配置CA识别信息
4、指定证书数据库、证书数据库日志和共享文件夹的存储位置,使用默认路径即可
5、完成组件安装
6、安装SCEP插件
因为路由器使用了SCEP(Simple Certificate Enrollment Protocol)协议来和CA中心联系获取根证书。WIN2003的CA服务缺省没有对SCEP的支持,需要从微软的网站上下载cepsetup.exe,安装完后才能对http://61.1.1.1/certsrv/mscep/mscep.dll进行引用
7、开始安装SCEP
8、选择下一步
9、取消“Require SCEP Challenge Phrase to Enroll”后选择下一步
10、输入用于RA认证的相关信息
11、完成SCEP的安装
12、完成安装后,按照所给URL配置路由器SCEP注册地址
13、设置CA自动颁发证书
选择“证书颁发机构”--->“属性”--->“策略模块”--->“自动颁发证书”
【附录:手工获取证书方法】
可以使用手工方法来获取证书的方法来确认和CA中心之间是否能够正常获取证书。
1、用RSA算法生成本地的密钥对,可以制定密钥长度
[Center]rsa local-key-pair create
The key name will be: Center_Host
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Input the bits in the modulus[default = 512]: /默认密钥长度为512/
Generating keys...
.++++++++++++
.++++++++++++
.............................++++++++
.....++++++++
2、手工申请获得CA证书
[Center]pki retrieval-certificate ca domain 1
Retrieving CA/RA certificates. Please wait a while......
The trusted CA's finger print is:
MD5 fingerprint:E9A0 C58F 16BB 53A3 02AC
090E 5CCA 8EDF
SHA1 fingerprint:5767 E95E
05B7 2486 461D 0D58 542B 4FA1 8029 6858
Is the finger print correct?(Y/N):y
Saving CA/RA certificates chain, please wait a moment......
CA certificates retrieval success. /成功获得CA证书/
3、手工申请获得设备本地证书
[Center]pki
request-certificate domain 1
Certificate is being requested, please wait......
Enrolling the local certificate,please wait a while......
Certificate enroll Successfully! /成功获得设备本地证书/
Saving the local certificate to flash...... /保存在flash中/
Done!
4、手工察看获得的CA和设备本地证书
disp pki
certificate ca domain 1
disp pki certificate local domain 1