Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3417384
  • 博文数量: 1247
  • 博客积分: 11880
  • 博客等级: 上将
  • 技术积分: 13175
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-21 09:13
文章分类

全部博文(1247)

文章存档

2015年(1)

2014年(3)

2013年(3)

2012年(16)

2011年(38)

2010年(141)

2009年(96)

2008年(159)

2007年(158)

2006年(327)

2005年(286)

2004年(19)

分类: 系统运维

2006-10-30 22:31:42

(很多东西都可以从google上找来,不过还是留下一些常用的东西在这里,方便使用)

术语解释:

Advanced Encryption Standard (AES):高级加密标准,使用128,192,256位长的KEY来加密128,192,256位长的数据块,可以作出9种组合

Authentication Header (AH): 验证头部,一种安全协议,只是用来验证头部和防重发.不对实际用户数据部分加密.可配合ESP使用.

Authentication:IPsec框架种的一个功能,用来验证数据完整性,并确保数据在传输过程中没有被篡改,同时也可用来验证数据来源的合法性(验证数据来源).

Certification Authority (CA): 权威认证.第三方受信机构.提供CA证书或发布不信任认证.

Certificate:一个包含标志身份和公钥的加密签名对象

Certificate Revocation List (CRL): 不信任列表,由CA颁布的.

Crypto map: 加密映射,CISCO IOS的一个配置功能语句,提供3个主要功能:一,选择需要加密的数据流(通过调用ACL),二,定义策略(通过调用转换集),三,设置对等体

 Data integrity: 数据完整性机制,通过密钥或公钥确保数据传输过程中没有被篡改.

Data confidentiality: 数据机密性,通过加密或者只让伙伴知道KEY值的方法来保证数据不被其他人读取.

Data origin authentication: 数据源验证,一种安全服务,确保数据是来自正确的发送方,服务要求数据完整性+KEY分发机制(一个密钥只能是发送和接受方知道)

Data Encryption Standard (DES): 数据加密标注,使用密钥加密分组,CISCO-IPSEC使用56位长密钥加密分组

Diffie-Hellman:一种确保共享KEY安全穿越不安全网络的方法,它是OAKLEY的一个组成部分.

Encapsulating Security Payload (ESP): 封装安全有效负载,一种提供数据加密的协议,同时支持验证和防重发功能,它完整封装用户数据,可独自使用或与AH配合使用.

Hash: 哈西,散列算法,将变长分组转化成定长摘要.CISCO在IPSEC中使用SHA (Secure Hash Algorithm )和MD5(Message Digest 5)两种方法.

HMAC:使用SHA,MD5进行消息验证的一种机制.

Internet Key Exchange (IKE): internet key交换.,一种在Internet Security Association and Key Management Protocol (ISAKMP) 框架中使用Oakley和SKEME协议组的混合协议.IKE通常用来确定一个共享的安全策略和对需要KEY 的KEY服务的验证,在IPSEC流量能通过之前,先要对router/firewall/host 这些对等体进行身份验证.可以在双边手工输入预共享(pre-share)ke'y或者通过CA获得KEY,通过双边协商双边获得统一IKE的SA,建立 初步的安全通道,为接下来的IPSEC作准备.

Internet Security Association and Key Management Protocol (ISAKMP):一种协议框架,定义一种KEY交换和安全策略协商的

Message Digest 5 (MD5):MD5消息摘要,和SHA一样从MD4发展而来的,产生一个128位长的摘要,SHA比MD5更安全,但更耗资源.

Oakley: 一种KEY交换协议,它的一个基本机制就是Diffie-Hellman KEY交换算法

Perfect Forward Secrecy (PFS): PFS ensures that a given IPSec SA key was not derived from any other secret (like some other keys). In other words, if someone breaks a key, PFS ensures that the attacker is not able to derive any other key. If PFS is not enabled, someone can potentially break the IKE SA secret key, copy all the IPSec protected data, and then use knowledge of the IKE SA secret in order to compromise the IPSec SAs setup by this IKE SA. With PFS, breaking IKE does not give an attacker immediate access to IPSec. The attacker needs to break each IPSec SA individually. The Cisco IOS IPSec implementation uses PFS group 1 (D-H 768 bit) by default.

