embedded IPsec VPN Implementation für low-end embedded Systeme “Tag der Entwickler” – 7. Juli 2004 – M,O,C, München Christian Scheurer 1 „D&E - Tag der Entwickler“ - M,O,C München, 07. Juli 2004
2 Hintergrund, Motivation und Ziele Design und Implementation Testen Ergebnisse Übersicht
3 Hintergrund 2003: Sicherheit für vernetzte Systeme: Passwort 2004: Zahlreiche Angebote zum Thema Fernwartung über GSM 200x: Vernetzt über öffentliche Netze
4 Motivation Offene IPsec Implementation ausgelegt für low-end embedded Systeme Interoperabilität mit andern IPsec Systemen
5 Vorbereitung: Verständnis IPsec verstehen –Literatur Big Book of IPsec RFCs ( Peter Loshin, Morgan Kaufmann 2000) Netzsicherheit (Günter Schäfer, dpunkt Verlag 2003) Praktische Tests - Linux Kernel FreeS/WAN (jetzt OpenS/WAN, StrongS/WAN)
6 Vorbereitung: Arbeitsplatz Entwicklungsumgebung – PC mit Keil uVision IDE und Sniffer – VMware Workstation (oder PC) mit FreeS/WAN und Linux Kernel 2.6 IPsec –C167-Board –10Mbit Ethernet Hub
7 Design embedded IPsec Module
8 Implementation der Module Reihenfolge Implementation: 1.) Anbindung an TCP/IP Stack 2.) Konfigurationsdatenbanken 3.) Crypto Funktionen 4.) AH Protokoll 5.) ESP Protokoll 6.) AntiReplay,...
9 ipsecdev / ipsec Module „ipsecdev“
10 lwIP TCP/IP Stack TCP/IP Stack CS8900 Driver lwIP – a light weight TCP/IP Stack
11 IPsec Integration Traffic Interception IPsec Library IPsec Driver
12 IPsec Datenbank Module SPD und SAD
13 Security Policy Database Welche Pakete werden verarbeitet? –DISCARD –BYPASS –APPLY
14 Security Policy Database Beispiel einer SPD Konfiguration
15 Security Association Database Wie werden Pakete verarbeitet? –Tunnel oder Transport Mode –AH oder ESP –Algorithmen und Keys –Security Parameter Index
16 Security Association Database Beispiel einer SAD Konfiguration
17 Outbound Processing Datenfluss bei Outbound Processing SA
18 AH / ESP / Crypto - Module AH und ESP
19 Crypto - Library Crypto Funktionen von OpenSSL –DES, 3DES –HMAC-MD5-96, HMAC-SHA1-96 Für MCU optimierte Versionen –Dmitry Basko‘s DES –Graham Cole‘s MD5
20 Authentication Header
21 Encapsulating Security Payload
22 Speicherverwaltung
23 Testen Test-Konzept
24 Structural Tests TST sa_test_sad_lookup() : SUCCESS : TST sa_test_sad_get_spi(): SUCCESS : TST sa_test_spd_flush() : NOT IMPL. : TST sa_test_sad_flush() : NOT IMPL. : TST test_esp_decapsulate : SUCCESS : TST test_esp_encapsulate : SUCCESS : MSG main : structural testing finished: MSG main : o % correct (92 of 92 tests passed) MSG main : o 82.61% complete (19 of 23 functions implemented)
25 Functional Tests
26 Ergebnisse: Grösse Grösse Protokolle und DB total 18kB Crypto Library auf OpenSSL Basis total 90kB
27 Ergebnisse: Performance Performance 64 Bytes Ohne: 5 mS AH-MD5:19 mS ESP-3DES:60 mS 512 Bytes Ohne: 8 mS AH-MD5:38 mS ESP-3DES:351 mS 1280 Bytes Ohne: 13 mS AH-MD5:165 mS ESP-3DES:851 mS
28 Einsatzgebiete –Vernetzte Sensoren –Gebührenzähler
29 Interoperabilität Aus Linux Kernel (./net/ipv4/esp4.c):.. esph = (struct ip_esp_hdr*)skb->data; iph = skb->nh.iph; /* Get ivec. This can be wrong, check against another impls. */ if (esp->conf.ivlen) crypto_cipher_set_iv(esp->conf.tfm, esph->enc_data, crypto_tfm_alg_ivsize(esp->conf.tfm)); { u8 nexthdr[2];...
30 16-Bit Demo Demo
31 Versuchs-Aufbau 16-Bit (Infineon C167) 8-Bit (ATMEL AVR) Laptop (grau) Laptop (schwarz) Hub