Virtual Private Networks MPLS IPsec SSL/TLS

42 downloads 3638 Views 3MB Size Report
Extranet VPN : IPsec to MPLS to VLAN. Cisco VPN client software is tunnel source for access VPNs and branch- office; router originates site-to-site tunnel with ...
Virtual Private Networks MPLS IPsec SSL/TLS Ahmed Mehaoua Professeur Université de Paris 5 mea@[email protected]

Plan ¾ I. les VPN : dé définitions ¾ II. II. Les VPN MPLS ¾ III. III. Les VPN IPsec ¾ IV. IV. Les VPN SSL/TLS

© Ahmed Mehaoua - 2

1

Architectures VPN Communication layers Security protocols Application layer

ssh, S/MIME, PGP, SRTP

Transport layer

SSL, TLS, WTLS

Network layer

IPsec

Data Link layer

PPTP, L2TP

Physical layer

Scrambling, Hopping, Quantum Communications

MPLS

© Ahmed Mehaoua - 3

¾ VIII. Application de IPsec : les VPN

© Ahmed Mehaoua - 4

2

Extranet VPN : IPsec to MPLS to VLAN Branch Office

Local or DirectDial ISP

Access/ Peering PoPs

MPLS Core

Leased Line/ Frame Relay/ATM/ DSL Dedicated IOS Access

MPLS PE MPLS

Internet

MPLS VPNs

Cable/DSL/ ISDN ISP

VLANs Bi-directional IPsec Session

Remote Users/ Telecommuters Cisco VPN client software is tunnel source for access VPNs and branchoffice; router originates site-to-site tunnel with VPN concentrator

Cisco router terminates IPsec tunnels and maps sessions into MPLS VPNs

IPsec or TLS VPN Session

MPLS VPNs

IP

Corporate Intranet

VLANs

IP

© Ahmed Mehaoua - 5

Typologie des technologies VPN VPN de niveau 2 ‰ VPNVPN-IP avec MPLS ‰ VPNVPN-IP avec IPSEC ‰ VPNVPN-SSL ‰

© Ahmed Mehaoua - 6

3

MPLS : multiprotocole ? Multi-Protocole Label Switching

Optique

© Ahmed Mehaoua - 7

VPN MPLS ‹ Avantages: Une bonne partie des avantages de MPLS reposent sur son support du routage explicite : 1. Ingénierie de trafic (répartition du trafic/charge entre plusieurs chemins) 2. Qualité de service (pré-dimensionnement des chemins) 3. Intégration de différentes infrastructures de commutation de bout en bout via les labels MPLS 4. Indépendant des protocoles de routage IP (inter et intra AS) (transparence pour les clients) 5. Externernalisation du réseau privé virtuel (VPN) : recentrage des entreprises sur leur cœur de marché et de compétence; et bénéficier des nouvelles technologies réseaux; ‹ Applications : Les VPN IP sont considérés comme l'application de choix pour MPLS. Grâce à ce dernier, les opérateurs peuvent garantir une qualité de service de bout en bout sur leurs réseaux IP. Le trafic émanant d'un RPV pourra être étiqueté et injecté dans les réseaux des opérateurs et des fournisseurs d'accès à Internet (FAI), et se voir attribuer une qualité de service indépendante des autres flux transitant sur ces réseaux. © Ahmed Mehaoua - 8

4

Evolution du Routage IP - Vers la Commutation IP Paquet d’appel Paquets suivants

Transport IP

IP

IP

Sonet

ATM

FR

IP

ATM

Transport IP Frame Relay Frame Relay © Ahmed Mehaoua - 9

Fonctions d’un Routeur IP

Route Table

Chaque Paquets IP entrant

Cache

Forwarding Tasks

Routage

Access Control List

Security Task

FireWall

Queuing Priority

Accounting Data

Queuing Task

Accounting Task

Gestion Paquets

Administration

Paquets IP sortant

© Ahmed Mehaoua - 10

5

Evolution du Routage IP - Vers la Commutation IP Route Table

Premier Paquet IP

Paquets IP suivants

Forwarding Task Cache Switching Table

Access List

Queuing Priority

Accounting Data

Security Task

Queuing Task

Accounting Task

Flow Specifications

Data Export

Statistics

Switching Task

© Ahmed Mehaoua - 11

Routage IP intra-AS Protocole RIP

© Ahmed Mehaoua - 12

6

LABEL SWITCHING In Address Label Prefix

Out Out I’face Label

In Address Label Prefix

Out Out I’face Label

X

128.89

1

4

4

128.89

0

X

171.69

1

5

5

171.69

1

9 7

...

...

...

...

...

...

...

...

171.69

1 1 128.89.25.4

Data

4

0 128.89.25.4

128.89

Data

9

128.89.25.4

128.89.25.4

Data

Data

© Ahmed Mehaoua - 13

LABEL SWITCHING

© Ahmed Mehaoua - 14

7

MPLS : Opérations 1a. Protocole de routage existant (e.g. OSPF, IGRP) détermine la meilleure route dans le domaine MPLS 4. Les routeurs de sortie (LER) suppriment les labels et remettent les paquets au destinataire

