safing-portmaster/windows_kext
Vladimir Stoilov af3bb804bf
Fix reading only the needed TCP/UDP header bytes ()
* [windows_kext] Fix reading only the needed TCP/UDP header bytes

* [windows_kext] Disable debug mode

* [windows_kext] Block all fragment packets

* [windows_kext] Improve wording for compiler error
2024-11-07 15:52:26 +02:00
..
c_helper Add rust kext to the mono repo 2024-04-29 17:04:08 +03:00
driver Fix reading only the needed TCP/UDP header bytes () 2024-11-07 15:52:26 +02:00
kextinterface Bump kext version 2024-10-16 13:53:48 +02:00
protocol [windows_kext] Improve documentation () 2024-10-28 08:35:02 +02:00
release [windows_kext] Improve documentation () 2024-10-28 08:35:02 +02:00
wdk Fix reading only the needed TCP/UDP header bytes () 2024-11-07 15:52:26 +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
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 [windows_kext] Improve documentation () 2024-10-28 08:35:02 +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

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

Build also works on linux

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

driver.sys should appear in the folder. Load and use the driver.

Test

    cd kext_tester
    go run .

make sure the hardcoded path in main.go is pointing to the correct .sys file