cujo safe browsing with lua
play

CUJO - Safe Browsing with Lua Lourival Vieira Neto - PowerPoint PPT Presentation

CUJO - Safe Browsing with Lua Lourival Vieira Neto <lourival.neto@getcujo.com> Introduction CUJO Smart Firewall Safe Browsing Parental Controls Introduction CUJO Firmware Team Gabriel Ligneul Iruat


  1. CUJO - Safe Browsing with Lua Lourival Vieira Neto <lourival.neto@getcujo.com>

  2. Introduction CUJO ➔ Smart Firewall ◆ Safe Browsing ◆ Parental Controls ◆

  3. Introduction CUJO Firmware Team ➔ Gabriel Ligneul ◆ Iruatã Souza ◆ Katia Fernandes ◆ Linas Nenorta ◆ Lourival Vieira Neto ◆ Marcel Moura ◆ Savio Barbosa ◆ Tadeu Bastos ◆ Pedro Tammela ◆

  4. Introduction Lunatik ➔ Lua in the Linux Kernel ◆ "Scriptable Operating Systems with Lua" ◆ Vieira Neto, L., Ierusalimschy, R., de Moura, A.L. and Balmer, M. ● Luadata ➔ “Zero-copy” ◆ NFLua ➔ Netfilter Binding ◆

  5. Safe Browsing Components ➔ Cloud Agent Iptables threatd User space Kernel nf.lua NFLua nf_http.lua Netfilter nf_ssl.lua Lunatik nf_threat.lua nf_safebro.lua NIC Luadata Luajson Driver (zero copy)

  6. Safe Browsing Configuration ➔ safebro.json Cloud Agent Iptables threatd User space Kernel nf.lua NFLua nf_http.lua Netfilter nf_ssl.lua Lunatik nf_threat.lua nf_safebro.lua NIC Luadata Luajson Driver (zero copy)

  7. Safe Browsing Configuration ➔ safebro.json Cloud Agent Lua chunk Iptables threatd User space Kernel nf.lua NFLua nf_http.lua Netfilter nf_ssl.lua Lunatik nf_threat.lua nf_safebro.lua NIC Luadata Luajson Driver (zero copy)

  8. Safe Browsing Configuration ➔ safebro.json Cloud Agent Lua chunk Iptables threatd User space Kernel nf.lua NFLua nf_http.lua Netfilter nf_ssl.lua Lunatik Load config nf_threat.lua nf_safebro.lua NIC Luadata Luajson Driver (zero copy)

  9. Safe Browsing Configuration ➔ # cat nf_{threat,safebro,http,ssl}.lua > /proc/nf_lua # iptables -A FORWARD -p tcp --dport 80 --tcp-flags PSH PSH \ -m lua --function nf_http -j DROP # iptables -A FORWARD -p tcp --dport 443 --tcp-flags PSH PSH \ -m lua --function nf_ssl -j REJECT --reject-with tcp-reset

  10. Safe Browsing Configuration ➔ threatd.lua

  11. Safe Browsing Configuration ➔ xt_lua.c

  12. Safe Browsing Configuration ➔ nf_safebro.lua

  13. Safe Browsing Filter ➔ Cloud Agent Iptables threatd User space Kernel nf.lua NFLua nf_http.lua Netfilter n f l u nf_ssl.lua a TCP PSH _ Lunatik m nf_threat.lua a Cached? t c h No nf_safebro.lua NIC Luadata Luajson Driver (zero copy)

  14. Safe Browsing Filter ➔ Cloud Agent Iptables threatd p u k o o L User space Kernel nf.lua NFLua nf_http.lua Netfilter n f l u nf_ssl.lua a TCP PSH _ Lunatik m nf_threat.lua a Cached? t c h No nf_safebro.lua NIC Hot drop Luadata Luajson Driver (zero copy)

  15. Safe Browsing Reputation/ Category Cloud Decision Filter ➔ Cloud Lookup Agent Iptables threatd p u k o o L User space Kernel nf.lua NFLua nf_http.lua Netfilter n f l u nf_ssl.lua a TCP PSH _ Lunatik m nf_threat.lua a Cached? t c h No nf_safebro.lua NIC Hot drop Luadata Luajson Driver (zero copy)

  16. Safe Browsing Reputation/ Filter ➔ Category Cloud Decision Cloud Lookup Agent e h c a c o t Iptables d threatd d p A u k o o L User space Kernel nf.lua NFLua nf_http.lua Netfilter n f l u nf_ssl.lua a TCP PSH _ Lunatik m nf_threat.lua a Cached? t c h No nf_safebro.lua NIC Hot drop Luadata Luajson Driver (zero copy)

  17. Safe Browsing Filter ➔ Cloud Agent Iptables threatd User space Kernel nflua_match nf.lua NFLua nf_http.lua Netfilter TCP retransmission nf_ssl.lua Lunatik nf_threat.lua Cached? Yes nf_safebro.lua NIC Luadata Luajson Driver (zero copy)

  18. Safe Browsing Filter ➔ Cloud Agent Iptables threatd User space Kernel nflua_match nf.lua NFLua nf_http.lua Netfilter TCP retransmission nf_ssl.lua Lunatik nf_threat.lua Cached? TCP reply A c B Yes c nf_safebro.lua l o e c p NIC k t Luadata / p Luajson a g Driver (zero copy) e

  19. Safe Browsing Filter ➔ xt_lua.c

  20. Safe Browsing Filter ➔ xt_lua.c

  21. Safe Browsing Filter ➔ nf_http.lua

  22. Safe Browsing Filter ➔ nf.lua

  23. Safe Browsing Filter ➔ nf_ssl.lua

  24. Safe Browsing Filter ➔ nf_ssl.lua

  25. Safe Browsing Filter ➔ nf_http.lua

  26. Safe Browsing Filter ➔ Block page

  27. Why Lua? Extensible Extension Language ➔ Embeddable and Extensible ◆ C Library ◆ Almost Freestanding ➔ Small Footprint ➔ ~250 KB ◆ Fast ➔ MIT License ➔

  28. Why Lua? Ease of Development ➔ High-level Language ➔ Dynamically Typed ➔ Domain-specific API ➔

  29. Why Lua? Safety ➔ Automatic Memory Management ➔ Protected Call ➔ Fully Isolated States ➔ Cap the Number of Executed Instructions ➔ Test Suite ➔

  30. Why Lua? Security ➔ ● A single vulnerability disclosed since 1993

  31. Benchmarks Tinyproxy ➔ ~150 Mbps ◆ CPU Bound ◆ NFLua ➔ Slow Path: ~500 Mbps ◆ Fast Path: ~750 Mbps ◆ Not CPU Bound ◆ Bypass ➔ ~890 Mbps ◆ Online Units: ~5.5 k ➔

Recommend


More recommend