Linux Application Firewall with eBPF
Exit Gate is an elaborate OpenSnitch-like application firewall for Linux that uses eBPF for kernel-level network monitoring, Rust for the daemon backend, and Electron for the desktop GUI.
- eBPF-based monitoring: Kernel-level network connection tracking
- Interactive prompts: Allow/deny connection requests in real-time
- Rule engine: Priority-based rules with multiple criteria (process, port, domain, user)
- Modern GUI: React + Material-UI desktop application
- SQLite database: Persistent rules and connection history
- Process tracking: Identify applications making network connections
┌─────────────────┐
│ Electron GUI │ (React + TypeScript + Material-UI)
└────────┬────────┘
│ Unix Socket (JSON IPC)
┌────────┴────────┐
│ Rust Daemon │ (Tokio + SQLite + Rule Engine)
└────────┬────────┘
│ Ring Buffer
┌────────┴────────┐
│ eBPF Programs │ (Kernel probes on tcp_connect/accept)
└─────────────────┘
- Rust 1.70+ with Cargo
- Node.js 18+ with npm
- Clang/LLVM for eBPF compilation
- Linux headers for eBPF
sudo apt install clang llvm linux-headers-$(uname -r)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install nodejssudo dnf install clang llvm kernel-devel
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sudo dnf install nodejs- Linux kernel 5.8+ (for eBPF support)
- CAP_BPF or root privileges (daemon only)
# 1. Build all components (eBPF, Rust daemon, Electron app)
make build
# 2. Package the Electron GUI (creates AppImage and .deb)
make package
# 3. Install the daemon (requires root)
sudo make installOr use individual scripts:
./build.sh # Build (as regular user)
./package.sh # Package GUI (as regular user)
sudo ./install.sh # Install daemon (as root)After building:
- eBPF programs:
ebpf/network_monitor.bpf.o(13 KB) - Daemon:
daemon/target/release/exit-gate-daemon(6 MB) - Electron web:
electron/dist/(800 KB)
After packaging:
- AppImage:
electron/dist/Exit Gate-0.1.0.AppImage(429 MB) - Debian package:
electron/dist/exit-gate_0.1.0_amd64.deb(357 MB)
sudo ./install.shThis installs:
/usr/local/bin/exit-gate-daemon- Main daemon/usr/local/lib/exit-gate/bpf/*.o- eBPF programs/etc/exit-gate/config.toml- Configuration/etc/systemd/system/exit-gate.service- Systemd service
Option 1: AppImage (recommended)
# Make executable and run
chmod +x electron/dist/Exit\ Gate-0.1.0.AppImage
./electron/dist/Exit\ Gate-0.1.0.AppImageOption 2: Debian package
sudo dpkg -i electron/dist/exit-gate_0.1.0_amd64.deb# Start the service
sudo systemctl start exit-gate
# Enable auto-start on boot
sudo systemctl enable exit-gate
# Check status
sudo systemctl status exit-gate
# View logs
sudo journalctl -u exit-gate -f# If using AppImage (run as regular user)
./electron/dist/Exit\ Gate-0.1.0.AppImage
# If installed via .deb
exit-gateNote: If you get permission errors, DON'T use sudo. Electron apps should not run as root for security reasons.
Edit /etc/exit-gate/config.toml:
[daemon]
socket_path = "/var/run/exit-gate/daemon.sock"
log_level = "info"
enable_ebpf = true
[database]
path = "/var/lib/exit-gate/exit-gate.db"
[ui]
prompt_timeout = 60Terminal 1: Daemon
make dev-daemon
# or
cd daemon && sudo RUST_LOG=debug cargo runTerminal 2: Electron GUI
make dev-electron
# or
cd electron && npm run devexit-gate/
├── ebpf/ # eBPF programs (C)
│ ├── network_monitor.bpf.c
│ └── Makefile
├── daemon/ # Rust daemon
│ ├── src/
│ │ ├── main.rs
│ │ ├── ebpf.rs
│ │ ├── rule.rs
│ │ ├── db.rs
│ │ └── ipc.rs
│ └── Cargo.toml
├── electron/ # Electron GUI
│ ├── src/
│ │ ├── main.ts # Electron main process
│ │ ├── preload.ts # Preload script
│ │ ├── App.tsx # React app
│ │ └── components/ # UI components
│ ├── package.json
│ └── tsconfig.*.json
├── config/ # Default configuration
├── systemd/ # Systemd service files
├── build.sh # Build script
├── package.sh # Packaging script
├── install.sh # Installation script
└── Makefile
Error: stat /root/.cache/electron/...: permission denied
Solution: Don't build as root! Always build as regular user:
exit # Exit from sudo -s
make build
make packageError: Failed to load eBPF program
Solution: Ensure kernel supports eBPF (5.8+) and daemon runs as root:
uname -r # Check kernel version
sudo systemctl status exit-gateError: Failed to bind to socket
Solution: Check if socket path is writable:
sudo mkdir -p /var/run/exit-gate
sudo chown root:root /var/run/exit-gate
sudo systemctl restart exit-gate# Stop and disable service
sudo systemctl stop exit-gate
sudo systemctl disable exit-gate
# Remove files
sudo ./uninstall.sh
# If using .deb package for GUI
sudo dpkg -r exit-gateMIT License - see LICENSE file
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
Inspired by OpenSnitch by @evilsocket
