Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esonhugh/my_durdur
Cilium/ebpf Learning idea from boratanrikulu/durdur
https://github.com/esonhugh/my_durdur
dropper ebpf
Last synced: about 1 month ago
JSON representation
Cilium/ebpf Learning idea from boratanrikulu/durdur
- Host: GitHub
- URL: https://github.com/esonhugh/my_durdur
- Owner: Esonhugh
- License: gpl-3.0
- Created: 2022-12-31T09:07:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-11T08:04:43.000Z (9 months ago)
- Last Synced: 2024-04-11T23:55:59.353Z (9 months ago)
- Topics: dropper, ebpf
- Language: Go
- Homepage:
- Size: 157 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Durdur
[Durdur](https://www.youtube.com/watch?v=sF0QweCoaMo) is a CLI tool for Linux implementing L4 package dropping with eBPF/Go (proof of concept).
## How to install
### From source;
Build and use `build/durdur` binary.
```
make build
```## How to Use
```shell
# ./build/durdur help
Durdur is a L4 package Dropper/Firewall.Usage:
durdur [command]Available Commands:
attach Attaches the program to the network.
completion Generate the autocompletion script for the specified shell
detach Detaches the program from the network.
drop Add new IP/port to the maps.
help Help about any command
list List all the rules
log print logs of dropping data
undrop Add new IP/port to the maps.Flags:
-b, --bpffs string mounted bpffs location (default "/sys/fs/bpf")
-d, --debug Enable debug mode
-h, --help help for durdurUse "durdur [command] --help" for more information about a command.
```### Attach to interface
```shell
./build/durdur attach -i eth0 -d
INFO[0000] Trying to attach XDP and TC eBPF program to the eth0.
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
```### Detach from interface
```shell
./build/durdur detach
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
INFO[0000] Detached from the network.
```### Add a drop rule
```shell
# ./build/durdur drop --dst -i 198.19.249.98 -p 8000
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
INFO[0000] MapOperation: add dst 198.19.249.98 8000
# ./build/durdur drop --dst -i 198.19.249.97
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
INFO[0000] MapOperation: add dst 198.19.249.97 0
# ./build/durdur drop --src -i 198.19.249.97
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
INFO[0000] MapOperation: add src 198.19.249.97 0
```### List all rules
```shell
# ./build/durdur list
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
INFO[0000] --ingress-> world 198.19.249.97:any hint-rule:0
INFO[0000] world <-egress-- 198.19.249.97:any hint-rule:0
INFO[0000] world <-egress-- 198.19.249.98:8000 hint-rule:0
```### Del a drop rule
```shell
# ./build/durdur undrop --src -i 198.19.249.97
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
INFO[0000] MapOperation: del src 198.19.249.97 0
```### Print logs
```shell
# ./build/durdur log
INFO[0000] Load XDP eBPF program successfully
INFO[0000] Load TC eBPF program successfully
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:46279 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:5790 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:5790 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:5790 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:5790 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:5790 to 198.19.249.98:16415
Dropped Packect from 198.19.249.193:5790 to 198.19.249.98:16415
```## Copyright
[GPL-3.0 license](https://github.com/boratanrikulu/durdur/blob/main/LICENSE),
Copyright 2022 Bora Tanrikulu <[[email protected]](mailto:[email protected])>
Copyright 2024 Esonhugh <[[email protected]](mailto:[email protected])>