RetroFed Forum
Your home away from modern life.
I built a minimalist SPA tool using eBPF/XDP to keep ports invisible. First project in Go!
Post Reply
AuthorMessage
lucy lemy.nl lucy@lemy.nl
Joined: 2026-03-19
Quote

Hi guys,
I wanted to share a project I’ve been working on called xSpa. It's an implementation of Single Packet Authorization that works at the XDP level.

I built this because I wanted something faster and more DDoS-resilient than traditional port-knocking or SPA tools that rely on userspace processing or iptables. Here, the "drop-all" logic happens right at the driver level.

Key bits:

 L1 verification (SipHash) in kernel space.

 L2 (ChaCha20-Poly1305) in Go userspace.

 It uses the eBPF ring buffer for communication.

This is my first Go project and my first shot at Open Source. I’m still a bit of a noob when it comes to kernel-level programming, so I’d love to get some feedback on the architecture and security. If anyone has time to check the code, I’d love to hear your thoughts on how to make it better.

14   Original
db2 lemmy.world db2@lemmy.world
Joined: 2023-07-29
#2 · Quote Reply

What if any role did "AI" play in this project?

2
org lemmy.org org@lemmy.org
Joined: 2026-03-15
#3 · Quote Reply

What if any role did "AI" play in this project?

You mean, you don’t use “init” for all your commits?

5
lucy lemy.nl lucy@lemy.nl
Joined: 2026-03-19
#4 · Quote Reply

What if any role did "AI" play in this project?

I used AI to help with the eBPF parts since it's a new and complex topic for me. It also helped me translate the README and polish this post because English isn't my first language

2
lucy lemy.nl lucy@lemy.nl
Joined: 2026-03-19
#5 · Quote Reply

You mean, you don’t use “init” for all your commits?

caught me!
still learning the 'professional' way to do things. at least it's better than 'fix1', 'fix2', 'asdfgh'..

2
non_burglar lemmy.world non_burglar@lemmy.world
Joined: 2023-06-16
#6 · Quote Reply

Sorry, I'm failing to understand what this does, mostly because your description is mixing tcpip, socket, and xdp terminology.

It's an implementation of Single Packet Authorization that works at the XDP level.

Sure, but to do what, exactly? Is this meant to run on Linux routers as a prefilter? Or on hosts themselves? In the second case, why not just use 802.11x?

I don't get the use case, or what this has to do with DDOS.

1
org lemmy.org org@lemmy.org
Joined: 2026-03-15
#7 · Quote Reply

caught me! still learning the 'professional' way to do things. at least it's better than 'fix1', 'fix2', 'asdfgh'..

“Be sure to commit with a descriptive message after each change”

Assuming you didn’t one-and-done this. Please tell me you didn’t.

1
lucy lemy.nl lucy@lemy.nl
Joined: 2026-03-19
#8 · Quote Reply

Sorry, I'm failing to understand what this does, mostly because your description is mixing tcpip, socket, and xdp terminology. It's an implementation of Single Packet Authorization that works at the XDP level. Sure, but to do what, exactly? Is this meant to run on Linux routers as a prefilter? Or on hosts themselves? In the second case, why not just use 802.11x? I don't get the use case, or wha...

Thanks for the feedback! You’re right, my description was a bit messy. Let me clarify the goal and the use case

The goal to make a VPS on the public internet completely invisible to unauthorized scans while allowing access to services (like SSH) only after a valid SPA packet is received

Traditional SPA tools (like fwknop) often use libpcap to sniff packets or iptables to block them. In both cases, unauthorized packets still hit the kernel network stack. If an attacker floods the port with junk, the kernel still spends CPU cycles processing them before they get dropped

By using XDP, I move the "drop-all" logic to the earliest possible stage. This is where the DDoS resilience comes from we drop unauthorized traffic before sk_buff allocation, making it significantly cheaper in terms of CPU resources

It’s designed to run on the host itself, acting as a "stealth" firewall

A major advantage here is that xSpa doesn't touch the netfilter/iptables stack. Unlike fwknop, which has to dynamically manage firewall rules (often leading to conflicts with Docker, UFW, or complex rulesets), xSpa operates at a lower level. It’s completely independent of whatever you have going on in your iptables configuration

And you can’t use 802.1X to protect an SSH port on a public cloud VPS

3
lucy lemy.nl lucy@lemy.nl
Joined: 2026-03-19
#9 · Quote Reply

“Be sure to commit with a descriptive message after each change” Assuming you didn’t one-and-done this. Please tell me you didn’t.

I got in the zone :)

2
non_burglar lemmy.world non_burglar@lemmy.world
Joined: 2023-06-16
#10 · Quote Reply

Thanks for the feedback! You’re right, my description was a bit messy. Let me clarify the goal and the use case The goal to make a VPS on the public internet completely invisible to unauthorized scans while allowing access to services (like SSH) only after a valid SPA packet is received Traditional SPA tools (like fwknop) often use libpcap to sniff packets or iptables to block them. In both cas...

How does it route an xdp packet across an IP network of unknown hops? I thought xdp required the same broadcast domain for hosts to be able to use it.

1
fruitycoder sh.itjust.works fruitycoder@sh.itjust.works
Joined: 2023-08-11
#11 · Quote Reply

How have tests gone so far?

also cool concept, you can actually get eBPF XDP to compile to FPGA on some smart NICs even further pushing it away from the core system if it works!

1
Post Reply
Back to top