Replay-detection: A security service where the receiver can reject old or duplicate packets in order to defeat replay attacks (replay attacks rely on the attacker sending out older or duplicate packets to the receiver and the receiver thinking that the bogus traffic is legitimate). Replay-detection is done by using sequence numbers combined with authentication, and is a standard feature of IPSec.

RSA: A public key cryptographic algorithm (named after its inventors, Rivest, Shamir and Adleman) with a variable key length. RSA's main weakness is that it is significantly slow to compute compared to popular secret-key algorithms, such as DES. Cisco's IKE implementation uses a Diffie-Hellman exchange to get the secret keys. This exchange can be authenticated with RSA (or pre-shared keys). With the Diffie-Hellman exchange, the DES key never crosses the network (not even in encrypted form), which is not the case with the RSA encrypt and sign technique. RSA is not a public domain, and must be licensed from RSA Data Security.

Security Association (SA): An instance of security policy and keying material applied to a data flow. Both IKE and IPSec use SAs, although SAs are independent of one another. IPSec SAs are unidirectional and they are unique in each security protocol. A set of SAs are needed for a protected data pipe, one per direction per protocol. For example, if you have a pipe that supports ESP between peers, one ESP SA is required for each direction. SAs are uniquely identified by destination (IPSec endpoint) address, security protocol (AH or ESP), and security parameter index (SPI).

IKE negotiates and establishes SAs on behalf of IPSec. A user can also establish IPSec SAs manually.

An IKE SA is used by IKE only. Unlike the IPSec SA, it is bi-directional.

Secure Hash Algorithm (SHA): A one way hash put forth by NIST. SHA is closely modeled after MD4 and produces a 160-bit digest. Because SHA produces a 160-bit digest, it is more resistant to brute-force attacks than 128-bit hashes (such as MD5), but it is slower.

Transform: A transform describes a security protocol (AH or ESP) with its corresponding algorithms. For example, ESP with the DES cipher algorithm and HMAC-SHA for authentication.

Transport Mode: An encapsulation mode for AH/ESP. Transport Mode encapsulates the upper layer payload (such as Transmission Control Protocol (TCP) or User Datagram Protocol (UDP)) of the original IP datagram. This mode can only be used when the peers are the endpoints of the communication. The contrast of Transport Mode is Tunnel Mode.

Tunnel Mode: Encapsulation of the complete IP Datagram for IPSec. Tunnel Mode is used on order to protect datagrams sourced from or destined to non-IPSec systems (such as in a Virtual Private Network (VPN) scenario).

配置IPSEC-VPN

IKE的存在主要是为了IPSEC协商SA,它为IPSEC进行了铺路.两边对等体要就IKE的安全策略进行协商,我们可以定义多个IKE策略在每 一边,最终对等体协商一个双方都相同的策略.IKE第一阶段协商成功IKE SA(主交换模式),然后进行IPSEC SA的协商(快速交换模式),2阶段协商成功后,可以进行正常的IPSEC数据通信了.

IKE的策略配置主要包含:

1.加密算法 encryption  默认:DES

2.散列算法 hash  默认:SHA 如果路由器不够强大,建议使用 MD5

3.密钥交换 group  默认 1

4.验证方法 authentication 默认 rsa-sig 如果使用RSA-SG则要用CA建立KEY,如果使用pre-share则在路由器中配置key

5.IKE SA生命周期 lefttime 默认 86400秒 一天.

dt3-45a(config)#crypto isakmp policy 1
进入IKE 策略编辑模式,后面的数字序号可以区别各个策略,且数字越小被能被优先使用

dt3-45a(config-isakmp)#encryption des
默认的加密方式

dt3-45a(config-isakmp)#group 2
Diffie-Hellman 密钥交换方法,Group 1 is 768 bits long, and group 2 is 1024 bits long.路由器不够强大建议使用group 1,默认也是1

dt3-45a(config-isakmp)#hash md5
散列算法,默认SHA,路由器不够强大就使用MD5

