safing-portmaster/windows_kext
Alexandr Stelnykovych 933323d5f9 feat: add VerdictRerouteToSplitTun verdict type
Add a new verdict (value 8) for routing connections through the split
tunnel. This prepares the infrastructure for the upcoming split-tunneling
feature without implementing the full feature yet.

Changes:
- Define VerdictRerouteToSplitTun in network/status.go with String() and Verb()
- Add RerouteToSplitTun() to the Packet interface and InfoPacket stub
- Implement RerouteToSplitTun() for windowskext (v1) and windowskext2 (v2) packets
- Map VerdictRerouteToSplitTun to KextVerdict 11 in kextinterface and kext2
- Handle the verdict in packet_handler.go dispatch, connection.go, api.go,
  metrics.go and nameserver.go
- Add VerdictRerouteToSplitTun = 8 to Angular Verdict enum and update
  stats counting, filter queries and verdict CSS class

(WIP) Note: Linux (nfq) implementation not updated yet. Therefore Linux build will fail.
2026-04-17 20:48:48 +03:00
..
c_helper Add rust kext to the mono repo 2024-04-29 17:04:08 +03:00
driver Merge pull request #2137 from safing/feature/kext-improvements 2026-03-10 14:23:00 +02:00
kextinterface feat: add VerdictRerouteToSplitTun verdict type 2026-04-17 20:48:48 +03:00
protocol [windows_kext] Improve documentation (#1719) 2024-10-28 08:35:02 +02:00
release [kext] (inf): add PnpLockdown setting to PortmasterKext64.inf 2025-06-20 15:14:29 +03:00
test feat(tests): add documentation and build script for Windows kernel driver testing 2026-03-02 17:08:47 +02:00
wdk Merge pull request #2137 from safing/feature/kext-improvements 2026-03-10 14:23:00 +02:00
.gitignore Add rust kext to the mono repo 2024-04-29 17:04:08 +03:00
Cargo.lock Add rust kext to the mono repo 2024-04-29 17:04:08 +03:00
link-dev.ps1 [kext] Fix dev build documentation 2025-01-28 11:49:23 +02:00
PacketFlow.md [windows_kext] Update docs and few minor fixes 2024-06-05 15:22:45 +03:00
PortmasterKext64.inf Add rust kext to the mono repo 2024-04-29 17:04:08 +03:00
README.md [kext] Fix dev build documentation (releasing procedure) 2025-01-28 14:26:44 +02:00
test_protocol.sh [windows_kext] keep generated test data 2024-05-16 17:29:24 +03:00

Portmaster Windows kext

Implementation of Safing's Portmaster Windows kernel extension in Rust.

Documentation

Building (For release)

Please refer to release/README.md for details about the release procedure.

Building (For testing and development)

The Windows Portmaster Kernel Extension is currently only developed and tested for the amd64 (64-bit) architecture.

Prerequirements:

Setup Test Signing:

Not recommended for a work machine. Usually done on virtual machine dedicated for testing.

In order to test the driver on your machine, you will have to sign it (starting with Windows 10).

Create a new certificate for test signing:

    # Open a *x64 Free Build Environment* console as Administrator.

    # Run the MakeCert.exe tool to create a test certificate:
    MakeCert -r -pe -ss PrivateCertStore -n "CN=DriverCertificate" DriverCertificate.cer

    # Install the test certificate with CertMgr.exe:
    CertMgr /add DriverCertificate.cer /s /r localMachine root

Enable Test Signing on the dev machine:

    # Before you can load test-signed drivers, you must enable Windows test mode. To do this, run this command:
    Bcdedit.exe -set TESTSIGNING ON
    # Then, restart Windows. For more information, see The TESTSIGNING Boot Configuration Option.

Build driver:

    cd driver
    cargo build --release

Build also works on linux

Link and sign: On a windows machine copy driver.lib from the project target directory (driver/target/x86_64-pc-windows-msvc/release/driver.lib) in the same folder as link-dev.ps1. Run link-dev.ps1.

driver.sys should appear in the folder.

Sign the driver with the test certificate:

  SignTool sign /v /s TestCertStoreName /n TestCertName driver.sys

Load and use the driver.