1b. Le Label Distribution Protocol (LDP) Initialise les labels dans les routeurs du chemin

2. Le routeur d’entrée (LER) reçoit les paquets IP et exécute les fonctions de niveau 3 puis insère les labels

3. Les routeurs/commutateurs internes (LSR) transferent les paquets labelisés en utilisant la commutation de label

© Ahmed Mehaoua - 15

MPLS : Terminologie

z LDP: Label Distribution Protocol z LSP: Label Switched Path z FEC: Forwarding Equivalence Class z LSR: Label Switching Router z LER: Label Edge Router z MPLS-shim : en-tête MPLS

© Ahmed Mehaoua - 16

8

Codification des Labels FEC : Forward Equivalent Class

Label de taille fixe 4 octets (32 bits) : 1. 2. 3. 4.

Label (20 bits) : valeur du label CoS (3 bits): classe de service du paquet (exp: champs ToS dans IP) S (Stack Indicator) : indique le bas de la pile. Il est mit à un 1 pour le dernier label dans la pile et a 0 pour tous les autres labels. TTL (8 bits): durée de vie du paquet (pour éviter les boucles). © Ahmed Mehaoua - 17

LABEL SWITCHING ATM Cell Header

GFC

VPI

VCI

PTI CLP HEC

DATA

Label Ver

IPv6 Flow Label Field

T.Class

Flow Label

•••

Label

PPP Header : Optic

PPP Header

+

Label

+

Layer 3 Header

LAN MAC Tag header : Ethernet Layer 2 Header +

Label

+

Layer 3 Header

© Ahmed Mehaoua - 18

9

Typologie des technologies VPN VPN de niveau 2 ‰ VPNVPN-IP avec MPLS ‰ VPNVPN-IP avec IPSEC ‰ VPNVPN-SSL ‰

© Ahmed Mehaoua - 19

¾ VIII. Application de IPsec : les VPN Access

Access

IPsec to Core VPN IPsec tunnel

IPsec tunnel

MPLS CPE

MPLS PE

MPLS PE CPE

mapping

IPsec

IP

IPsec over Core VPN

mapping

MPLS VPN

IPsec

IP

IPsec tunnel

MPLS CPE

IP

MPLS PE

IPsec

MPLS PE CPE

MPLS VPN

IPsec

IP © Ahmed Mehaoua - 20

10

Easy VPN Remote/Server HUB site with static known IP address, client have dynamic addresses addresses

Single User

IOS Router With Unity Client

Cisco Unity VPN Clients Gateway options: •Cisco VPN 30xx •Cisco IOS 12.2(8)T •PIX 6.0

PIX501 uBR900

Home Office

IOS Router With Unity Client

Ca ble

DSL

Internet

HQ

800

Small Office

IOS Router With Unity Client

T1

=IPsec tunnel

Advantages: Home Office VPN3002

1700

IOS Router

• Unity is the common language within Cisco VPN environment • Policy push applies to CPE routers as well. © Ahmed Mehaoua - 21

