1 CS 194: Distributed Systems Review Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer Sciences.

Slides:



Advertisements
Similar presentations
1 CS 194: Distributed Systems Process resilience, Reliable Group Communication Scott Shenker and Ion Stoica Computer Science Division Department of Electrical.
Advertisements

Last Class: The Problem BobAlice Eve Private Message Eavesdropping.
CIS 725 Key Exchange Protocols. Alice ( PB Bob (M, PR Alice (hash(M))) PB Alice Confidentiality, Integrity and Authenication PR Bob M, hash(M) M, PR Alice.
Spring 2000CS 4611 Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
Internet and Intranet Protocols and Applications Lecture 9a: Secure Sockets Layer (SSL) March, 2004 Arthur Goldberg Computer Science Department New York.
Distribution and Revocation of Cryptographic Keys in Sensor Networks Amrinder Singh Dept. of Computer Science Virginia Tech.
1 Network Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
Computer Science Lecture 18, page 1 CS677: Distributed OS Last Class: Fault Tolerance Basic concepts and failure models Failure masking using redundancy.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering.
Spring 2002CS 4611 Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
Computer Science Lecture 17, page 1 CS677: Distributed OS Last Class: Fault Tolerance Basic concepts and failure models Failure masking using redundancy.
8-1 What is network security? Confidentiality: only sender, intended receiver should “understand” message contents m sender encrypts message m receiver.
EECS122 - UCB 1 CS 194: Distributed Systems Processes, Threads, Code Migration Computer Science Division Department of Electrical Engineering and Computer.
Distributed Systems CS Fault Tolerance- Part III Lecture 15, Oct 26, 2011 Majd F. Sakr, Mohammad Hammoud andVinay Kolar 1.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering.
EEC 688/788 Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
1 CS 194: Distributed Systems Distributed Commit, Recovery Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering.
Spring 2003CS 4611 Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
Cryptography April 20, 2010 MIS 4600 – MBA © Abdou Illia.
Overview of Cryptography and Its Applications Dr. Monther Aldwairi New York Institute of Technology- Amman Campus INCS741: Cryptography.
Katz, Stoica F04 EE 122: (More) Network Security November 5, 2003.
1 CS 194: Distributed Systems Security Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer Sciences.
Lecture 4 Cryptographic Tools (cont) modified from slides of Lawrie Brown.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Alexander Potapov.  Authentication definition  Protocol architectures  Cryptographic properties  Freshness  Types of attack on protocols  Two-way.
Chapter 31 Network Security
CS5204 – Fall Cryptographic Security Presenter: Hamid Al-Hamadi October 13, 2009.
Computer Security Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Network Security (A Very Brief Introduction)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 8 Fault.
Cryptography  Why Cryptography  Symmetric Encryption  Key exchange  Public-Key Cryptography  Key exchange  Certification.
Dr. L. Christofi1 Local & Metropolitan Area Networks ACOE322 Lecture 8 Network Security.
Cryptography, Authentication and Digital Signatures
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
Cryptography Wei Wu. Internet Threat Model Client Network Not trusted!!
23-1 Last time □ P2P □ Security ♦ Intro ♦ Principles of cryptography.
Practical Byzantine Fault Tolerance
Cryptography (2) University of Palestine Eng. Wisam Zaqoot April 2010 ITSS 4201 Internet Insurance and Information Hiding.
Byzantine fault-tolerance COMP 413 Fall Overview Models –Synchronous vs. asynchronous systems –Byzantine failure model Secure storage with self-certifying.
Advanced Database Course (ESED5204) Eng. Hanan Alyazji University of Palestine Software Engineering Department.
Lecture 16: Security CDK4: Chapter 7 CDK5: Chapter 11 TvS: Chapter 9.
Upper OSI Layers Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
Digital Signatures, Message Digest and Authentication Week-9.
Security Many secure IT systems are like a house with a locked front door but with a side window open -somebody.
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
31.1 Chapter 31 Network Security Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
More on Fault Tolerance Chapter 7. Topics Group Communication Virtual Synchrony Atomic Commit Checkpointing, Logging, Recovery.
Fault Tolerance Chapter 7.
Fault Tolerance. Basic Concepts Availability The system is ready to work immediately Reliability The system can run continuously Safety When the system.
Reliable Communication Smita Hiremath CSC Reliable Client-Server Communication Point-to-Point communication Established by TCP Masks omission failure,
Chapter 11 Fault Tolerance. Topics Introduction Process Resilience Reliable Group Communication Recovery.
CS 6401 Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
Fault Tolerance Chapter 7. Basic Concepts Dependability Includes Availability Reliability Safety Maintainability.
Network Security Celia Li Computer Science and Engineering York University.
Fault Tolerance Chapter 7. Goal An important goal in distributed systems design is to construct the system in such a way that it can automatically recover.
EE 122: Lecture 24 (Security) Ion Stoica December 4, 2001.
Fault Tolerance (2). Topics r Reliable Group Communication.
9.2 SECURE CHANNELS JEJI RAMCHAND VEDULLAPALLI. Content Introduction Authentication Message Integrity and Confidentiality Secure Group Communications.
6.033 Quiz3 Review Spring How can we achieve security? Authenticate agent’s identity Verify the integrity of the request Check the agent’s authorization.
Pertemuan #8 Key Management Kuliah Pengaman Jaringan.
Department of Computer Science Chapter 5 Introduction to Cryptography Semester 1.
Chapter 8 Fault Tolerance. Outline Introductions –Concepts –Failure models –Redundancy Process resilience –Groups and failure masking –Distributed agreement.
Fault Tolerance Chap 7.
Basics of Cryptography
Security Outline Encryption Algorithms Authentication Protocols
Advanced Computer Networks
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Last Class: Fault Tolerance
Presentation transcript:

1 CS 194: Distributed Systems Review Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA

2 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication  Distributed commit  Security

3 Example: Local Procedure Call. n = sum(4, 7);. sum(i, j) int i, j; { return (i+j); } Machine Process

4 Example: Remote Procedure Call. n = sum(4, 7);. sum(i, j) int i, j; { return (i+j); } Client Process sum 4 7 message OS Server Process sum 4 7 message OS Stubs

5 Client and Server Stubs  Principle of RPC between a client and server program

6 Parameter Passing  Server and client may encode parameters differently -E.g., big endian vs. little endian  How to send parameters “call-by-reference”? -Basically do “call-by-copy/restore” -Woks when there is an array of fixed size -How about arbitrary data structures?

7 RPC Semantics: Discussion  The original goal: provide the same semantics as a local call  Impossible to achieve in a distributed system -Dealing with remote failures fundamentally affects transparency  Ideal interface: balance the easy of use with making visible the errors to users

8 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication  Distributed commit  Security

9 Process vs. Thread  Process: unit of allocation -Resources, privileges, etc  Thread: unit of execution -PC, SP, registers  Each process has one or more threads  Each thread belong to one process

10 Process vs. Thread  Processes -Inter-process communication is expensive: need to context switch -Secure: one process cannot corrupt another process

11 Process vs. Thread  Threads -Inter-thread communication cheap: can use process memory and may not need to context switch -Not secure: a thread can write the memory used by another thread

12 User Level vs. Kernel Level Threads  User level: use user-level thread package; totally transparent to OS -Light-weight -If a thread blocks, all threads in the process block  Kernel level: threads are scheduled by OS -A thread blocking won’t affect other threads in the same process -Can take advantage of multi-processors -Still requires context switch, but cheaper than process context switching

13 Thread Implementation  Combining kernel-level lightweight processes and user-level threads -LWPs are transparent to applications -A thread package can be shared by multiple LWPs -A LWP looks constantly after runnable threads

14 User-level, Kernel-level and Combined (Operating Systems, Stallings)

15 Example of Combined Threads (Operating Systems, Stallings)

16 Trade-offs ModelCharacteristics ThreadsParallelism, blocking system calls Single-threaded processNo parallelism, blocking system calls

17 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication  Distributed commit  Security

18 Agreement in Faulty Systems  Many things can go wrong…  Communication -Message can be lost -Time taken to deliver a message is unbounded -Adversary can intercept messages  Processes -Can fail or collude with other processes to produce wrong results  Agreement very hard, sometime impossible, to achieve!

19 Two-Army Problem  “Two blue armies need to simultaneously attack the white army to win; otherwise they will be defeated. The blue army can communicate only across the area controlled by the white army which can intercept the messengers.”  What is the solution?

20 Byzantine Agreement [Lamport et al. (1982)]  Goal: -Each process learn the true values sent by correct processes  Assumptions: -Every message that is sent is delivered correctly -The receiver knows who sent the message -Message delivery time is bounded

21 Byzantine Agreement Result  In a system with m faulty processes agreement can be achieved only if there are 2m+1 functioning correctly  Note: This result only guarantees that each process receives the true values sent by correct processors, but it does not identify the correct processors!

22 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication -Reliable multicast -Atomic multicast  Distributed commit  Security

23 Reliable Group Communication  Reliable multicast: all non-faulty processes which do not join/leave during communication receive the message  Atomic multicast: all messages are delivered in the same order to all processes

24 Scalable Reliable Multicast (SRM) [Floyd et al ’95]  Receivers use timers to send NACKS and retransmissions -Randomized: prevent implosion -Uses latency estimates Short timer  cause duplicates when there is reordering Long timer  causes excess delay  Any node retransmits -Sender can use its bandwidth more efficiently -Overall group throughput is higher  Duplicate NACK/retransmission suppression

25  Chosen from the uniform distribution on -A – node that lost the packet -S – source -C 1, C 2 – constants -d S,A – latency between source ( S ) and A -i – iteration of repair request tries seen  Algorithm -Detect loss  set timer -Receive request for same data  cancel timer, set new timer -Timer expires  send repair request Repair Request Timer Randomization

26 Timer Randomization  Repair timer similar -Every node that receives repair request sets repair timer -Latency estimate is between node and node requesting repair -Use following formula: D 1, D 2 – constants d R,A – latency between node requesting repair ( R ) and A  Timer properties – minimize probability of duplicate packets -Reduce likelihood of implosion (duplicates still possible) -Reduce delay to repair

27 Chain Topology  C 1 = D 1 = 1, C 2 = D 2 = 0  timers = 1, 1  All link distances are 1 L2 L1 R1 R2 R3 source data out of order data/repair request repair request TO repair TO request repair

28 Star Topology  C 1 = D 1 = 0,  timers = [0, 2C 2 ], [0, 2D 2 ]  Tradeoff between (1) number of requests and (2) time to receive the repair  C 2 <= 1 -E(# of requests) = g –1  C 2 > 1 -E(# of requests) = 1 + (g-2)/C 2 -E(time until first timer expires) = 2C 2 /g  -E(# of requests) = -E(time until first timer expires) = N1 N2 N3 N4 Ng source

29 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication -Reliable multicast  Atomic multicast  Distributed commit  Security

30 Atomic Multicast  All messages are delivered in the same order to “all” processes  Group view: the set of processes known by the sender when it multicast the message  Virtual synchronous multicast: a message m multicast to a group view G is delivered to all non-faulty processes in G -If sender fails “before” m reaches a non-faulty process, none of the processes deliver m

31 Virtual Synchrony System Model  The logical organization of a distributed system to distinguish between message receipt and message delivery

32 Virtual Synchronous Multicast a) Message is not delivered A B C G i = (A, B, C)G i+1 = (B, C) b) Message is delivered A B C G i = (A, B, C)G i+1 = (B, C)

