Advanced Unix 25 Oct 2005 An Introduction to IPsec
Outline IPsec overview Alphabet soup being served… Security Associations (SA) & SPI’s Authentication Header (AH) protocol Encapsulating Security Payload (ESP) protocl Internet Key Exchange (IKE) IPsec pitfalls IPsec vs tunneling (PPTP, L2TP)
IPSec Overview IPSec is a suite of protocols for securing network connections –The details and variations are overwhelming One cause of the complexity is that IPSec provides a mechanism, not policy –A framework that allows implementation possible that both ends can agree on
Virtual Private Network (VPN) Secure communications between two hosts or networks VPN, is the buzzword that solves all you problems IPsec is one of the more popular VPN technology's
What can IPSEC Provide Authentication Integrity Access control Confidentiality Replay protection (Partial)
Types of VPNs Host To Host We’ll do this in class Host To Security or Secure Gateway Secure Gateway To Secure Gateway Secure Gateway = Firewall or VPN router Also referred to as Network To Network
Host To Secure Gateway Host A Secure Gateway IPsec (SA) IPC-NATROUTE Internal Network OR No IPsec
Host to Host Host A Host B IPsec (SA) Other Hosts No IPsec
Gateway to Gateway Secure Gateway IPsec (SA) IPC-NAT ROUTE Internal Network OR Secure Gateway Internal Network
Security Associations (SA) A group of security settings related to a specific VPN Stored in the SPD (Security Policy Database) Uniquely Identify IPsec sessions by: SPI (Security Parameter Index) a unique number that identifies the session The destination IP address A security protocol or encryption method Normally AH or ESP A shared secret
Types of IPSEC Connections Transport Mode Does not encrypt the entire packet Uses original IP Header Faster Tunnel Mode Encrypts entire packet including IP Header (ESP) Creates a new IP header Slower
Normal TCP/IP Packet Frame Header (Layer 2) IP Header (Layer 3) TCP/UDP Header (Layer 4) Application Layers (5-7) / Data IP HdrTCP/UDPData OR Frame Hdr
Authentication Header (AH) IP Protocol 51 Provides authentication of packets Does not encrypt the payload IP HdrAHTCP/UDPData Transport Mode IP HdrAHTCP/UDPData IP HdrAHDataNew IP HdrAHTCP/UDPOrg. IP Hdr Tunnel Mode
Encapsulating Security Payload (ESP) IP Protocol 50 Encrypts the Payload Provides Encryption and Authentication IP HdrAHTCP/UDPData Transport Mode IP HdrAHTCP/UDPData New IP HdrAHTCP/UDP Org. IP Hdr Tunnel Mode ESP
IKE (Internet Key Exchange) UDP port 500 Negotiates connection parameters ISAKMP (Internet Security Association and Key Management Protocol) Oakley (Diffie-Helmen key exchange)
IKE Negotiation Two phases 1 – Negotiate two way SA's Uses certificates or Pre-Shared Secrets Main Mode or Aggressive Mode 2 – Negotiate IPSEC (AH, ESP, Tunnel, Transport) Determines how the data is encrypted and the transport mode
IKE Negotiation Negotiates the following parameters: SA lifetime Encryption Algorithm (NEVER USE DES, USE 3DES) Authentication Algorithm (MD5, SHA, SHA-1) Type of Key Exchange
Packets Before ICMP 12:46: > : icmp: echo request (ttl 255, id 29731) 0000: ff01 c618 c0a8 000b E..Tt# : c0a d8 9d b6d 104f f..;m.O 0020: fa a0b 0c0d 0e0f : a1b 1c1d 1e1f !"# 0040: a2b 2c2d 2e2f $%&'()*+,-./ : FTP 12:47: > : P [tcp sum ok] 13:28(15) ack 98 win [tos 0x10] (ttl 64, id 44333) 0000: ad2d c0b c0a8 000b 0010: c0a a b4c2 5d0f 41e Pb..].A. 0020: a a bf..CP %. 0030: e f72..%.PASS passwor 0040: 640d 0a d..
Packets After ICMP 12:51: esp > spi 0x seq 1 len 116 (ttl 64, id 16933) 0000: b6b2 c0a8 000b 0010: c0a b5c1 1de : 9e cab1 f e7d9 267c 0cef.gDc....)p..&| : 6bfc a5d6 6f6a 9f51 0e95 20fe c930 0e77 k...oj.Q....0.w 0040: c92 d7ac 6c13 f9f1 de8b 1674 fd42 ).l...l......t.B 0050: be98 4a40 29e8 9ecb 6759 cfbe 993d 0060: 0f11 0b8b 5e dc28 786b d....^..R.(xk$yF] 0070: 5a67 d503 6b51 ff0b 074c d0`3 a1ec Zg..kQ...L.vm : 5b14 765f cb06 51f8 [.v_..Q. FTP 12:52: esp > spi 0x seq 2 len 100 (ttl 64, id 28675) 0000: e4 c0a8 000b 0010: c0a b51 ff0b kQ : 074c fa 28c7 ef53 592a 7b13 a068.L.v0.(..SY*{..h 0030: 06bf 071d 81a0 98de ddd b637 2b9a t : f1d2 a36e d83a 08ec 59bf 5341 a4b3 7ae5...n.:..Y.SA..z. 0050: bbc3 000b d2b1 e93c e086 cf69 71d6 dcf <...iq : d f43b b6fc 4abc da2c.....0$Q.;..J.., 0070: 77c5 91dd ab2e ba11 w
IPsec Pitfalls Complicated many different ways to configure Can be configured insecurely Client security is an issue Performance in IPv4 implementation
Advantages of IPSec Encrypts the entire packet, including IP Header (not just layer 4 and higher) Can Encrypt any protocol No Impact on users when using Secure Gateway to Secure Gateway Acts independent of IP address
IPsec Guidelines Always use: 3des or blowfish SHA1 over SHA and MD5 NEVER USE DES Tunnel Mode Main Mode AH and ESP together Certificates for production environments
OS Support for IPsec OpenBSD, FreeBSD, NetBSD Linux Solaris Windows 2000 (Native) Windows NT/95/98/Me (Add-on) Cisco IOS (PIX and Routers) Others as well....
Links Open Swan The official IPsec Howto for Linux Intro from Cisco An Illustrated Guide to IPsec