Transcript CN 8816

Virtual Private Networks (VPN)
Generic Routing Encapsulation (GRE)
TLS (SSL-VPN)

CN8814: Network Security
1
1. Generic Routing Encapsulation (GRE)

Tunneling


Encapsulation with delivery header
The addresses in the delivery header are the addresses of
the head-end and the tail-end of the tunnel
Delivery header
20.1.1.1/30.1.1.1
GRE
10.1.1.1/10.2.1.1
20.1.1.1
30.1.1.1
10.1.1.1/10.2.1.1
tunnel
Private
network site
10.1.0.0/16
Public Network
10.1.1.1
Virtual Private
Networks (VPN)
Private
network site
10.2.0.0/16
10.2.1.1
CN8816: Network Security
2
1. Generic Routing Encapsulation (GRE)

Structure of a GRE encapsulated packet
Virtual Private
Networks (VPN)
CN8816: Network Security
3
1. Generic Routing Encapsulation (GRE)

IP access of the tunnel through the tunnel interface
20.1.1.1/30.1.1.1 GRE 10.1.1.1/10.2.1.1
Gateway
Gateway
20.1.1.1
Internet
30.1.1.1
serial 0/0
serial 0/0
tunnel 0
tunnel 0
e0
10.1.1.1/10.2.1.1
e0
10.1.1.1/10.2.1.1
10.1.1.1/10.2.1.1
10.2.0.0/16
10.1.0.0/16
Customer Sites
Virtual Private
Networks (VPN)
CN8816: Network Security
4
1. Generic Routing Encapsulation (GRE)

Tunneling mechanism at IP

Outbound traffic
Routing table of R1
10.1.0.0/16
20.1.1.1/30
10.2.0.0/16
0.0.0.0/0
20.1.1.1/30.1.1.1
e0
s0
tunnel0
s0
(6)
(3)
(7)
(4)
(2)
(8)
s0
(9)
e0
(5)
… Tunnel0
(1)
20.1.1.1/30.1.1.1 [10.1.1.1/10.2.1.1]
Virtual Private
Networks (VPN)
GRE
IP
10.1.1.1/10.2.1.1
CN8816: Network Security
5
1. Generic Routing Encapsulation (GRE)

Inbound traffic
Routing table of R2
10.2.0.0/16
30.1.1.1/30
10.2.0.0/16
0.0.0.0/0
e0
s0
tunnel0
s0
(6)
(2)
s0
(1)
20.1.1.1/30.1.1.1 [10.1.1.1/10.2.1.1]
Virtual Private
Networks (VPN)
(3)
IP
(5)
(7)
e0
GRE
(4)
10.1.1.1/10.2.1.1
…
Tunnel
0
(8)
10.1.1.1/10.2.1.1
CN8816: Network Security
6
1. Generic Routing Encapsulation (GRE)

Example
interface tunnel0
ip unnumbered s0
tunnel source s0
tunnel destination 30.1.1.1
!
ip route 10.2.0.0 255.255.0.0 tunnel0
interface tunnel0
ip unnumbered s0
tunnel source s0
tunnel destination 20.1.1.1
!
ip route 10.1.0.0 255.255.0.0 tunnel0
Routing table of R1
10.1.0.0/16
20.1.1.1/30
10.2.0.0/16
0.0.0.0/0
Virtual Private
Networks (VPN)
e0
s0
tunnel0
s0
CN8816: Network Security
7
1. Generic Routing Encapsulation (GRE)

GRE tunneling with routing
Routing updates
(subnets of 10.0.0.0/8)
Virtual Private
Networks (VPN)
CN8816: Network Security
8
3. IP Security (IPsec)

IPsec and Dynamic Routing

IPsec-protected traffic must be pre-defined

IPsec only supports static routing
The IPsec tunnel is setup for the
traffic between 10.1.0.0/16 and
10.2.0.0/16
IPsec tunnel
10.1.0.0/16
10.2.0.0/16
The tunnel will not
support the traffic to the
new site
Virtual Private
Networks (VPN)
CN8816: Network Security
10.3.0.0/16
New site
9
3. IP Security (IPsec)

IPsec/GRE


GRE defines a tunnel interface
IPsec transport mode provides the security
Routing table
10.1.0.0/16
30.0.0.0/8
10.2.0.0/16
10.3.0.0./16
inside
outside
tunnel0
tunnel0
(4)
IP
GRE
(5)
IPsec
(transport)
(6)
outside
(1)
inside
(2)
(3)
Tunnel0
10.1.1.1/10.2.1.1
20.1.1.1/30.1.1.1 Ipsec_protected
Virtual Private
Networks (VPN)
10.1.1.1/10.3.1.1
CN8816: Network Security
10
3. IP Security (IPsec)

Virtual Tunnel Interface
Provide secure tunnel by associating the virtual interface with
IPsec

20.1.1.1/30.1.1.1
Routing table
10.1.0.0/16
30.0.0.0/8
10.2.0.0/16
10.3.0.0./16
inside
outside
tunnel0
tunnel0
(5)
IP
(2)
inside
(6)
outside
Protected packet
IPsec
(3)
(4)
Tunnel0
10.1.1.1/10.2.1.1
10.1.1.1/10.3.1.1
Virtual Private
Networks (VPN)
CN8816: Network Security
11
2. Transport-Layer Security (TLS)