33 Virtual Synchronous Multicast a) Message is not delivered A B C G i = (A, B, C)G i+1 = (B, C) b) Message is not delivered A B C G i = (A, B, C)G i+1 = (B, C)

34 Virtual Synchrony Implementation: [Birman et al., 1991]  Only stable messages are delivered  Stable message: a message received by all processes in the message’s group view  Assumptions (can be ensured by using TCP): -Point-to-point communication is reliable -Point-to-point communication ensures FIFO-ordering

35 Virtual Synchrony Implementation: Example  G i = {P1, P2, P3, P4, P5}  P5 fails  P1 detects that P5 has failed  P1 send a “view change” message to every process in G i+1 = {P1, P2, P3, P4} P1 P2 P3 P4 P5 change view

36 Virtual Synchrony Implementation: Example  Every process -Send each unstable message m from G i to members in G i+1 -Marks m as being stable -Send a flush message to mark that all unstable messages have been sent P1 P2 P3 P4 P5 unstable message flush message

37 Virtual Synchrony Implementation: Example  Every process -After receiving a flush message from any process in G i+1 installs G i+1 P1 P2 P3 P4 P5

38 Message Ordering and Atomicity MulticastBasic Message OrderingTotal-ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes

39 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication  Distributed commit  Security

40 Distributed Commit  Goal: Either all members of a group decide to perform an operation, or none of them perform the operation

