Skip to content

Linux firewall powered by Zig (tw4452852/zbpf) & eBPF & XDP

License

Notifications You must be signed in to change notification settings

Hevienz/ZealFirewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZealFirewall

Linux firewall powered by eBPF and XDP written in Zig.

Requirements

  • zig-linux-x86_64-0.14.0-dev.3456+00a8742bb
  • Linux Kernel 6.6+

Support feature

  • IPv4
  • IPv6
  • TCP
  • UDP
  • ICMP

Usage

Clone zbpf.

Put this repo in zbpf.

Add dependencies in build.zig.zon and build.zig.

zig build ZealFirewall
# change lo if you need
sudo ./ZealFirewall -i lo

API

Get all rules

GET /api/v1/rules

Add rule

POST /api/v1/rule

{
    "src_addr": "127.0.0.1",
    "dst_port": 8000,
    "ip_proto": 6
}

Proto 6 is TCP

{
    "src_addr": "127.0.0.1",
    "dst_port": 8000,
    "ip_proto": 17
}

Proto 17 is UDP

Get rule

GET /api/v1/rule

{
    "src_addr": "127.0.0.1",
    "dst_port": 8000,
    "ip_proto": 6
}

Delete rule

DELETE /api/v1/rule

{
    "src_addr": "127.0.0.1",
    "dst_port": 8000,
    "ip_proto": 6
}

Reference

EtherType

IPv4

IPv6

IP protocol numbers

TCP

UDP

About

Linux firewall powered by Zig (tw4452852/zbpf) & eBPF & XDP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages