레이블이 Network인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Network인 게시물을 표시합니다. 모든 게시물 표시

2011년 4월 20일 수요일

IPSec, IKE, ESP, Tunnel, Cryptography

what is ipsec?
ietf standard that employs cryptographic mechanism on network layer:

authentication of every ip packet
verification of data integrity for each packet
confidentiality of packet payload

ipsec acts at network layer, protecting and authenticating ip packet b/w ipsec devices (peer)

IPsec is the only standard layer 3 technology that provides:
confidentiality
data integrity
authentication
replay detection (by comparing sequence number of received packet and a sliding window on destination host)

IPsec include a protocol for exchanging keys, Internet Key Exchange (IKE) and two IPsec IP protocols, Encapsulating Security Payload (ESP) and Authentication Header (AH)

IPsec uses 3 main protocols to create a security framework:
IKE
provides framework for negotiation of security parameters
establishment of authenticated keys
ESP
encryption, authentication and integrity check
AH
provides authentication and integrity check on packets

IPsec header
original frame      L2 - IP - L4 payload
transport mode    L2 - IP - ESP/AH - L4 payload
tunnel mode        L2 - New IP - ESP/AH - IP - L4 payload

IPsec provides
authentication and data integrity (md5 or sha-1 hmac) with AH and ESP
confidentiality (des, 3des, or aes) only with ESP

Authentication - packet was definitely sent by apparent sender
Integrity - packet was not changed

IKE
solves problem of manual and unscalable implementation of ipsec by automating entire key exchange process:
negotiation of SA characteristics
automatic key generation
automatic key refresh
manageable manual configuration

IKE uses mathematical routine called Diffie-Hellamnd exchange to generate symmetrical keys to be used by two IPsec peers. manage negotiation of other security parameters,

SA - an agreement b/w two peers engaging in an ipec exchange and consiss of theese required parameters necessary to establish summessful communication:

Oakley:  a key exchange protocol that defines how to acquire authenticated keying material diffie-hellman key exchange algorithm - basic mechanism for oakley

ISAKMP: protocol framework that defines mechaniics of implementing a key exchange protocol and negotiation of security policy

Skme: a key exchange protocol that define how to derive authenticated keying material with rapid key refreshment

IKE automatically negotiate IPsec SA and enables IPsec secure communication w/o costly manual preconfiguration
IKE feature:
eliminates need to manually specify all of ipsec security paramenters at both peers
allow specificatoin for a lifetime for ipsec sa
allow encryption key to change during ipsec session
allow ipsec to provide anti-replay service
CA support
allow dynamic authentication of peers

IKE phases
phase 1
authenticate peer
negotiate a bidirectional SA
main mode or aggressive mode
phase 1.5
xauth
mode config
phase 2
ipsec sa (negotiated by IKE process (ISAKMP) on behalf of ipsec, which need key material for operation)
quick mode
*two peers already agreed upon transform set, hash method, and otehr parameters during phase 1 negotiation



main mode
1st exchange - establish basic security policy (select proposal)
2nd exchange - pass DH pub key and other data.
all further negotiation is encryped within IKE SA
3rd exchange - authenticate ISAKMP session

quick mode
negotiation is protected within IKE SA
similar to aggressive mode
negotiate SA for data encryption and manages key exchange for IPsec SA

IKE- other function
dead peer detection
nat traversal (encrypt ipsec packet in udp packet)
mode config (push config) and xauth (user authentication)













DH key agreement is a public key encryption method that provides a way for 2 peers to establish a shred secret key that only they know, although they are communicting over an insecure channel

public key - exchanged bw end users
private key - kept secret by original owner

DH public key algothrim states that if user A and user B exchange public keys and a calculation is performed on their individual private key and on the public key of the other peer, the end result of the process is an identical shared key.
shared key is used to encrypt and decrypt data

security is not an issue with DH key exchange. although someone may know a user's public key, shared secret cannot be generated because private key never becomes public knowledge






















group2 - DH group2 is used for secure exchange of shared key
crypto isakmp key  -  set shared key to .... when communicating with other router


* IKE p2 tunnel (ipsec tunnel) is negotiated and set up within the protection of an IKE p1 (ISAKMP tunnel).












*HASH
provide data integrity
one way mathematical function
in practice data of arbitrary length is input into hash function and then is processed through, resulting in fixed-length hash
the resultant fixed-length hash is called digest"



[출처] IPsec |작성자 kds20850

IPSec 개요 , 원리 , 관련 프로토콜

* IPSec
  IP망 계층자체에서 보안조치를 취하는 보안 메케니즘으로 Network Layer 사용