Les offres commerciales de VPN pour l'entreprise Les grands acteurs en France et en Europe aujourd'hui: Level 3 France Telecom (Oleane (Oleane VPN) ‰ Easynet ‰ Qwest ‰ Global Crossing ‰ ‰

© Ahmed Mehaoua - 22

11

VPN IP- Offre en France Il existent 10 offrent de réseaux privés virtuel IP en France (01réseaux/Sept. 2002) ™ ™ ™ ™ ™ ™ ™ ™ ™

Cable & Wireless Cegetel/Infonet Colt FT/Global One KPNQwest Maiaah QoS Networks LDcom/Siris Worldcom

(IPsec, aucune classe, 50 PoP nat, 49 PoP int.) (MPLS, 3 classes: Std, Data, Tps réel, 160, 55 pays) (IPsec, 4, 13, via offre IP Corporate) (MPLS, 3, 60, 140) (IPSec, 5 classes, 30, 300) (MPLS, 5, 7, via réseaux tiers) (IPSec, 5 classes, 1, 9) (MPLS, 4 classes, 77, 0) (MPLS)

© Ahmed Mehaoua - 23

Critère des choix d'un fournisseur de VPN La bande passante proposé proposée ‰ La qualité qualité de service né négocié gociée (SLA) è ‰ Gamme d'options d'accè d'acc s en boucles locales ‰ Assistance ‰

© Ahmed Mehaoua - 24

12

Sécurisation des communications IP • Pour sécuriser les échanges ayant lieu sur un réseau TCP/IP, il existe plusieurs approches : - niveau applicatif (PGP) - niveau transport (protocoles TLS/SSL, SSH) - niveau physique (boîtiers chiffrant). • IPsec vise à sécuriser les échanges au niveau de la couche réseau. réseau. • IPsec veut dire IP Security Protocols : ensemble de mécanismes de sécurité commun à IPv4 et IPv6.

© Ahmed Mehaoua - 25

IPSec : le standard • • • •

Norme prévue pour IPv6 Adaptée à IPv4, vu la lenteur de déploiement IPv6 et les besoins forts des entreprises Série de RFC : 2401, 2402, 2406, 2408 Très nombreuses pages !!

© Ahmed Mehaoua - 26

13

Les services IPsec • Services de sé sécurité curités offerts par IPsec : - Authentification des extré extrémité mités - Confidentialité Confidentialité des donné données échangé changées - Authenticité Authenticité des donné données - Inté Intégrité grité des donné données échangé changées - Protection contre les écoutes et analyses de trafic - Protection contre le rejeu • 2 modes d’ d’exploitation d’IPsec : - Transport : Protè Protège juste les donné données transporté transportées (LAN) - Tunnel : Protè Protège en plus l'enl'en-tête IP (VPN) •

IPsec permet : • La mise en place de VPN • Sécuriser les accè accès distants (Utilisation nomade) • Protection d’ d’un serveur sensible © Ahmed Mehaoua - 27

Composants d’IPsec • Protocoles de sécurité : – Authentication Header (AH) – Encapsulation Security Payload (ESP)

• Protocole d'échange de clefs : – Internet Key Exchange (IKE)

• Bases de données internes : – Security Policy Database (SPD) – Security Association Database (SAD)

© Ahmed Mehaoua - 28

14

I. Normalisation d'IPsec par l’IETF

RFC 2401

RFC 2402

RFC 2406

Security Architecture for the Internet Protocol

IP Authentication Header

S. Kent, R. Atkinson

Novembre 1998

STANDARD

IP Encapsulating Security Payload (ESP)

© Ahmed Mehaoua - 29

Quel protocole pour quel service de sécurité ?

© Ahmed Mehaoua - 30

15

II. Modes d’IPsec • mode transport - insertion transparente entre TCP et IP - pas de masquage d’ d’adresse - facilité é de mise en œuvre facilit Ö sécurise de bout en bout les échanges entre deux utilisateurs.

• mode tunnel - insertion aprè après IP - encapsulation des datagrammes IP dans d'autres datagrammes IP - masquage d’ d’adresse Ö sécurise lien par lien les segments de ré réseau. Ö utilisé utilisé quand au moins une des deux extré extrémité mités d’ d’IPsec se comporte comme une passerelle

© Ahmed Mehaoua - 31

IPsec : Mode Transport

© Ahmed Mehaoua - 32

16

Transport Mode Encapsulation

© Ahmed Mehaoua - 33

IPsec : Mode Tunnel

© Ahmed Mehaoua - 34

17

Tunnel Mode Encapsulation

© Ahmed Mehaoua - 35

III. III. Protocole de sé sécurité curité AH ¾ AH = Authentication Header : 1er protocole et aussi le plus simple ¾ définit dans le RFC 2402 ¾ Garantit : - l'authentification. - l’unicité unicité (anti(anti-rejeu) rejeu) - l'inté l'intégrité grité ! Pas de confidentialité confidentialité ! => les donné données sont seulement signé signées mais pas chiffré chiffrées support des algorithmes MD5 (128 bits) et SHASHA-1

© Ahmed Mehaoua - 36

18

IPSec protocols – AH protocol • AH - Authentication Header – – – – – –

Defined in RFC 1826 Integrity: Yes, Yes, including IP header Authentication: Yes NonNon-repudiation: Depends on cryptography algorithm. Encryption: No Replay Protection: Yes Transport Packet layout

IP Header AH Header

Payload (TCP, UDP, etc)

Tunnel Packet layout

IP Header AH Header IP Header

Payload (TCP. UDP,etc) © Ahmed Mehaoua - 37

III. III. Protocole de sé sécurité curité AH

© Ahmed Mehaoua - 38

19

IV. IV. Protocole de sé sécurité curité ESP ¾ ESP = Encapsulating Security Payload ¾ définit dans le RFC 2406 ¾ Seules les donné données sont proté protégées (pas de protection enen-tête) ¾ Garantit: - l'authentification. - l’unicité unicité (anti(anti-rejeu) rejeu) - l'inté l'intégrité grité - la confidentialité confidentialité

© Ahmed Mehaoua - 39

IPSec protocols – ESP protocol • ESP – Encapsulating Security Payload – – – – – –

Defined in RFC 1827 Integrity: Yes Authentication: Depends on cryptography algorithm. NonNon-repudiation: No Encryption: Yes Replay Protection: Yes

Transport Packet layout

IP Header ESP Header

Payload (TCP, UDP, etc)

Tunnel Packet layout

IP Header ESP Header IP Header Unencrypted

Payload (TCP. UDP,etc)

Encrypted © Ahmed Mehaoua - 40

20

IV. IV. Protocole de sé sécurité curité ESP

© Ahmed Mehaoua - 41

V. Fonctionnement SA, SAD, SPD n SA : ‘Security Association’ Association’ •

• •

Les Associations de sécurité (SA) définissent les paramètres des divers mécanismes utilisés pour la sécurisation des flux sur le réseau privé virtuel A chaque SA correspond un bloc de données identifié par un index et contenant les informations correspondantes Plus précisément, chaque association est identifiée de manière unique unique à l'aide d'un triplet composé de : - le SPI (Security (Security Parameter Index) Index) : index de la SA défini par le récepteur - l'adresse de destination des paquets - l'identifiant du protocole de sécurité (AH ou ESP)

© Ahmed Mehaoua - 42

21

V. Fonctionnement SA, SAD, SPD n SA : ‘Security Association’ Association’ (suite) Les informations échangé changées sont : - index de la SA appelé appelé SPI (pour Security Parameter Index) - un numé numéro de sé séquence, indicateur utilisé utilisé pour le service d'antid'anti-rejeu - une fenêtre d'antid'anti-rejeu : compteur 32 bits - dépassement de sé séquence - paramè è tres d'authentification (algorithmes et clé param clés) - paramè è tres de chiffrement (idem) param - temps de vie de la SA - mode du protocole IPsec (tunnel ou transport) Attention : un SA est Unidirectionnelle: Unidirectionnelle: proté protéger les deux sens d'une communication classique requiert deux associations. associations. © Ahmed Mehaoua - 43

SA : exemple

Destination : 192.78.42.76 Protocole : ESP index : 10314 Mode : tunnel algorithme de chiffr : AES clé de chiffrement : 0xEB3167C.... algorithme d'authent : SHA1 clé d'authentification : 0xC372F4.... politique associée : #23 date d'expiration : 061120 15:30:00 © Ahmed Mehaoua - 44

22

V. Fonctionnement SA, SAD, SPD

o SAD : Security Association Database - base de donné données des SA pour la gestion des associations de sé sécurité curité actives - consulté consultée pour savoir quels mé mécanismes il faut appliquer à chaque paquet reç reçu ou à émettre.

p SPD : Security Policy Database - base de donné données des politiques de sé sécurité curité (SPD). - Pour savoir comment appliquer les mé mécanismes sur les paquets

© Ahmed Mehaoua - 45

V. Fonctionnement SA, SAD, SPD

© Ahmed Mehaoua - 46

23

V. Fonctionnement SA, SAD, SPD

Exemple 1 : trafic sortant 1) IPsec reç reçoit des donné données à envoyer 2) Consultation de la base de donné données SPD (quel traitement pour ces donné données ?) 3) Mé Mécanismes de sé sécurité curité pour ce trafic ? 4) Oui Ö récupé cupération des caracté caractéristiques requises pour la SA et consultation de la base SAD 5) SA existe ? 6) Oui Ö utilisé utilisée pour traiter le trafic en question Non Ö appel à IKE pour établir une nouvelle SA

