broker
play

Broker Matthias Vallentin UC Berkeley International Computer - PowerPoint PPT Presentation

Broker Matthias Vallentin UC Berkeley International Computer Science Institute (ICSI) BroCon '16 Communication in Bro Tap Internal Internet Firewall Tap Network Frontend Nodes Manager + Proxy + ... ... Proxy Backend Nodes


  1. Broker Matthias Vallentin UC Berkeley International Computer Science Institute (ICSI) BroCon '16

  2. Communication in Bro Tap Internal Internet Firewall Tap Network Frontend Nodes Manager + Proxy + ... ... Proxy Backend Nodes Broccoli, Python Ruby & Perl Bro Independent Bindings Bindings Cluster Broccoli Broccoli State 2005 2007 2008 2011

  3. Communication in Bro Exploiting Independent State For Network Intrusion Detection Tap Internal Internet Firewall Tap Network Robin Sommer Vern Paxson Frontend Nodes TU M¨ unchen ICSI/LBNL Manager sommer@in.tum.de vern@icir.org + Proxy + coming ... ... Proxy Backend Nodes soon! Broccoli, Abstract in the context of a single process is a minor subset of the Python Ruby & Perl NIDS process’s full state: either higher-level results (often Bro just alerts) sent between processes to facilitate correlation or Broker Broker Network intrusion detection systems (NIDSs) critically Independent Bindings Bindings aggregation, or log files written to disk for processing in the rely on processing a great deal of state. Often much of this future. The much richer (and bulkier) internal state of the state resides solely in the volatile processor memory acces- Cluster Broccoli Broccoli 0.4 1.0 NIDS remains exactly that, internal. It cannot be accessed State sible to a single user-level process on a single machine. In by other processes unless a special means is provided for this work we highlight the power of independent state , i.e., doing so, and it is permanently lost upon termination of the internal fine-grained state that can be propagated from one 2005 2007 2008 2015 2016/17 2011

  4. Outline • Overview • API • Performance • Outlook

  5. Overview

  6. Broker = Bro'ish data model + publish/subscribe communication + distributed key-value stores

  7. Publish/Subscribe Communication Organization Internet

  8. Publish/Subscribe Communication C++ C++ C++ Organization Internet

  9. Publish/Subscribe Communication C++ Model Model Model C++ C++ Organization Internet

  10. Publish/Subscribe Communication C++ Model Model Model C++ C++ Organization Internet

  11. Publish/Subscribe Communication C++ C++ C++ Organization Internet Model Model Model

  12. Publish/Subscribe Communication C++ C++ C++ Organization Internet

  13. Publish/Subscribe Communication C++ C++ C++ File File File Organization Internet

  14. Publish/Subscribe Communication C++ C++ C++ File File File Organization Internet

  15. Publish/Subscribe Communication C++ File C++ File C++ File Organization Internet

  16. Publish/Subscribe Communication C++ C++ C++ Result Organization Internet

  17. Publish/Subscribe Communication C++ C++ C++ Result Organization Internet

  18. Publish/Subscribe Communication C++ Result C++ C++ Organization Internet

  19. Distributed Key-Value Stores M C C C M endpoint master M C C clone C

  20. Broker's Data Model Arithmetic Network Container Other Time none address vector boolean interval port set string count timestamp subnet table integer real

  21. API

  22. Lessons Learned • Functionality : It Just Works • Usability : no native type support, lots of "data wrapping" • Semantics : no support for nonblocking processing

  23. Current API using&namespace&broker; Initialize the Broker library. (Only one broker instance per process allowed.) init(); endpoint&ep{"sender"}; Create a local endpoint. ep.peer("127.0.0.1",&9999); Block until connection status changes. ep.outgoing_connection_status().need_pop(); auto&msg&=&message{ When communicating with Bro, the first &&"my_event", argument must be a string identifying the event &&"Hello&C++&Broker!", name. The remaining values represent the event &&42u arguments. }; Publish the event under topic bro/event . ep.send("bro/event",&msg); Block until connection status changes. ep.outgoing_connection_status().need_pop();

  24. New API using&namespace&broker; A context encapsulates global state for a set of context&ctx; endpoints (e.g., worker threads, scheduler, etc.) auto&ep&=&ctx.spawn<blocking>(); Create a local endpoint with blocking API. ep.peer("127.0.0.1",&9999); auto&v&=&vector{ Create a vector of data. &&"my_event", New semantics: a message is a topic plus data , not a sequence of data. &&"Hello&C++&Broker!", &&42u }; Publish the event under topic bro/event . ep.publish("bro/event",&v);

  25. Blocking vs. Non-Blocking API context&ctx; context&ctx; auto&ep&=&ctx.spawn<blocking>(); auto&ep&=&ctx.spawn<nonblocking>(); ep.subscribe("foo"); //&Called&asynchronously&by&the&runtime. ep.subscribe("bar"); ep.subscribe( &&"foo", //&Block&and&wait. &&[=](const&topic&&t,&const&data&&d)&{ auto&msg&=&ep.receive(); &&&&cout&<<&t&<<&"&Q>&"&<<&d&<<&endl; cout&<<&msg.topic() &&} &&&&&<<&"&Q>&" ); &&&&&<<&msg.data() &&&&&<<&endl; //&As&above,&just&for&a&different&topic. ep.subscribe( //&Equivalent&semantics;&functional&API.& &&"bar", ep.receive( &&[=](const&topic&&t,&const&data&&d)&{ &&[&](const&topic&&t,&const&data&&d)&{ &&&&cout&<<&t&<<&"&Q>&"&<<&d&<<&endl; &&&&scout&<<&t&<<&"&Q>&"&<<&d&<<&endl; &&} &&} ); )

  26. Available backends: Data Store APIs 1. In-memory 2. SQLite 3. RocksDB //&Setup&endpoint&topology. context&ctx; auto&ep0&=&ctx.spawn<blocking>(); auto&ep1&=&ctx.spawn<blocking>(); auto&ep2&=&ctx.spawn<blocking>(); M ep0.peer(ep1); ep0.peer(ep2); //&Attach&stores. auto&m&=&ep0.attach<master,&memory>("lord"); auto&c0&=&ep1.attach<clone>("lord"); auto&c1&=&ep2.attach<clone>("lord"); //&Write&to&the&master&directly. mQ>put("foo",&42); mQ>put("bar",&"baz"); C C //&After&propagation,&query&the&clones. sleep(propagation_delay); auto&v0&=&c0Q>get("key");& auto&v1&=&c1Q>get("key"); assert(v0&&&&v1&&&&*v0&==&*v1);

  27. Data Store APIs // Blocking API. Returns expected<data>. auto v = c->get<blocking>("key"); // Non-blocking API. // Runtime invokes callback. M c->get<nonblocking>("key").then( [=](data& d) { cout << "got it: " << d << endl; }, [=](error& e) { cerr << "uh, this went wrong: " << e << endl; } C C );

  28. Performance

  29. Simple Benchmark • Throughput analysis • Two endpoints: sender & receiver • Message = conn.log entry • System: MacBook Pro • 16 GB RAM • 4 x 2.8 GHz Core i7

  30. Throughput 60K 40% Throughput (msg/sec) 40K 20K 0 new old Version

  31. Outlook

  32. Roadmap to 1.0 function &lookup(key:&string)&:&any;& 1. Finish Python bindings when&(& local &x&=&lookup("key")&)& &&{& && local &result&=&"";& 2. Implement Bro endpoint && switch (&x&)& &&&&{& &&&& case &addr:& 3. Pattern matching in Bro &&&&&& if &(&x&in&10.0.0.0/8&)& &&&&&&&&result&=&"contained";& &&&& case &string:& 4. Flow control &&&&&&result&=&"error:&lookup()&failed:&"&+&x;& &&&&}& &&}

  33. Flow Control

  34. Flow Control Intermediate buffer

  35. Flow Control STILL OVERFLOWING

  36. Flow Control

  37. Flow Control Reject at the boundary

  38. CAF: Messaging Building Block • CAF = C ++ A ctor F ramework • Implementation of the Actor Model • Light-weight, type-safe, scalable • Network transparency

  39. Bro Data Flows Master Events Workers Logs write(2) Packets

  40. Questions? Docs: &https://bro.github.io/broker& Chat: https://gitter.im/bro/broker& Code: https://github.com/bro/broker

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend