预共享密钥
创新互联建站专注于高州网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供高州营销型网站建设,高州网站制作、高州网页设计、高州网站官网定制、微信小程序定制开发服务,打造高州网络公司原创品牌,更为您提供高州网站排名全网营销落地服务。
让我们以一个简单的认证工具开始:预共享密钥。为了使预共享密钥认证正常工作,每台主机上都定义了一个通用的密钥。这个密钥的定义将密钥与远程节点ISAKMP身份绑定在一起。从安全性方面而言,不好的做法是在每一对节点使用唯一的密钥。预共享密钥是通过使用全局配置命令
ISAKMP身份是远程路由器向本地节点发送ISAKMP信息的接口。如果路由器在多个接口上支持,那么主机名应该当作ISAKMP身份。使用全局命令
路由器也可以使用DNS来进行主机名解析,但是本地主机名定义速度更快而且不会因为DNS服务器的问题而中断。下面是一个两个路由器间的预共享key配置例子。本地路由器发送它的主机名,然后远程机器发送它的IP地址。首先就是本地节点路由器上的配置(IP地址和主机名密钥都已经定义了):
- !
- hostname outlan-rt01
- !
- !
- crypto isakmp policy 10
- encr 3des
- hash md5
- authentication pre-share
- group 2
- crypto isakmp key secretkey address 192.168.10.3
- crypto isakmp identity hostname
- !
- interface FastEthernet0/0
- ip address 172.30.80.17 255.255.255.252
- !
远程对等路由器的配置是这样的:
- !
- hostname inlan-rt01
- !
- ip host outlan-rt01 172.30.80.17
- !
- !
- crypto isakmp policy 10
- encr 3des
- hash md5
- authentication pre-share
- group 2
- crypto isakmp key secretkey address outlan-rt01
- !
- interface FastEthernet1/0
- ip address 192.168.10.3 255.255.255.252
- !
对于这个例子有两点需要注意。第一点要注意的是只有在本地路由器的配置中有一个ISAKMP身份定义。这是因为IP地址是默认发送的。第二点要注意的是,作为一个规则,你不应该混合使用ISAKMP的身份方法。或者全使用IP地址,或者全使用主机名,这样可以最小化配置错误。在以后的文章中,当我们探讨拓扑配置的内容时,我们将更进一步地研究如何使用主机名来进行ISAKMP身份验证。
RSA 现时标记现在我们接着学习配置RSA现时标记来进行认证。这个ISAKMP策略例子是使用手动地RAS密钥认证交换。
- crypto isakmp policy 15
- encr 3des
- hash md5
- authentication rsa-encr
- group 5
- lifetime 300
如果说我们想要在outlan-rt01和inlan-rt01间应用上面的远程认证密钥例子。我们需要对ISAKMP政策做的唯一改变是增加认证参数(在这个例子中,两个主机使用其IP地址作为ISAKMP身份):
- !
- hostname outlan-rt01
- !
- !
- crypto isakmp policy 10
- encr 3des
- hash md5
- authentication rsa-encr
- group 2
- !
- interface FastEthernet0/0
- ip address 172.30.80.17 255.255.255.252
- hostname inlan-rt01
- !
- !
- crypto isakmp policy 10
- encr 3des
- hash md5
- authentication rsa-encr
- group 2
- !
- interface FastEthernet1/0
- ip address 192.168.10.3 255.255.255.252
为了对outlan-rt01和inlan-rt01进行认证,必须做两件事情。首先,每个路由器都必须生成一对RSA密钥(公开的和私有的)。然后,它们必须共享它们的公钥。这个基本过程在两个路由器上是一样的,因此我们可以看看outlan-rt01的过程。为了生成一对RAS密钥,路由器必须定义一个的主机名和IP域名。
- router(config)# hostname outlan-rt01
- outlan-rt01(config)# ip domain-name outlan.net
一旦配置了主机名和IP域名,下一步就是生成RSA 密钥。IOS支持可输出和不可输出的密钥,而且这两种密钥类型都支持RSA现时标记认证。然而,生成可输出密钥是个比较好的做法。这样如果你的环境部署了认证授权,你就可以使用相同的密钥,这使转变更容易些。
密钥的生成是通过使用全局配置命令完成的:对于不可输出密钥是
- outlan-rt01(config)#crypto key generate rsa exportable label outlan-rt01
- The name for the keys will be: outlan-rt01
- Choose the size of the key modulus in the range of 360 to 2048 for your
- General Purpose Keys. Choosing a key modulus greater than 512 may take
- a few minutes.
- How many bits in the modulus [512]: 1024%
- % Generating 1024 bit RSA keys, keys will be exportable...[OK]
- outlan-rt01(config)#
公共密钥现在我们已经生成了RSA密钥,我们需要将我们的公钥放到inlan-rt01上。在开始这个步骤时,我们要看一下outlan-rt01的公钥。从EXEC中,我们使用命令
- outlan-rt01#show crypto key mypubkey rsa
- outlan-rt01#
如果存在一个或者多个密钥,那么输出就是这样的:
- outlan-rt01#show crypto key mypubkey rsa outlan-rt01
- % Key pair was generated at: 01:03:58 UTC Apr 25 2002
- Key name: outlan-rt01
- Storage Device: not specified
- Usage: General Purpose Key
- Key is exportable.
- Key Data:
- 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 009F100B
- 36665972 E97AD0B1 BC863579 66B67706 F9B009E9 39FF9C24 59D64250 5B45B2EF
- 6F6EBA57 2635235A CCC2DEF7 11653C33 956E92BD 45ED2B4E CDEFB15F 40CCAE7C
- F5E06445 17FEAF2B 75BD936C E75465A0 9F7EEB52 1D387EBB E78B553B 1E56957D
- 4E607481 E3CF0482 8C672F6D F772170D 6B599060 BB96D7B2 9DEA29E7 CD020301 0001
- outlan-rt01#
有时候,可能我们喜欢只有一个密钥,或者我们只想要一个密钥时却生成了两个。为了删除一个密钥,我们可以在全局配置模式中运行
- outlan-rt01#config t
- Enter configuration commands, one per line. End with CNTL/Z.
- outlan-rt01(config)#crypto key zeroize rsa outlan-rt01.outlan.net
- % Keys to be removed are named named 'outlan-rt01.outlan.net'.
- % All router certs issued using these keys will also be removed.
- Do you really want to remove these keys? [yes/no]: yes
- outlan-rt01(config)#
- The RSA keys are stored in the private-config file on the nvram file system:
- outlan-rt01#dir nvram:
- Directory of nvram:/
- 27 -rw- 751 startup-config
- 28 ---- 24 private-config
- 1 -rw- 0 ifIndex-table
- 2 ---- 27 persistent-data
- 29688 bytes total (26813 bytes free)
- outlan-rt01#
这样,我们知道如何创建和删除RAS密钥了,而且我们已经为outlan-rt01建立了一个密钥。我们还需要配置inlan-rt01来使用这个密钥。这是通过将outlan-rt01的RSA的公钥添加到inlan-rt01公共密钥链中实现的。
为了在outlan-rt01上查看这个公钥,我们这样运行:
- outlan-rt01#sh crypto key mypubkey rsa outlan-rt01
- % Key pair was generated at: 01:40:40 UTC Apr 25 2002
- Key name: outlan-rt01
- Storage Device: not specified
- Usage: General Purpose Key
- Key is exportable.
- Key Data:
- 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00E45800
- 259A0BB9 D0D1E847 2D9E5045 6EB03D8B 1F03F1F3 C2B93EE6 35888B31 DF2E3384
- 71C7C331 11D6308D E41511C5 ADC45E2B 340B458B 63DC16E7 AA9FE214 C35941F1
- E3A5B136 752D963C 94B7892B B8A5B1F5 D13042D9 6754DDDB 40DAEFD6 D50A0AF2
- 255499F6 448F7F59 E2823792 79696875 48649C7A 22838305 28622634 A3020301 0001
- outlan-rt01#
在我们添加密钥到inlan-rt01公共的公钥链之前,让我们先看看这个密钥是否已经在inlan-rt01上定义了。(经常检查是个很好的方式,即使你知道它并不在那):
- inlan-rt01#sh crypto key pubkey-chain rsa
- Codes: M - Manually configured, C - Extracted from certificate
- inlan-rt01#
密钥并不在,因此我们需要手动定义和导入一个。在做这个步骤时,我们必须备份outlan-rt01的密钥或者在路由器上打开一个EXEC会话以便我们可以备份密钥。然后我们在inlan-rt01上打开EXEC会话,进入配置样式然后进入公钥链配置模式:
- inlan-rt01#config t
- Enter configuration commands, one per line. End with CNTL/Z.
- inlan-rt01(config)#
- inlan-rt01(config)#crypto key pubkey-chain rsa
- inlan-rt01(config-pubkey-chain)#
- Once in keychain mode, we need to first associate an IP address with the key. The router will be using its IP address as its ISAKMP identity.
- inlan-rt02(config-pubkey-chain)#addressed-key 172.30.80.18
一旦输入
- 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00E45800
- 259A0BB9 D0D1E847 2D9E5045 6EB03D8B 1F03F1F3 C2B93EE6 35888B31 DF2E3384
- 71C7C331 11D6308D E41511C5 ADC45E2B 340B458B 63DC16E7 AA9FE214 C35941F1
- E3A5B136 752D963C 94B7892B B8A5B1F5 D13042D9 6754DDDB 40DAEFD6 D50A0AF2
- 255499F6 448F7F59 E2823792 79696875 48649C7A 22838305 28622634 A3020301 0001
- inlan-rt02(config-pubkey-key)#key-string
- Enter a public key as a hexadecimal number ....
- inlan-rt01(config-pubkey)#$0101 05000381 8D003081 89028181 00E45800
- inlan-rt01(config-pubkey)#$B03D8B 1F03F1F3 C2B93EE6 35888B31 DF2E3384
- inlan-rt01(config-pubkey)#$C45E2B 340B458B 63DC16E7 AA9FE214 C35941F1
- inlan-rt01(config-pubkey)#$A5B1F5 D13042D9 6754DDDB 40DAEFD6 D50A0AF2
- inlan-rt01(config-pubkey)#quit
- inlan-rt01(config-pubkey-key)#exit
- inlan-rt01(config-pubkey-chain)#exit
- inlan-rt01(config)#exit
- inlan-rt01#
为了确保密钥已经正确输入,我们可以对比一下密钥。在inlan-rt01上,运行
- inlan-rt01#sh crypto key pubkey-chain rsa address 172.30.80.17
- Key address: 172.30.80.17
- Usage: General Purpose Key
- Source: Manually entered
- Data:
- 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00E45800
- 259A0BB9 D0D1E847 2D9E5045 6EB03D8B 1F03F1F3 C2B93EE6 35888B31 DF2E3384
- 71C7C331 11D6308D E41511C5 ADC45E2B 340B458B 63DC16E7 AA9FE214 C35941F1
- E3A5B136 752D963C 94B7892B B8A5B1F5 D13042D9 6754DDDB 40DAEFD6 D50A0AF2
- 255499F6 448F7F59 E2823792 79696875 48649C7A 22838305 28622634 A3020301 0001
- inlan-rt01#
然后,在outlan-rt01上运行
- outlan-rt01#sh crypto key mypubkey rsa outlan-rt01
- % Key pair was generated at: 01:40:40 UTC Apr 25 2002
- Key name: outlan-rt01
- Storage Device: not specified
- Usage: General Purpose Key
- Key is exportable.
- Key Data:
- 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00E45800
- 259A0BB9 D0D1E847 2D9E5045 6EB03D8B 1F03F1F3 C2B93EE6 35888B31 DF2E3384
- 71C7C331 11D6308D E41511C5 ADC45E2B 340B458B 63DC16E7 AA9FE214 C35941F1
- E3A5B136 752D963C 94B7892B B8A5B1F5 D13042D9 6754DDDB 40DAEFD6 D50A0AF2
- 255499F6 448F7F59 E2823792 79696875 48649C7A 22838305 28622634 A3020301 0001
- outlan-rt01#
在outlan-rt01和inlan-rt01上的密钥互相匹配了。现在我们需要做的就是重复整个过程,这样inlan-rt01的公共RSA密钥就在outlan-rt01的RSA共公密钥链上了。我敢肯定到这个时候你就理解了涉及使用RSA现时标记的做法了。反复提醒自己“安全保证代价不匪——或者不容易”是没有坏处的。
网页名称:生成和交换预共享密钥
当前地址:http://www.csdahua.cn/qtweb/news9/282309.html
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网