© Ahmed Mehaoua - 47

V. Fonctionnement SA, SAD, SPD

Exemple 2 : trafic entrant 1) Ré Réception paquet 2) Examen l'enl'en-tête: services IPsec appliqué appliqués ? 3) Oui Ö références de la SA ? Ö consultation de la SAD 4) Dé Déchiffrement 5) Consultation de la SPD : « SA du paquet correspond bien à celle requise par les politiques de sé sécurité curité ? »

© Ahmed Mehaoua - 48

24

VI. VI. Gestion, distribution des clefs – IKE / ISAKMP • Problèmatique : afin d’échanger des données de façon sécurisée, il est nécessaire de se mettre d’accord sur les paramètres à utiliser, et notamment d’échanger les clefs de session • Il faut 2 paires de clés (AH et ESP) : soit 2 par direction. • 1er solution : configuration manuelle des équipements – (unique méthode proposée dans la première version d’IPSec…)

• 2eme solution : gestion dynamique des paramètres au moyen d’un protocole sécurisé adapté – système automatique pour la creation à la demande des clés pour les SA – Plusieurs solutions : SKIP, Prothuris, Prothuris, Oakley, SKEME and ISAKMP Î IKE – IKE est un protocole orienté connexion utilisé par les équipements équipements IPsec pour échanger et gérer les associations de sécurité à travers l’Internet l’Internet : • Echange de clefs à l’aide de protocoles cryptographiques • Fournit une authentification des entités • Permet un établissement de SA à travers un réseau non sécurisé © Ahmed Mehaoua - 49

VI. VI. Gestion, distribution des clefs – IKE / ISAKMP n IKE : Internet Key Exchange : Qu’ Qu’est ce que c’est ?

¾ IKE est un ensemble de protocoles et de mé mécanismes assurant une gestion sé sécurisé curisée et dynamique des paramè paramètres de sé sécurité curité utilisé utilisés dans IPSec ¾IKE = échange de clé clés d'authentification + gestion des SA ¾ RFC 2409 ¾ Deux maniè manières d'é d'échanger des clefs : - clefs pré pré-partagé partagées - certificats X.509

© Ahmed Mehaoua - 50

25

VI. VI. Gestion, distribution des clefs – IKE / ISAKMP n IKE : Internet Key Exchange

© Ahmed Mehaoua - 51

VII. VII. Faiblesses d'IPsec d'IPsec ¾Limitations dues à la gestion manuelle des clefs - AH et ESP s'appuient sur des numé numéros de sé séquence initialisé initialisés à 0 lors de la cré création d'une SA et incré incrémenté mentés lors de l'envoi de chaque datagramme. - Numé Numéros de sé séquence sont stocké stockés dans un entier de 32 bits ≈ 4 milliards - Passé Passé cette limite, né nécessité cessité de cré créer une nouvelle SA et donc une nouvelle clef. - Possibilité Possibilité de dé désactivation des numé numéros aprè après la limite. ¾Broadcast et multicast Problè Problème de performance et impossibilité impossibilité de ré résolution par l’augmentation de la puissance. © Ahmed Mehaoua - 52

