新聞中心
預(yù)共享密鑰

創(chuàng)新互聯(lián)建站專(zhuān)注于高州網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供高州營(yíng)銷(xiāo)型網(wǎng)站建設(shè),高州網(wǎng)站制作、高州網(wǎng)頁(yè)設(shè)計(jì)、高州網(wǎng)站官網(wǎng)定制、微信小程序定制開(kāi)發(fā)服務(wù),打造高州網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供高州網(wǎng)站排名全網(wǎng)營(yíng)銷(xiāo)落地服務(wù)。
讓我們以一個(gè)簡(jiǎn)單的認(rèn)證工具開(kāi)始:預(yù)共享密鑰。為了使預(yù)共享密鑰認(rèn)證正常工作,每臺(tái)主機(jī)上都定義了一個(gè)通用的密鑰。這個(gè)密鑰的定義將密鑰與遠(yuǎn)程節(jié)點(diǎn)ISAKMP身份綁定在一起。從安全性方面而言,不好的做法是在每一對(duì)節(jié)點(diǎn)使用唯一的密鑰。預(yù)共享密鑰是通過(guò)使用全局配置命令
ISAKMP身份是遠(yuǎn)程路由器向本地節(jié)點(diǎn)發(fā)送ISAKMP信息的接口。如果路由器在多個(gè)接口上支持,那么主機(jī)名應(yīng)該當(dāng)作ISAKMP身份。使用全局命令
路由器也可以使用DNS來(lái)進(jìn)行主機(jī)名解析,但是本地主機(jī)名定義速度更快而且不會(huì)因?yàn)镈NS服務(wù)器的問(wèn)題而中斷。下面是一個(gè)兩個(gè)路由器間的預(yù)共享key配置例子。本地路由器發(fā)送它的主機(jī)名,然后遠(yuǎn)程機(jī)器發(fā)送它的IP地址。首先就是本地節(jié)點(diǎn)路由器上的配置(IP地址和主機(jī)名密鑰都已經(jīng)定義了):
- !
- 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
- !
遠(yuǎn)程對(duì)等路由器的配置是這樣的:
- !
- 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
- !
對(duì)于這個(gè)例子有兩點(diǎn)需要注意。第一點(diǎn)要注意的是只有在本地路由器的配置中有一個(gè)ISAKMP身份定義。這是因?yàn)镮P地址是默認(rèn)發(fā)送的。第二點(diǎn)要注意的是,作為一個(gè)規(guī)則,你不應(yīng)該混合使用ISAKMP的身份方法?;蛘呷褂肐P地址,或者全使用主機(jī)名,這樣可以最小化配置錯(cuò)誤。在以后的文章中,當(dāng)我們探討拓?fù)渑渲玫膬?nèi)容時(shí),我們將更進(jìn)一步地研究如何使用主機(jī)名來(lái)進(jìn)行ISAKMP身份驗(yàn)證。
RSA 現(xiàn)時(shí)標(biāo)記現(xiàn)在我們接著學(xué)習(xí)配置RSA現(xiàn)時(shí)標(biāo)記來(lái)進(jìn)行認(rèn)證。這個(gè)ISAKMP策略例子是使用手動(dòng)地RAS密鑰認(rèn)證交換。
- crypto isakmp policy 15
- encr 3des
- hash md5
- authentication rsa-encr
- group 5
- lifetime 300
如果說(shuō)我們想要在outlan-rt01和inlan-rt01間應(yīng)用上面的遠(yuǎn)程認(rèn)證密鑰例子。我們需要對(duì)ISAKMP政策做的唯一改變是增加認(rèn)證參數(shù)(在這個(gè)例子中,兩個(gè)主機(jī)使用其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
為了對(duì)outlan-rt01和inlan-rt01進(jìn)行認(rèn)證,必須做兩件事情。首先,每個(gè)路由器都必須生成一對(duì)RSA密鑰(公開(kāi)的和私有的)。然后,它們必須共享它們的公鑰。這個(gè)基本過(guò)程在兩個(gè)路由器上是一樣的,因此我們可以看看outlan-rt01的過(guò)程。為了生成一對(duì)RAS密鑰,路由器必須定義一個(gè)的主機(jī)名和IP域名。
- router(config)# hostname outlan-rt01
- outlan-rt01(config)# ip domain-name outlan.net
一旦配置了主機(jī)名和IP域名,下一步就是生成RSA 密鑰。IOS支持可輸出和不可輸出的密鑰,而且這兩種密鑰類(lèi)型都支持RSA現(xiàn)時(shí)標(biāo)記認(rèn)證。然而,生成可輸出密鑰是個(gè)比較好的做法。這樣如果你的環(huán)境部署了認(rèn)證授權(quán),你就可以使用相同的密鑰,這使轉(zhuǎn)變更容易些。
密鑰的生成是通過(guò)使用全局配置命令完成的:對(duì)于不可輸出密鑰是
- 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)#
公共密鑰現(xiàn)在我們已經(jīng)生成了RSA密鑰,我們需要將我們的公鑰放到inlan-rt01上。在開(kāi)始這個(gè)步驟時(shí),我們要看一下outlan-rt01的公鑰。從EXEC中,我們使用命令
- outlan-rt01#show crypto key mypubkey rsa
- outlan-rt01#
如果存在一個(gè)或者多個(gè)密鑰,那么輸出就是這樣的:
- 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#
有時(shí)候,可能我們喜歡只有一個(gè)密鑰,或者我們只想要一個(gè)密鑰時(shí)卻生成了兩個(gè)。為了刪除一個(gè)密鑰,我們可以在全局配置模式中運(yùn)行
- 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#
這樣,我們知道如何創(chuàng)建和刪除RAS密鑰了,而且我們已經(jīng)為outlan-rt01建立了一個(gè)密鑰。我們還需要配置inlan-rt01來(lái)使用這個(gè)密鑰。這是通過(guò)將outlan-rt01的RSA的公鑰添加到inlan-rt01公共密鑰鏈中實(shí)現(xiàn)的。
為了在outlan-rt01上查看這個(gè)公鑰,我們這樣運(yùn)行:
- 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公共的公鑰鏈之前,讓我們先看看這個(gè)密鑰是否已經(jīng)在inlan-rt01上定義了。(經(jīng)常檢查是個(gè)很好的方式,即使你知道它并不在那):
- inlan-rt01#sh crypto key pubkey-chain rsa
- Codes: M - Manually configured, C - Extracted from certificate
- inlan-rt01#
密鑰并不在,因此我們需要手動(dòng)定義和導(dǎo)入一個(gè)。在做這個(gè)步驟時(shí),我們必須備份outlan-rt01的密鑰或者在路由器上打開(kāi)一個(gè)EXEC會(huì)話(huà)以便我們可以備份密鑰。然后我們?cè)趇nlan-rt01上打開(kāi)EXEC會(huì)話(huà),進(jìn)入配置樣式然后進(jìn)入公鑰鏈配置模式:
- 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#
為了確保密鑰已經(jīng)正確輸入,我們可以對(duì)比一下密鑰。在inlan-rt01上,運(yùn)行
- 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上運(yùn)行
- 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上的密鑰互相匹配了?,F(xiàn)在我們需要做的就是重復(fù)整個(gè)過(guò)程,這樣inlan-rt01的公共RSA密鑰就在outlan-rt01的RSA共公密鑰鏈上了。我敢肯定到這個(gè)時(shí)候你就理解了涉及使用RSA現(xiàn)時(shí)標(biāo)記的做法了。反復(fù)提醒自己“安全保證代價(jià)不匪——或者不容易”是沒(méi)有壞處的。
當(dāng)前標(biāo)題:生成和交換預(yù)共享密鑰
本文鏈接:http://www.dlmjj.cn/article/dpcjhjh.html


咨詢(xún)
建站咨詢(xún)