TLS architecture

Provide security connection between two application
entities
Error and alert reporting
-Authentication
-Cipher suit
negotiation
-Keys
generation
Virtual Private
Networks (VPN)
Encryption,
MIC &
Compression
CN8816: Network Security
12
2. Transport-Layer Security

TLS Record protocol


Four connection states: current read and write states,
and the pending read and write states
Security parameters:








Connection end (client/server)
Bulk encryption algorithm: type, key_size, …
MAC algorithm: hash_size
Compression algorithm
Master Secret
Client random, Nc
Server random, Ns
Keys

Client_MAC_Write, Server_MAC_Write, Client_Write_Key,
Server_Write_Key, IVs
Virtual Private
Networks (VPN)
CN8816: Network Security
13
2. Transport-Layer Security

Messages are processed using the current read or write states
Type
Version
Length
Write/read
MAC secret
Fragment (Compressed)
Write/read
Key
ICV
Padding (for CBC block cipher)
Pad length
Virtual Private
Networks (VPN)
CN 8816: Network Security
14
2. Transport-Layer Security

Key Generation

Master_secret = PRF(gxy mod N, “master secret”, Nc+Ns)




x and y are the DE parameters
Nc and Ns are the nonces generated by the client and the
server, respectively
Master_secret is always 48 bytes
PRF(secret, label, seed) = P_hash(secret, label+seed)


P_hash(secret, seed) =
HMAC(secret, A(1)+seed)
+ HMAC(secret, A(2)+seed)
+…
+ HMAC(secret, A(n)+seed)
A(0) = seed
A(i) = HMAC(secret, A(i-1)
Virtual Private
Networks (VPN)
CN 8816: Network Security
15
2. Transport-Layer Security

By default, the hash used in HMAC is SHA-256

Need two HMAC iterations to generate the Master secret
Master secret (48 bytes)

Truncated
(16 bytes)
Key generation

Key_block = PRF(Master_secret, “key expansion”, Ns+Nc)
MAC client
Write (Kmc)
Virtual Private
Networks (VPN)
MAC server Client Write Server Write
IVs (options)
Write (Kms) Key (Kwc) Key (Kws)
CN 8816: Network Security
…
16
2. Transport-Layer Security

Handshake protocol

Client hello and server response phase
Client
Server
Client Hello: session ID, Nc, cipher suit list, compression alg. list
Server Hello: Ns, cipher suit, compression alg.
Server Certificate O+
Key Exchange: Signature O+
Certificate request OServer Hello Done
O+ => Often; O- => Less often
Virtual Private
Networks (VPN)
CN 8816: Network Security
17
2. Transport-Layer Security

Client reponse and change-cipher specification phase
Client
O-
Server
Client Certificate
Key exchange
O-
Certificate verify: signature
Change cipher specification
Finished: session authentication
Change cipher specification
Finished: session authentication
Application Data
Virtual Private
Networks (VPN)
CN 8816: Network Security
18
2. Transport-Layer Security

The handshake protocol allows quick setup of new TLS
connection using the old session master secret

The master secret is allowed to be kept for 24 hours
Client
Server
Client Hello: session ID, Nc
Server Hello: Ns Generate keys
Generate keys
Change cipher spec
Finished
Change cipher spec
Finished
Data
Virtual Private
Networks (VPN)
CN 8816: Network Security
19
2. Transport-Layer Security

Change Cipher Spec Protocol

invoke the transition from the pending states to current states
Client
Server
Pending Kmc, Kwc
states Kms, Kws
ChangeCipher (1)
Specs Protocol
(1) ChangeCipherSpecs
(5)
(3)
Handshake
(6)
Current
states
Virtual Private
Networks (VPN)
Kmc, Kwc Pending
Kms, Kws states
(4) ChangeCipherSpecs (2)
(4) ChangeCipher
Specs Protocol
(3) finished
(3)
(6) finished
(6)
Handshake
Current
states
CN8816: Network Security
20
2. Transport-Layer Security

Alert Protocol


Alert messages convey the severity of the message
and a description of the alert
Alert levels: warning or fatal


Alert messages with a level of fatal result in the
immediate termination of the connection
Alert types:


Close notification
Error alerts
Virtual Private
Networks (VPN)
CN8816: Network Security
21
2. Transport-Layer Security

SSL (TLS) VPN
Tunnel interface is used to support secure tunnel connection

Appl.
Web browser
(1)
(5)
SSL-VPN
client
SSL-VPN
web server
(4) Upload of SSLVPN client
(9)
(3)
(2) TLS handshake protocol
TLS
(10)
TLS
IP
IP
(7)
tun0
TCP/UDP
(15)
(11)
(8)
(12)
eth0
Virtual Private
Networks (VPN)
(18)
(16)
TCP/UDP
(6)
(17)
(14)
(13)TLS protected datagram
(19)
(20)
Outside
CN8816: Network Security
Inside tun0
22