* IPSec 원리 

   - 전송모드
      . Transport Layer에서 Network Layer로 오는 정보만 보호
        IP 헤더를 보호하지 않음
      . 송수신
        1) Transport Layer에서 TCP Header 추가
        2) Network Layer로 넘어갈 때 IPSec 헤더 추가
        3) 네트워크 망으로 전송
        4) Network Layer에서 수신하고, IP 헤더 제거
           원본 IP 헤더가 앞에 존재하므로, 기존의 IP망을 이용해 단말의 네트워크 계층까지 전달 가능
        5) Transport Layer로 넘어가면서 IPSec 제거
           에이전트 프로그램이 있어야 IPSec 해석 가능
      . 모든 사용자 컴퓨터에 IPSec 메이전트 설치, Peer-To-Peer 경우에 유용
        But, 사용자가 늘어나면 관리가 힘듬
      
   - 터널모드
      . 전체 IP 패킷 보호
        헤더를 포함한 IP 패킷을 취해서, 전체 패킷에다 IPSec 보안을 적용한 다음 새로운 IP 헤더 추가
        새로운 IP 헤더는 라우터의 IP
     . 송수신
        1) 송신 단말에서는 IP 헤더-TCP 헤더-Data 패킷 전송
        2) 라우터의 Network Layer에서 IPSec 헤더 추가하고, 라우터의 IP를 IP 헤더로 추가
        3) Secure Tunnel 망으로 전송
        4) 수신 라우터의 Network Layer에서 IP 헤더 제거하고, IPSec 헤더 제거
        5) Original IP 패킷을 수신 단말에 전달
      . 단말의 에이전트 불필요하고, 패킷이 방화벽 전달 전에 IP단에서 불량 패킷 제거 가능
        2개의 헤더 추가되어 부하가 커지고, 단편화 현상으로 네트워크 지연 현상 발생
        -> 성능 좋은 라우터가 필요 

* IPSec 프로토콜
 - AH(Authentication Header)
    . 데이터 무결성과 IP 패킷의 인증을 지원
 - ESP(Encapsulating Security Payload)
   . 데이터 무결성, IP 패킷의 인증, 프라이버시 제공
     AH 프로토콜 사용한 후에 설계되어 AH 기능에 추가 기능 포함

* IPSec 컴포넌트 레이아웃
   
   - IPSec Engine
     사용자가 정의한 IPSec 정책을 DataBase에서 읽어 들여 Rule 기반으로 동작하며,
     X.509 인증서를 이용해 암호화/복호화 서비스
     이때, 키를 교환하는 프로토콜인 IKE 사용
   - Packet interceptor
     TCP/IP 스택에서 패킷 가로채서 IPSec Engine의 입력으로 사용
     (IP헤더, IPSec 헤더, TPC 헤더, 페이로드 포함된 패킷)
     IPSec Engine의 결과인 TCP 헤더와 페이로드만 포함된 패킷을 전송 계층으로 전달
   - IPSec 정책
     . SPD(Security Policy Database)
       패킷들에 대한 보안 정책 적용하며, 모든 트래픽 처리 시에 참조
       SAD를 이용하기 전에, 호스트 패킷에 대해 규정된 정책을 결정
       종류 : 폐기, 통과, IPSec 적용 등

       # Inbound processing 

      # Outbound processin


     . SAD(Security Association Database)
       양단간의 비밀 데이터 교환을 위해 미리 설정돼야 할 보안 요소들에 대한 데이터 관리
  

  - IKE(Internet Key Exchange)
    . inbound와 outbound 보안 연관을 생성하기 위해여 설계된 프로토콜로 IPSec을 위한 SA 생성
    . 구성요소
      ISAKMP(Internet Security Association and Key Management Protocol)
       : IKE 교환을 위한 메시지를 전달하는 프로토콜
      Oakley
      SKEME

* SA(Security association)
  - IPSec 두 호스트간에 요구되는 논리적인 연결-관계로 이때의 정보는 SAD에 저장되며,
    SPD의 데이터와 상호작용을 거쳐 엔진모듈의 사용하게 된다
  - SA간의 통신에는 IKE(Internet Key Exchange) 프로토콜로 인증키 교환 해결
  - 속성으로 알고리즘(인증, 기밀), SPI(AH and ESP시 SA와의 연관을 위한 구분자나 암호인자),
    키(인증을 위한 키, 설정을 위한 키), 만료시간 등
  - 전송모드와 터널모드
 


   - <그림14> 호스트에 IPSec 에이전트 설치돼 있고, 호스트와 라우터 간에도 공통적으로
      IPSec 프로토쿨 이용하기 때문에 안전한 통신 보장



