A Rust desktop application for managing WSL2 Hyper-V firewall rules with a git-like draft/commit workflow and full rollback capability.
This application provides a graphical interface to manage Windows Hyper-V firewall rules specifically for WSL2. It uses the Get-NetFirewallHyperVRule, New-NetFirewallHyperVRule, and Remove-NetFirewallHyperVRule PowerShell cmdlets under the hood.
Running servers inside WSL2 is easy. Accessing them from outside your machine is not.
WSL2 relies on Hyper-V networking, which means exposing ports often requires manual firewall configuration using PowerShell commands — and those settings are fragile and repetitive.
This project was built to make WSL2 port exposure trivial: just click, enter, and your WSL2 service is reachable from the outside.
- Visual Rule Management - View and manage all Hyper-V firewall rules for WSL2
- Git-like Safe Workflow - Stage changes (add/remove/modify) before committing them
- Snapshot History - Automatic snapshots before each commit with full rollback capability
- UAC Elevation on Demand - Read rules without admin rights; elevation requested only for mutations
- WSL Config Validation - Checks for
networkingMode=mirroredin.wslconfig
- WSL Status Monitoring - Real-time indicator showing whether WSL is running
- Automatic Port Discovery - Detects listening TCP ports inside WSL using
lsof - One-Click Rule Creation - Suggests firewall rules for discovered ports with a single click to add
- Smart Filtering - Skips ports that already have rules or were dismissed
- Windows 11 with WSL2 installed (Version 22H2 or higher)
- WSL2 configured with mirrored networking mode
This application requires WSL2 mirrored networking mode. Add to ~/.wslconfig:
[wsl2]
networkingMode=mirroredThen restart WSL: wsl --shutdown
Download the latest release from the Releases page.
# Clone the repository
git clone https://github.com/ssut/wsl2-hyperv-firewall-manager
cd wsl2-hyperv-firewall-manager
# Build in release mode
cargo build --release
# The binary will be at target/release/wsl2-hyperv-firewall-manager.exe- Launch the application - Rules are loaded automatically (no admin required for viewing)
- Stage changes - Add, remove, or modify rules; changes are staged but not applied
- Commit changes - Click "Commit" to apply all staged changes (requires admin elevation)
- Rollback if needed - Use the History panel to restore any previous snapshot
- Start WSL and run your services (e.g.,
python -m http.server 8000) - The status bar shows WSL status with a green indicator when running
- Auto-discover activates automatically when WSL starts
- Floating notifications appear for newly detected ports
- Click "Add" to stage a firewall rule, or dismiss to ignore
| Component | Technology | Version |
|---|---|---|
| UI Framework | gpui + gpui-component | 0.2.2 / 0.5.0 |
| PowerShell Integration | rustclr | 0.3.4 |
| State Persistence | sled | 0.34 |
| Serialization | serde + serde_json | 1.x |
| Async Runtime | tokio | 1.x |
| Error Handling | anyhow + thiserror | 1.x / 2.x |
MIT License