dt3-45a(config-isakmp)#lifetime 500
IKE SA生命周期,默认86400秒,也就是一天,路由器不够强大则不建议太短.

dt3-45a(config-isakmp)#authentication pre-share
验证方法,默认RSA-SG,使用RSA-SG需要配合CA.使用pre-share就需要使用crypto isakmp key **** address peer-address来指定key

dt3-45a(config-isakmp)#exit
dt3-45a(config)#crypto isakmp key Slurpee-Machine address 192.168.10.38
这里的KEY要和对等体的配置一样.

You are now done with IKE configuration. These lines are the IKE configuration of the peer (the complete configurations for both routers are in the section of this document):

crypto isakmp policy 1 
hash md5
group 2
authentication pre-share
crypto isakmp key Slurpee-Machine address 192.168.10.66

接下来



  • dt3-45a(config)#access-list 101 permit ip 192.168.3.0 0.0.0.255 10.3.2.0 0.0.0.255


  • dt3-45a(config)#crypto ipsec transform-set MamaBear ah-md5-hmac esp-des


  • dt3-45a(config)#crypto map armadillo 10 ipsec-isakmp
    dt3-45a(config-crypto-map)#set peer 192.168.10.38
    dt3-45a(config-crypto-map)#set session-key lifetime seconds 4000
    dt3-45a(config-crypto-map)#set transform-set MamaBear 这里还可以继续写多个转换集名
    dt3-45a(config-crypto-map)#match address 101


  • dt3-45a(config)#interface e0
    dt3-45a(config-if)#crypto map armadillo


  • 一个配置范例:
    IPSECpart8.gif
    图上的IP标错了,将20.20.20.21 和20.20.20.20对调下!

    Here are some implementation tips for IPSec:

    • Before you configure crypto, make certain that you have connectivity between the endpoints of the communication.

    • Make sure that either DNS works on the router, or you have entered the CA hostname (if you use a CA).

    • IPSec uses IP protocols 50 and 51, and IKE traffic passes on protocol 17, port 500 (UDP 500). Make sure these are permitted appropriately.

    • Be careful not to use the word "any" in your ACL. This causes problems. For more information, see the "Usage Guidelines" for access-list in the PIX command reference.

    • Recommended transform combinations are:

      esp-des and esp-sha-hmac	ah-sha-hmac and esp-des
    • Remember that AH is just an authenticated header. The actual user datastream is not encrypted. For datastream encryption, you need ESP. If you use only AH and see cleartext going across the network, do not be surprised. You if you use AH, also use ESP. Note that ESP can perform authentication also. Therefore, you can use a transform combination such as esp-des and esp-sha-hmac.

    • ah-rfc1828 and esp-rfc1829 are obsolete transforms included for backwards compatibility with older IPSec implementations. If the peer does not support newer transforms, try these instead.

    • SHA is slower and more secure than MD5, whereas MD5 is faster and less secure that SHA. In some communities, the comfort level with MD5 is very low.

    • When in doubt, use tunnel mode. Tunnel mode is the default and it can be used in transport mode, as well as for its VPN capabilities.

    • For classic crypto users who upgrade to Cisco IOS Software Release 11.3, crypto commands storage methods in the configuration has changed to allow for IPSec. Consequently, if classic crypto users ever revert to Cisco IOS Software Release 11.2, these users will have to re-enter their crypto configurations.

    • If you do a ping test across the encrypted link when you finish your configuration, the negotiation process can take some time (about six seconds on a Cisco 4500, and about 20 seconds on a Cisco 2500) because SAs have not yet been negotiated. Even though everything is configured correctly, your ping can initially fail. The debug crypto ipsec and debug crypto isakmp commands show you what goes on. Once your encrypted datastreams have finished their set up, the ping works fine.

    • If you run into trouble with your negotiation(s) and make configuration changes, use the clear crypto is and clear crypto sa commands in order to flush the databases before you retry. This forces negotiation to start anew, without any legacy negotiation getting in the way. The clear crypto is and clear cry sa commands are very useful in this manner.

    阅读(1886) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~