IP Authentication Header ==>

http://tools.ietf.org/html/rfc4302



Cryptographic Algorithm Implementation Requirements for

Encapsulating Security Payload (ESP) and Authentication Header (AH) ==>

http://tools.ietf.org/html/rfc4305 




2011년 4월 19일 화요일

IKE (Internet Key Exchange) 개요

인터넷 표준 암호 키 교환 프로토콜. 상세한 사항은 RFC 2409에 규정되어 있으며 IPSEC를 암호화하는 데 사용된다. 일반적으로 데이터 암호화는 세션마다 임의의 암호 키를 생성, 실행한다. 동일한 암호 키를 오랫동안 사용하면 밝혀지기 쉬우므로, IKE는 송신 측에서 수신 측이 생성한 암호 키를 상대방에게 안전하게 송신하기 위한 방법이다. RSA법과 디피 헬먼(Diffie-Hellman)법 등의 암호 기술을 사용한다.

list of IP protocol numbers


This is a list of IP protocol numbers used in the protocol field of the IPv4 packet format and the Next Header field of IPv6 packets.
DecimalHexKeywordProtocolReferences
00x00HOPOPTIPv6 Hop-by-Hop OptionRFC 2460
10x01ICMPInternet Control Message ProtocolRFC 792
20x02IGMPInternet Group Management ProtocolRFC 1112
30x03GGPGateway-to-Gateway ProtocolRFC 823
40x04IPIP in IP (encapsulation)RFC 2003
50x05STInternet Stream ProtocolRFC 1190RFC 1819
60x06TCPTransmission Control ProtocolRFC 793
70x07CBTCore-based treesRFC 2189
80x08EGPExterior Gateway ProtocolRFC 888
90x09IGPInterior Gateway Protocol (any private interior gateway (used by Cisco for their IGRP))
100x0ABBN-RCC-MONBBN RCC Monitoring
110x0BNVP-IINetwork Voice ProtocolRFC 741
120x0CPUPXerox PUP
130x0DARGUSARGUS
140x0EEMCONEMCON
150x0FXNETCross Net DebuggerIEN 158
160x10CHAOSChaos
170x11UDPUser Datagram ProtocolRFC 768
180x12MUXMultiplexingIEN 90
190x13DCN-MEASDCN Measurement Subsystems
200x14HMPHost Monitoring ProtocolRFC 869
210x15PRMPacket Radio Measurement
220x16XNS-IDPXEROX NS IDP
230x17TRUNK-1Trunk-1
240x18TRUNK-2Trunk-2
250x19LEAF-1Leaf-1
260x1ALEAF-2Leaf-2
270x1BRDPReliable Datagram ProtocolRFC 908
280x1CIRTPInternet Reliable Transaction ProtocolRFC 938
290x1DISO-TP4ISO Transport Protocol Class 4RFC 905
300x1ENETBLTBulk Data Transfer ProtocolRFC 998
310x1FMFE-NSPMFE Network Services Protocol
320x20MERIT-INPMERIT Internodal Protocol
330x21DCCPDatagram Congestion Control ProtocolRFC 4340
340x223PCThird Party Connect Protocol
350x23IDPRInter-Domain Policy Routing ProtocolRFC 1479
360x24XTPXpress Transport Protocol
370x25DDPDatagram Delivery Protocol
380x26IDPR-CMTPIDPR Control Message Transport Protocol
390x27TP++TP++ Transport Protocol
400x28ILIL Transport Protocol
410x29IPv6IPv6 (encapsulation)RFC 2473RFC 3056
420x2ASDRPSource Demand Routing ProtocolRFC 1940
430x2BIPv6-RouteRouting Header for IPv6RFC 2460
440x2CIPv6-FragFragment Header for IPv6RFC 2460
450x2DIDRPInter-Domain Routing Protocol
460x2ERSVPResource Reservation ProtocolRFC 2205
470x2FGREGeneric Routing Encapsulation
480x30MHRPMobile Host Routing Protocol
490x31BNABNA
500x32ESPEncapsulating Security PayloadRFC 2406
510x33AHAuthentication HeaderRFC 2402
520x34I-NLSPIntegrated Net Layer Security ProtocolTUBA
530x35SWIPESwIPeIP with Encryption
540x36NARPNBMA Address Resolution ProtocolRFC 1735
550x37MOBILEIP Mobility (Min Encap)RFC 2004
560x38TLSPTransport Layer Security Protocol (using Kryptonet key management)
570x39SKIPSimple Key-Management for Internet ProtocolRFC 2356
580x3AIPv6-ICMPICMP for IPv6RFC 4443RFC 4884
590x3BIPv6-NoNxtNo Next Header for IPv6RFC 2460
600x3CIPv6-OptsDestination Options for IPv6RFC 2460
610x3DAny host internal protocol
620x3ECFTPCFTP
630x3FAny local network
640x40SAT-EXPAKSATNET and Backroom EXPAK
650x41KRYPTOLANKryptolan
660x42RVDMIT Remote Virtual Disk Protocol
670x43IPPCInternet Pluribus Packet Core
680x44Any distributed file system
690x45SAT-MONSATNET Monitoring
700x46VISAVISA Protocol
710x47IPCVInternet Packet Core Utility
720x48CPNXComputer Protocol Network Executive
730x49CPHBComputer Protocol Heart Beat
740x4AWSNWang Span Network
750x4BPVPPacket Video Protocol
760x4CBR-SAT-MONBackroom SATNET Monitoring
770x4DSUN-NDSUN ND PROTOCOL-Temporary
780x4EWB-MONWIDEBAND Monitoring
790x4FWB-EXPAKWIDEBAND EXPAK
800x50ISO-IPInternational Organization for Standardization Internet Protocol
810x51VMTPVersatile Message Transaction ProtocolRFC 1045
820x52SECURE-VMTPSecure Versatile Message Transaction ProtocolRFC 1045
830x53VINESVINES
840x54TTPTTP
840x54IPTMInternet Protocol Traffic Manager
850x55NSFNET-IGPNSFNET-IGP
860x56DGPDissimilar Gateway Protocol
870x57TCFTCF
880x58EIGRPEIGRP
890x59OSPFOpen Shortest Path FirstRFC 1583
900x5ASprite-RPCSprite RPC Protocol
910x5BLARPLocus Address Resolution Protocol
920x5CMTPMulticast Transport Protocol
930x5DAX.25AX.25
940x5EIPIPIP-within-IP Encapsulation Protocol
950x5FMICPMobile Internetworking Control Protocol
960x60SCC-SPSemaphore Communications Sec. Pro
970x61ETHERIPEthernet-within-IP EncapsulationRFC 3378
980x62ENCAPEncapsulation HeaderRFC 1241
990x63Any private encryption scheme
1000x64GMTPGMTP
1010x65IFMPIpsilon Flow Management Protocol
1020x66PNNIPNNI over IP
1030x67PIMProtocol Independent Multicast
1040x68ARISIBM's ARIS (Aggregate Route IP Switching) Protocol
1050x69SCPSSCPS (Space Communications Protocol Standards)
1060x6AQNXQNX
1070x6BA/NActive Networks
1080x6CIPCompIP Payload Compression ProtocolRFC 3173
1090x6DSNPSitara Networks Protocol
1100x6ECompaq-PeerCompaq Peer Protocol
1110x6FIPX-in-IPIPX in IP
1120x70VRRPVirtual Router Redundancy ProtocolCommon Address Redundancy Protocol (not IANA assigned)VRRP:RFC 3768
1130x71PGMPGM Reliable Transport ProtocolRFC 3208
1140x72Any 0-hop protocol
1150x73L2TPLayer Two Tunneling Protocol
1160x74DDXD-II Data Exchange (DDX)
1170x75IATPInteractive Agent Transfer Protocol
1180x76STPSchedule Transfer Protocol
1190x77SRPSpectraLink Radio Protocol
1200x78UTIUTI
1210x79SMPSimple Message Protocol
1220x7ASMSM
1230x7BPTPPerformance Transparency Protocol
1240x7CIS-IS over IPv4
1250x7DFIRE
1260x7ECRTPCombat Radio Transport Protocol
1270x7FCRUDPCombat Radio User Datagram
1280x80SSCOPMCE
1290x81IPLT
1300x82SPSSecure Packet Shield
1310x83PIPEPrivate IP Encapsulation within IPExpired I-D draft-petri-mobileip-pipe-00.txt
1320x84SCTPStream Control Transmission Protocol
1330x85FCFibre Channel
1340x86RSVP-E2E-IGNORERFC 3175
1350x87Mobility HeaderRFC 3775
1360x88UDP LiteRFC 3828
1370x89MPLS-in-IPRFC 4023
1380x8AmanetMANET ProtocolsRFC 5498
1390x8BHIPHost Identity ProtocolRFC 5201
1400x8CShim6Site Multihoming by IPv6 IntermediationRFC 5533
141-2520x8D-0xFCUNASSIGNED
253-2540xFD-0xFEUse for experimentation and testingRFC 3692
2550xFFReserved.