TURN REST Server API draft-uberti-behave-turn-rest-00 Justin - - PowerPoint PPT Presentation

turn rest server api
SMART_READER_LITE
LIVE PREVIEW

TURN REST Server API draft-uberti-behave-turn-rest-00 Justin - - PowerPoint PPT Presentation

TURN REST Server API draft-uberti-behave-turn-rest-00 Justin Uberti, Google 1 Typical TURN Auth: Config TURN Password Client Server DB WebRTC JavaScript code: var iceServer = { uris: ["turn:turn.bar.com:3478?proto=udp"],


slide-1
SLIDE 1

TURN REST Server API

draft-uberti-behave-turn-rest-00 Justin Uberti, Google

1

slide-2
SLIDE 2

Typical TURN Auth: Config

Client Password DB TURN Server WebRTC JavaScript code: var iceServer = { uris: ["turn:turn.bar.com:3478?proto=udp"], username: foo credential: mysecret }; var config = { iceServers: [iceServer] }; var pc = new PeerConnection(config, null); 2

slide-3
SLIDE 3

Typical TURN Auth: TURN Request

Client Password DB TURN Server ALLOCATE REQUEST 3

slide-4
SLIDE 4

Typical TURN Auth: TURN Error Response

Client Password DB TURN Server ALLOCATE ERROR RESPONSE ERROR-CODE: 401 (Unauthorized) REALM: bar.com NONCE: abcd1234 4

slide-5
SLIDE 5

Typical TURN Auth: TURN Request (2)

Client Password DB TURN Server ALLOCATE REQUEST USERNAME: foo REALM: bar.com NONCE: abcd1234 MESSAGE-INTEGRITY: HMAC(M, MD5( "foo:bar.com:mysecret" ) ) 5

slide-6
SLIDE 6

Typical TURN Auth: HA1 Request

Client Password DB TURN Server Give me HA1: user: foo 6

slide-7
SLIDE 7

Typical TURN Auth: HA1 Response

Client Password DB TURN Server Here you go: ha1: MD5("foo:bar.com: mysecret") 7

slide-8
SLIDE 8

Typical TURN Auth: Verify

Client Password DB TURN Server MESSAGE-INTEGRITY verify against HMAC(M, HA1) 8

slide-9
SLIDE 9

Typical TURN Auth: TURN Response

Client Password DB TURN Server ALLOCATE RESPONSE XOR-RELAYED-ADDRESS=<ip> MESSAGE-INTEGRITY: HMAC(M, MD5( "foo:bar.com:mysecret" ) ) 9

slide-10
SLIDE 10

The problems with the TURN long-term auth exchange are documented in draft-reddy-behave-turn-auth

  • TURN password must be kept secret

(hard for WebRTC apps)

  • TURN password vulnerable to offline dictionary

attacks on MESSAGE-INTEGRITY

  • TURN server must consult a password database

to verify MESSAGE-INTEGRITY

  • TURN username value is passed in the clear, can

be used for traffic analysis

Inherent Problems

10

slide-11
SLIDE 11

Proposed Solution

Client makes a HTTP request to a web service to get ephemeral (time-limited) credentials:

  • No long-term credentials to keep secret; even if

discovered, credential usefulness is limited

  • Username contains no externally-identifying

information

  • Password is machine-generated, to prevent

dictionary attacks

  • Response also includes location of TURN server,

avoiding complex SRV lookups

11

slide-12
SLIDE 12

Credential Verification

While the TURN server could verify credentials against the HTTP server, the draft suggests a stateless design that requires no backchannel.

  • Username is credential expiration timestamp +

any desired application data

  • Password is HMAC(username, SS), where SS is a

shared secret key between HTTP and TURN servers

  • To get HA1, TURN server simply does

MD5(<username>:<realm>:<hmac>)

12

slide-13
SLIDE 13

Stateless TURN Auth: HTTP Cred Request

Client HTTP Server GET /?service=turn 13

slide-14
SLIDE 14

Stateless TURN Auth: HTTP Cred Response

Client HTTP Server

200 OK Content-Type: application/json { username: "1375043478:abcd1234", password: <HMAC("1375043487:abcd1234", SS)> ttl: 86400, uris: [ "turn:turn.bar.com:3478?proto=udp", "turn:turn.bar.com:3478?proto=tcp", "turns:turn.bar.com:443?proto=tcp" ] }

14

slide-15
SLIDE 15

Stateless TURN Auth: TURN Request (2)

Client TURN Server ALLOCATE REQUEST USERNAME: 1375043478:abcd1234 REALM: bar.com NONCE: abcd1234 MESSAGE-INTEGRITY: HMAC(M, MD5( "1375043478:abcd1234:bar.com:<hmac-password>" ) ) 15

slide-16
SLIDE 16

Stateless TURN Auth: Verify

Client TURN Server 1. Parse timestamp from USERNAME (1375043478) 2. Check that timestamp is in the future 3. Compute password: HMAC(1375043478:abcd1234, SS) 4. Compute HA1: MD5(1375043478:abcd1234:bar.com: <hmac-password>) 5. MESSAGE-INTEGRITY verify against HMAC(M, HA1) 6. If it's cool, return success response 7. No communication with HTTP server needed! 16

slide-17
SLIDE 17
  • STUN defines a short-term credential

mechanism, but this mechanism doesn't support nonces, opening the door for trivial replay attacks

Why not Short Term Credentials?

17

slide-18
SLIDE 18

Questions

  • Adopt as WG draft?
  • Propose generic HTTP mechanism + example

stateless implementation, or focus exclusively on stateless design?

18