26

VII. VII. Faiblesses d'IPsec d'IPsec (2) ¾Firewalls Le filtrage de datagrammes IPsec est dé délicat pour deux raisons : - les RFCs ne pré précisent pas si, sur un systè système remplissant simultané simultanément les fonctions de passerelle de sé sécurité curité et de firewall, firewall, le dé décodage de l'IPsec l'IPsec doit avoir lieu avant ou aprè après l'application des règles de firewalling ; -il n'est pas possible au code de firewalling de lire certaines donné données, par exemple des numé numéros de port, dans des donné données chiffré chiffrées, ou transmises dans un format qu'il ne connaî connaît pas. ¾NATs Thé Théoriquement, aucune translation d'adresse ne devrait affecter un datagramme IPsec, IPsec, car ce type d'opé d'opération modifie le contenu des datagrammes, ce qui est incompatible avec les mé mécanismes de protection de l'inté l'intégrité grité des donné données d'IPsec d'IPsec.. © Ahmed Mehaoua - 53

- Partie 3 VPN IP sécurisé avec IPsec -

VII. VII. Faiblesses d'IPsec d'IPsec (suite 3) ¾ Non support de protocoles ré réseaux autres qu'IP IPsec est un protocole qui ne pré prévoit que le convoyage sé sécurisé curisé de datagrammes IP Ceci n'est pas suffisant, car d'autres standards comme IPX et NetBIOS sont utilisé utilisés sur un grand nombre de ré réseaux. Il existe cependant une solution à ce problè problème : encapsuler les donné données à proté protéger dans du PPP, luilui-même transporté transporté par IPsec. IPsec. Le rôle de PPP est en effet de permettre la transmission de diffé différents protocoles auaudessus d'un lien existant.

© Ahmed Mehaoua - 54

- Partie 3 VPN IP sécurisé avec IPsec -

27

Conclusion: IPSec-IKE-SA • IPsec ensemble de protocoles et mécanismes pour le chiffrement de paquets IP • SASA->traitement à mettre en oeuvre sur un paquet IP quand il faut lui appliquer IPSec • IKEIKE->gestionnaire de SA • IPSecIPSec->utilisateur de SA

© Ahmed Mehaoua - 55

Typologie des technologies VPN VPN de niveau 2 ‰ VPNVPN-IP avec MPLS ‰ VPNVPN-IP avec IPSEC ‰ VPNVPN-SSL ‰

© Ahmed Mehaoua - 56

28

Technologies VPN Communication layers Security protocols Application layer

ssh, S/MIME, PGP

Transport layer

SSL, TLS, WTLS

Network layer

IPsec

Data Link layer

PPTP, L2TP

Physical layer

Scrambling, Hopping, Quantum Communications

MPLS

© Ahmed Mehaoua - 57

Agenda • Introduction – Motivation, evolution, standardization – Applications

• SSL Protocol – SSL phases and services – Sessions and connections – SSL protocols and layers • SSL Handshake protocol • SSL Record protocol / layer

• SSL solutions and products • Conclusion © Ahmed Mehaoua - 58

29

Sécurisation des échanges • Pour sécuriser les échanges ayant lieu sur le réseau Internet, il existe plusieurs approches : - niveau applicatif (PGP) - niveau réseau (protocole IPsec) IPsec) - niveau physique (boîtiers chiffrant). • TLS/SSL vise à sécuriser les échanges au niveau de la couche Transport. Transport. • Application typique : sécurisation des transactions Web © Ahmed Mehaoua - 59

Transport Layer Security • Advantages – Does not require enhancement to each application – NAT friendly – Firewall Friendly • Disadvantages – Embedded in the application stack (some mis-implementation) – Protocol specific --> need to duplicated for each transport protocol – Need to maintain context for connection (not currently implemented for UDP) – Doesn’t protect IP adresses & headers

© Ahmed Mehaoua - 60

30

Security-Sensitive Web Applications • • • • • •

Online banking Online purchases, auctions, payments Restricted website access Software download Web-based Email Requirements – – – –

• •

Authentication: Of server, of client, or (usually) of both Integrity: Of requests, of responses, etc. Confidentiality: Of data transfers Availability: No Denial of Service

Some minor applications : SSL VPN (end-to-end) Main tool: SSL / TLS protocol © Ahmed Mehaoua - 61

IPsec et l’architecture TCP/IP

TLS

Physique

SSL

Cuivre, Fibre Optique, Ondes Radio, ...

© Ahmed Mehaoua - 62

31

Transport Layer Security Protocols • Connectionless and connection-oriented transport layer service: – Security Protocol 4 (SP4) – NSA, NIST – Transport Layer Security (TLSP) – ISO

• Connection-oriented transport layer service: – Encrypted Session Manager (ESM) – AT&T Bell Labs. – Secure Socket Layer (SSL) – Netscape Communications – Transport Layer Security (TLS) – IETF TLS WG Most popular transport layer security protocols © Ahmed Mehaoua - 63

SSL/TLS Evolution

No client auth; weak encryption; Man-in-the-midle attack

