Slide 1

Slide 1 text

Building a Lightning Fast Firewall in Java & eBPF Mohammed Aboullaite @laytoun Sr Backend Engineer, Spotify Java Champion Google Developer Expert Johannes Bechberger mostlynerdless.de OpenJDK Developer, SAP Creator of hello-ebpf

Slide 2

Slide 2 text

We have a simple web application

Slide 3

Slide 3 text

We have a simple web application DDoS Attack

Slide 4

Slide 4 text

The naïve way?

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Drop packets in your application

Slide 7

Slide 7 text

Any Problems?

Slide 8

Slide 8 text

Sockets https://mostlynerdless.de/blog/2024/08/13/hello-ebpf-a-packet-logger-in-pure-java-using-tc-and-xdp-hooks-13/

Slide 9

Slide 9 text

Alternative: Use a Firewall

Slide 10

Slide 10 text

How to improve it?

Slide 11

Slide 11 text

https://blog.cloudflare.com/how-to-drop-10-million-packets/

Slide 12

Slide 12 text

Become a 10x Firewall

Slide 13

Slide 13 text

vs https://blog.cloudflare.com/how-to-drop-10-million-packets/

Slide 14

Slide 14 text

Sockets Allocations XDP

Slide 15

Slide 15 text

https://blog.cloudflare.com/how-to-drop-10-million-packets/ vs even faster with offloading

Slide 16

Slide 16 text

Option 1: Change Kernel Traditional ways Option 2: Kernel Module

Slide 17

Slide 17 text

Greg Kroah-Hartman “ https://www.kernel.org/doc/html/latest/process/stable-api-nonsense.html https://www.youtube.com/watch?v=agC5N9I6jRE You think you want a stable kernel interface, but you really do not, and you don’t even know it.

Slide 18

Slide 18 text

Option 1: Change Kernel Traditional ways Option 2: Kernel Module

Slide 19

Slide 19 text

Can we do better?

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

eBPF is a crazy technology, it’s like putting JavaScript into the Linux kernel Brendan Gregg “ https://www.youtube.com/watch?v=tDacjrSCeq4

Slide 22

Slide 22 text

https://www.facesofopensource.com/brendan-gregg/ eBPF is a crazy technology, it’s like putting JavaScript into the Linux kernel “ Brendan Gregg

Slide 23

Slide 23 text

eBPF is making the Linux Kernel programmable at native execution speed!

Slide 24

Slide 24 text

eBPF runtime

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

eBPF runtime Safety and Security Efficiency Continuous delivery Standard

Slide 28

Slide 28 text

How to share data? https://mostlynerdless.de/blog/2024/01/12/hello-ebpf-recording-data-in-basic-ebpf-maps-2/

Slide 29

Slide 29 text

How to share data? Any Problems?

Slide 30

Slide 30 text

How to share data? https://mostlynerdless.de/blog/2024/01/12/hello-ebpf-recording-data-in-basic-ebpf-maps-2/

Slide 31

Slide 31 text

eBPF Maps

Slide 32

Slide 32 text

eBPF Maps Map Types ● (LRU) Hash Maps ● Arrays ● Ring Buffers ● … https://mostlynerdless.de/blog/2024/03/12/hello-ebpf-ring-buffers-in-libbpf-6/

Slide 33

Slide 33 text

eBPF hooks https://ebpf.io/what-is-ebpf/

Slide 34

Slide 34 text

Tracing & Profiling

Slide 35

Slide 35 text

Observability and Monitoring https://coralogix.com/blog/what-ebpf-why-important-for-observability/

Slide 36

Slide 36 text

Security Control https://coralogix.com/blog/what-ebpf-why-important-for-observability/ https://ubuntu.com/wp-content/uploads/1e80/AppArmour.png

Slide 37

Slide 37 text

https://commons.wikimedia.org/wiki/File:CrowdStrike_BSOD_at_LGA.jpg

Slide 38

Slide 38 text

eBPF has bugs too (and kernel level access) https://nvd.nist.gov/vuln/

Slide 39

Slide 39 text

eBPF Ecosystem https://ebpf.io

Slide 40

Slide 40 text

https://github.com/parttimenerd/hello-ebpf eBPF Ecosystem

Slide 41

Slide 41 text

eBPF is a crazy technology, it’s like putting JavaScript into the Linux kernel https://www.youtube.com/watch?v=tDacjrSCeq4 “ Brendan Gregg

Slide 42

Slide 42 text

eBPF is a crazy technology, it’s like putting JavaScript into the Linux kernel https://www.youtube.com/watch?v=tDacjrSCeq4 “ Brendan Gregg

Slide 43

Slide 43 text

https://www.youtube.com/watch?v=X3AWV5lJ6RY

Slide 44

Slide 44 text

https://www.youtube.com/watch?v=X3AWV5lJ6RY user land

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Work in Progress

Slide 47

Slide 47 text

Live Coding

Slide 48

Slide 48 text

Live Coding Having fun with eBPF

Slide 49

Slide 49 text

Firewall Demo

Slide 50

Slide 50 text

XDP https://mostlynerdless.de/blog/2024/04/22/hello-ebpf-xdp-based-packet-filter-9

Slide 51

Slide 51 text

Sockets XDP

Slide 52

Slide 52 text

XDP https://mostlynerdless.de/blog/2024/04/22/hello-ebpf-xdp-based-packet-filter-9

Slide 53

Slide 53 text

The only way of disco- vering the limits of the possible is to venture a little way past them into the impossible. Clarke’s second law “ https://www.flickr.com/photos/itupictures/16636142906

Slide 54

Slide 54 text

Project Panama

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

And for the compiler nerds https://godbolt.org/z/9xoMzsc4b

Slide 57

Slide 57 text

Blog Posts A post every other week since January

Slide 58

Slide 58 text

A glimpse into the future Java as a first class language for eBPF

Slide 59

Slide 59 text

A glimpse into the future https://www.infoq.com/presentations/facebook-google-bpf-linux-kernel/ https://en.wikipedia.org/wiki/File:Pistachio_macro_whitebackground_NS.jpg Towards a Micro-Kernel

Slide 60

Slide 60 text

A glimpse into the future Kernel Fixes Reimagined https://www.infoq.com/presentations/facebook-google-bpf-linux-kernel/

Slide 61

Slide 61 text

A glimpse into the future Kernel Recipes 2023 - sched_ext: pluggable scheduling in the Linux kernel

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Final thoughts!

Slide 64

Slide 64 text

Thank you Mohammed Aboullaite @laytoun [email protected] Thanks to Dylan Reimerink Resources Johannes Bechberger mostlynerdless.de @parttimen3rd @[email protected]