41 Assumptions  Failures: -Crash failures that can be recovered -Communication failures detectable by timeouts  Notes: -Commit requires a set of processes to agree… -…similar to the Byzantine general problem… -… but the solution much simpler because stronger assumptions

42 Two Phase Commit (2PC) send VOTE_REQ to all send vote to coordinator if (vote == no) decide abort halt if (all votes yes) decide commit send COMMIT to all else decide abort send ABORT to all who voted yes halt if receive ABORT, decide abort else decide commit halt Coordinator Participants

43 2PC State Machine a) The finite state machine for the coordinator in 2PC b) The finite state machine for a participant

44 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication  Distributed commit  Security  Cryptographic Algorithms (Confidentiality and Integrity) -Authentication

45 Security Requirements  Authentication: ensures that sender and receiver are who they are claiming to be  Data integrity: ensure that data is not changed from source to destination  Confidentiality: ensures that data is red only by authorized users  Non-repudiation: ensures that the sender has strong evidence that the receiver has received the message, and the receiver has strong evidence of the sender identity (not discussed here) -The sender cannot deny that it has sent the message and the receiver cannot deny that it has received the message

46 Cryptographic Algorithms  Security foundation: cryptographic algorithms -Secret key cryptography, Data Encryption Standard (DES) -Public key cryptography, RSA algorithm -Message digest, MD5