Microsoft’s improved SSLv2: security (e.g. strong exportable auth.), performance (flows) PCT (1995)

Microsoft’s improved SSLv3: support for UDP, and shared-secret authentication STLP (1996)

WAP WTLS (1990-)

Not released SSLv2 (1994)

SSLv3 (1995)

SSLv1 (1994) Substantial redesign; add client authentication, support for DH DSS : Digital Signature Standard (Public (Public--key) key) DH : DiffieDiffie-Hellman

TLS 1.0 (1997-1999) RFC 2246

TLS 1.1 (2001-?)

SSLv3 but incompatible: improved key expansion and MAC, support 3DES and DH for key exchange © Ahmed Mehaoua - 64

32

SSL/TLS in a Nutshell • SSL & TLS provide a `secure `secure TCP tunnel from client to server`: server`: – Message Confidentiality – Message and connection integrity – Authentication of server, optionally also of client • Implemented in almost all web clients, servers • Many implementations, libraries, e.g. OpenOpen-SSL • SSL: Secure Socket Layer – Version 3 designed by Netscape Corp. – Original goal and main use: secure credit card number

– SSL (& TLS) operate on top of `standard` Sockets API

• TLS: Transport Layer Security – Version 1.0 – RFC 2246 – IETF standard version of SSL – We usually say just SSL but refer to both © Ahmed Mehaoua - 65

SSL/TLS : Applications and ports Protocol

Normal Port

Secured Protocol

HTTP

80

HTTPS

NTP

119

Encrypted Port

RFC

443

2818

563

LDAP

389

SLDAP

636

2830

FTP-DATA

20

SFTP

989

draft

FTPcontrol

21

SFTP

990

draft

TELNET

23

SSH

22

4251

IMAP

143

SIMAP

993

2595

IRC

194

994

2813

POP3

110

SPOP3

995

2595

SMTP

25

SMTP-TLS

465 (25)

2487

© Ahmed Mehaoua - 66

33

SSL-based current solutions •

OpenSSL : www.openssl.org –

• •

a robust, robust, commercialcommercial-grade, grade, fullfull-featured, featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols

Win32 SSL API JavaSSL : www.bpsinfo.com/javassl/ –

A Java package which uses JNI to provide an SSLSocket class



ApacheApache-SSL : http://www.apachehttp://www.apache-ssl.org/



OpenSSH : www.openssh.com/ www.openssh.com/ A port of the OpenSSLOpenSSL-based SSH package



Mocana Security Suite : www.mocana.com



sNFS : www.quick.com.au/ftp/pub/sjg/help/sNFS.html

– Software suite including (SSL, SSH, IPsec, IPsec, IKE, Radius, …) – An SSLSSL-based NFS variant • OpenVPN : www.openvpn.org

© Ahmed Mehaoua - 67

SSL/TLS principles • Client / Server • Provide 4 security services : – – – –

Authentication of server Confidentiality of exchanged data Integrity of exchanged data Optional : authentication of client (if client has a certificate)

• Combining various security mechanisms : – – – –

