Files
firezone/rust/windows-client
Reactor Scram 6ebbe746e8 feat(windows): count log files (#2964)
There's a 200 ms delay between each file, for debugging. It's nice to
demo how it thinks, but it needs to go behind a fault injection flag or
be removed completely before merging.


![image](https://github.com/firezone/firezone/assets/13400041/af364170-0e76-45fa-83f2-521b3de679de)
2023-12-20 22:38:37 +00:00
..

windows-client

This crate houses a Windows GUI client.

Building

From this dir:

# First-time setup - Install Tauri's dev server / hot-reload tool
cargo install tauri-cli

# Builds a release exe
cargo tauri build

# The release exe, MSI, and NSIS installer should be up in the workspace.
# The exe can run without being installed
stat ../target/release/firezone-windows-client.exe
stat ../target/release/bundle/msi/firezone-windows-client_0.0.0_x64_en-US.msi
stat ../target/release/bundle/nsis/firezone-windows-client_0.0.0_x64-setup.exe

Running

From this dir:

# Tauri has some hot-reloading features. If the Rust code changes it will even recompile and restart the program for you.
RUST_LOG=info,firezone_windows_client=debug cargo tauri dev

# You can call debug subcommands on the exe from this directory too
# e.g. this is equivalent to `cargo run -- debug`
cargo tauri dev -- -- debug

# The exe is up in the workspace
stat ../target/debug/firezone-windows-client.exe

The app's config and logs will be stored at C:\Users\$USER\AppData\Local\dev.firezone.client.

Platform support

Tauri says it should work on Windows 10, Version 1803 and up. Older versions may work if you manually install WebView2

(From Tauri's default README)

Threat model

We can split this to its own doc or generalize it to the whole project if needed.

This is prescriptive.

The Windows client app:

  • SHOULD protect against the device being stolen or tampered with, if Windows is locked the entire time, and if the incident is reported quick enough that the token can be revoked
  • Cannot protect against malicious / rogue users signed in to the application
  • Cannot protect against malware running with the same permissions as the user
  • Cannot protect against an attacker who has physical access to a device while Windows is unlocked

Where the client app does protect against attackers, "protect" is defined as:

  • It should be impractical to read or write the token, while Windows is locked
  • It should be impractical to change the advanced settings to point to a malicious server, while Windows is locked

Security as implemented

The Windows client's encrypted storage uses the keyring crate, which uses Windows' credential management API.

It's hard to find good documentation on how Windows encrypts these secrets, but as I understand it:

  • They are locked by a key derived from the Windows password, so if the password has enough entropy, and Windows is locked or shut down, the passwords are not trivial to exfiltrate
  • They are not readable by other users on the same computer, even when Windows is unlocked
  • They are readable by any process running as the same user, while Windows is unlocked.

To defend against malware running with user permissions, we'd need to somehow identify our app to Windows and tell Windows to store our token in such a way that un-signed apps cannot read it.

Here are some sources I found while researching:

There are at least 2 or 3 different crypto APIs in Windows mentioned in these pages, so not every comment applies to keyring. I think DPAPI is a different API from CredReadW which keyring uses: 1732b79aa3/src/windows.rs (L204)