47 Symmetric Key  Both the sender and the receiver use the same secret keys Internet Encrypt with secret key Decrypt with secret key Plaintext Ciphertext

48 Encrypting Larger Messages  Initialization Vector (IV) is a random number generated by sender and sent together with the ciphertext + Block 1 Cipher 1 DES + Block 2 DES + Block 3 DES + Block 4 DES Cipher 2 Cipher 3 Cipher 4 IV

49 DES Properties  Provide confidentiality -No mathematical proof, but practical evidence suggests that decrypting a message without knowing the key requires exhaustive search -To increase security use triple-DES, i.e., encrypt the message three times

50 Public-Key Cryptography: RSA (Rivest, Shamir, and Adleman)  Sender uses a public key -Advertised to everyone  Receiver uses a private key Internet Encrypt with public key Decrypt with private key Plaintext Ciphertext

51 Digital Signature  In practice someone cannot alter the message without modifying the digest -Digest operation very hard to invert  Encrypt digest with sender’s private key  K A -, K A + : private and public keys of A

52 Digital Signature Properties  Integrity: an attacker cannot change the message without knowing A’s private key  Confidentiality: if needed, encrypt message with B’s public key

53 Overview  Remote Procedure Call (RPC)  Threads  Agreement  Group communication  Distributed commit  Security Cryptographic Algorithms (Confidentiality and Integrity)  Authentication

54 Authentication  Goal: Make sure that the sender an receiver are the ones they claim to be  Solutions based on secret key cryptography (e.g., DES) -Three-way handshaking -Trusted third party (key distribution center)  One solution based on public key cryptography (e.g., RSA) -Public key authentication

55 Authentication  Authentication based on a shared secret key -A, B: sender and receiver identities -K A,B : shared secret key -R A,R B : random keys exchanged by A and B to verify identities Alice Bob A 1 RBRB 23 K A,B (R B ) RARA 45 K A,B (R A )

56 Authentication using KDC (Basic Protocol)  KDC – Key Distribution Center  Maintain only N keys in the system: one for each node Alice Bob A, B 1 KDC (generates K A,B ) 2 K A,KDC (K A,B )K B,KDC (K A,B ) 2

57 Authentication using KDC (Ticket Based)  No need for KDC to contact Bob Alice Bob A, B 1 KDC 2 K A,KDC (K A,B ), 3 K B,KDC (K A,B ) A, K B,KDC (K A,B )  Vulnerable to replay attacks if Chuck gets hold on K B,KDC old

58 Authentication Using Public-Key Cryptography  K A +, K B + : public keys Alice Bob K B + (A, R A ) 1 2 K A + (R A, R B,K A,B ) 3 K A,B (R B )

59 Midterm Information  Closed books; 8,5”x11” crib sheet (both sides)  No calculators, PDAs, cell phones with cameras, etc  Please use PENCIL and ERASER  Expect also questions from project (e.g., XML-RMI)