Asymmetric Ciphering : authentication (RSA) Certificate : to validate public key of the server Symmetric Ciphering : Confidentiality of data transmission Hach function : integrity of data (MD(MD-5, SHASHA-1)

© Ahmed Mehaoua - 68

34

Principe de fonctionnement de SSL: Exemple du paiement en ligne Le client, connecté au site marchand sécurisé par SSL, clique sur un lien hypertexte déclenchant une requête de formulaire sécurisé et la création d'une clé privée que le client va conserver, et d'une clé publique qui sera expédiée au serveur marchand

s de SSL n r tio s pa a s ri tion cu Sé nsac tra

Le serveur marchand crée une clef de session en cryptant un message aléatoire à l'aide de la clef publique, puis l'envoie au client

A réception, le client crypte la clef de session à l'aide de la clef privée, puis l'envoie au serveur marchand, qui va la décrypter à l'aide de la clé publique afin de vérifier l'authenticité du message, donc de l'acheteur

Le reste des transactions peut alors se faire à l'aide de la clef clef de session, connue des deux côtés et inconnue des autres entités du réseau © Ahmed Mehaoua - 69

Exemple de Certificat X509

© Ahmed Mehaoua - 70

35

Web Security with SSL/TLS (simplified) Domain Name System (DNS)

2. Domain (bank.com) 1. URL/Link

Certificate Authority (CA)

https://bank.com

3. IP (67.22.5.2) 6. Display: -- Page -- URL -- Padlock

e.g. VeriSign

cert=SignCA(pk, domain)

4. SSL/TLS: Establish key using pk…

4a. Hello 4c. Epk(key)

4b. pk, cert www.bank.com

5. SSL/TLS: Protect using key… 5a. HTTP Get (www.bank.com)

5b. Web (login) page 5c. HTTP Post (userid/pw)

(Web Server, at 67.22.5.2, Port 443)

© Ahmed Mehaoua - 71

SSL Architecture 1. 2.

page 72

36

SSL Architecture (suite) • SSL is built in two layers: – SSL Handshake Layer – used for managing SSL exchanges (cipher suite negotiation, session key generation, etc.) – SSL Record Layer – used to secure communication between client and server with the established session keys

Handshake layer Application

Record layer

© Ahmed Mehaoua - 73

SSL Main Protocols • SSL Record Protocol – Layered on top of a connectionconnection-oriented and reliable transport layer service – Provides message origin authentication, data confidentiality, and and data integrity

• Handshake Protocol

– Used to mutually authenticate client and server and exchange session key

© Ahmed Mehaoua - 74

37

SSL Sub-Protocols • •

Layered on top of the SSL Record Protocol Provides support for SSL session and connection establishment



Alert Protocol

– Used to transmit alerts via SSL Record Protocol – Alert message: (alert level, alert description) •

ChangeCipherSpec Protocol

– Used to change cipher specifications – Can be changed at the end of the handshake or later •

Application Protocol

– Used to directly pass application data to the SSL Record Protocol Protocol

© Ahmed Mehaoua - 75

SSL Operation Phases Client uses SSL API to open connection • TCP Connection Phase • Handshake Phase (SSL Handshake Protocol) – – – –

• •

Negotiate (agree on) algorithms, methods Authenticate server and optionally client Establish keys Establish connection (keys and optionally Initialization Vector)

Data transfer Phase (SSL Record Protocol) SSL Secure Teardown Phase

Server

Syn +Ack

SSL Handsake

Data Transfer SSL Record Protocol

SSL Fin Teardown +Ack Client © Ahmed Mehaoua - 76

38

SSL Record Protocol

page 77

SSL Record Protocol (suite)





message fragmentation and compression –

16KB in a fragment



LossLess compression (1 KB is OK)

confidentiality –





using symmetric encryption with a shared secret key defined by Handshake Handshake Protocol



IDEA, RC2RC2-40, DESDES-40, DES, 3DES, Fortezza, RC4RC4-40, RC4RC4-128, AES



message is compressed before encryption (optional)

message integrity –

using a MAC with shared secret key



Using SHA-1 or MD5

Non replay –

Use counter (64 bits) to prevent replay in SSL session

page 78

39

SSL Alert Protocol • SSL Alert Protocol signals state changes and indicates errors • SSL Alert is invoked by: – Handshake protocol – in case of problem – Record protocol – e.g. if MAC is not valid – Application – to close connection (close_notify) – Connections should be closed with close_notify to allow detection detection of truncation attacks (dropping last messages) – Notice: Notice: close_notify is normal, not a failure alert!

• The alerts are carried in an “Alert Record”

© Ahmed Mehaoua - 79

SSL Alert Protocol (2) • Use twotwo-byte message to convey SSLSSL-related alerts to peer entity – First byte is severity level •

warning(1) or fatal(2)

– Second byte is specific alert • •

Always fatal: unexpected_message, bad_record_mac, decompression_failure, handshake_failure, illegal_parameter Other alerts: close_notify, no_certificate, bad_certificate, unsupported_certificate, certificate_revoked, certificate_expired, certificate_expired, certificate_unknown

• Compressed and encrypted like all SSL data

© Ahmed Mehaoua - 80

40

SSL Handshake Protocol •

Allow server and client to agree agree on cipher suite (algorithms and options):

– authenticate server (madatory (madatory)) – Authenticate client (option) – negotiate encryption algorithms (symmetric or asymmetric) – negotiate Signature & MAC algorithms – negotiate cryptographic keys to be used – Send certificate(s) certificate(s) – SSL Message compression •

Comprise a series of messages in 4 phases

– Establish Security Capabilities – Server Authentication and Key Exchange – Client Authentication and Key Exchange – Finish © Ahmed Mehaoua - 81

SSL Handshake Protocol Phases Client

Server Client

hello



te certifica hange ey_exc Server_k est qu re e_ at Certific one _d lo el Server_h certific ate Client_ key_ex chang e Certific ate_ve rify Chang

e_ciphe r_spec

finished

r_Spec _ciphe Change d finishe

Phase 1 – Establish parameters Negotiation of the session ID, key exchange algorithm, MAC algorithm, algorithm, encryption algorithm, and exchange of initial random numbers

ello server h



Phase 2 – Server authentication (optional: server keykeyexchange) Server may send its certificate and key exchange message, and it may request the client to send a certificate. Server signals end of hello phase.



Phase 3 – Client keykey-exchange (optional: client authentication) Client sends certificate if requested and may send an explicit certificate certificate verification message. Client always sends its key exchange message. message.



Phase 4 – Finish: validation and begin using exchanged keys Change cipher spec and finish handshake

© Ahmed Mehaoua - 82

41

Phase 1 – Establish Parameters Client

Server Client

Client_hello message



hello

– Version (highest available) – A timestamp and random string called clientHello.random

ello server h te certifica nge _excha ey _k er Serv est qu re ate_ Certific e ello_don Server_h

– Session identifier (used for existing connections) – Cipher-suite – a list of supported cryptographic algorithms – Compression method – Client_random, server_random

certific ate Client_ key_ex chang e Certific ate_ve rify

– From TLS 1.1: Extensions

Chang

e_ciphe r_spec finished

server_hello : same fields



r_Spec _ciphe Change finished

© Ahmed Mehaoua - 83

Phase 1 – Establish Parameters (suite) Client

Server Client

hello

ello server h



hange ey_exc Server_k est qu re e_ at Certific one _d lo el Server_h certific ate Client_ key_ex chang e Certific ate_ve rify Chang

CipherCipher-suite elements:

– KeyKey-exchange method (e.g. RSA) – Encryption algorithm (e.g. DES or RC4) – MAC (message authentication code) algorithm (e.g. SHASHA-1 or MD5)

te certifica



Server chooses one ciphercipher-suite from those sent by client

e_ciphe r_spec

finished

r_Spec _ciphe Change d finishe

© Ahmed Mehaoua - 84

42

Phase 2 – Server Authentication Client

Server Client

hello



ello server h te certifica hange ey_exc Server_k est qu re ate_ Certific e on _d lo el Server_h



Optional Server_key_exchange message

– It sends one or a chain of X.509 certificates – Used in Diffie-Hellman key exchange – Not used in RSA key exchange

certific ate Client_ key_ex chang e Certific ate_ve rify Chang



Phase 2 – Server Authentication and (optional) Server Key-Exchange Server sends its certificate



Optional certificate_request message: for client authentication • server_hello_done

e_ciphe r_spec

finished

r_Spec _ciphe Change finished

© Ahmed Mehaoua - 85

Phase 3 – Client Key-Exchange Client

Server Client

hello

ello server h te certifica hange ey_exc Server_k est qu re e_ at Certific one _d lo el Server_h certific ate Client_ key_ex chang e Certific ate_ve rify Chang



Phase 3 – Client Key-Exchange and (optional) Client Authentication



The client verifies the server’s certificate and sends its side of the key exchange

– In Diffie-Hellman: the D-H key share – In RSA: encryption of random string •

If client authentication used (rarely): client sends certificate (but most clients don’t have certificates)

e_ciphe r_spec

finished

r_Spec _ciphe Change d finishe

© Ahmed Mehaoua - 86

43

Phase 4 – Finish Client

Server Client

hello



ello server h te certifica hange ey_exc Server_k est qu re ate_ Certific e on _d lo el Server_h certific ate Client_ key_ex chang e Certific ate_ve rify Chang



Client and server send change_cipher_spec messages – Results in use of new cipher-suite (as negotiated in the hello phase) Client and server send finished messages – Messages are HMAC on all the handshake messages using master_secret as the key – The MAC is computed twice – once with MD5 and once with SHA1

e_ciphe r_spec

finished

r_Spec _ciphe Change finished

© Ahmed Mehaoua - 87

SSL Connection State Variables „

Master Secret (shared key) ‰

„ „

Server and client sequence numbers Server_random, Server_random, client_random: client_random: 32 bytes ‰

„

Unique to each connection

Unique to each connection, selected by server and client

Cryptographic keys, keys, Initialization Vectors (IV) ‰

‰

Derived from Master Secret using a PseudoPseudo-Random Function (PRF) What’ What’s a PRF and how we use it?

© Ahmed Mehaoua - 88

44

A Pseudo-Random Function „

An efficient function using secret key ‰

„

TLS’ TLS’s PRF is based on MD5 and SHASHA-1 (later… (later…)

That cannot be distinguished from random

x RandomFunction(x) x PRFk(x) © Ahmed Mehaoua - 89

SSL Key Derivation „

„

The master key is used to derive the following six keys and values: ‰

Client MAC key

‰

Server MAC key

‰

Client encryption key

‰

Server encryption key

‰

Client Init Vector (for CBC encryption)

‰

Server Init Vector (for CBC encryption)

Separate client and server keys are used ‰

So successful attack against server does not compromise client, and vice versa © Ahmed Mehaoua - 90

45

Deriving Connection Keys, IVs Key_Block = PRF master_secret (“key expansion”|| Server_random || Client_random) Split Key_Block to ClientMACKey, serverMACKey, ClientEncryptKey,…(using fixed order) Server_random

master_secret

Client_random

PRF details differ btw TLS and SSL3…

PRF Key_Block

MAC keys

Encrypt keys

IVs © Ahmed Mehaoua - 91

Summary: Trust & Security with SSL •

Confidentiality & authenticity of messages



Server (site) authentication: – Customer needs to identify site (bank, etc.) Client authentication: – Bank needs to identify account holder – Company needs to identify employee – Content provider needs to identify subscriber







NonNon-repudiation: – Proof of making/receiving order/transaction – Prevent/resolve dispute, identify corruption Denial of service

Good in SSL/TLS

Done, but…

Not in SSL

© Ahmed Mehaoua - 92

46

Conclusion •

SSL / TLS is the most widely deployed security protocol, standard standard

– Easy to implement, deploy and use; widely available – Flexible, supports many scenarios and policies – Mature cryptographic design • But SSL is not always the best tool… – Use IPIP-Sec e.g. for antianti-clogging, broader protection, multicast – Use application security, e.g. s/mime, for nonnon-repudiation, storestoreandand-forward communication (not online) • Beware of spoofing – Many browsers allow hardhard-toto-detect spoofing – Many users will not detect simple spoofing (similar URL)

© Ahmed Mehaoua - 93

47

Suggest Documents