Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block WSL/Hyper-V traffic in secured states (except connected state) #7120

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

dlon
Copy link
Member

@dlon dlon commented Nov 4, 2024

This PR adds a rule for blocking Hyper-V traffic in select states using WMI. This is more or less equivalent to running the PowerShell command New-NetFirewallHyperVRule -Direction Outbound -Action Block -DisplayName "Mullvad VPN block-all rule". Previously, WSL instances would leak while in the blocked (or connecting) state, or while lockdown mode was active.

Close DES-1365.

Fixes #6997.


This change is Reviewable

@dlon dlon requested a review from Serock3 November 4, 2024 08:42
Copy link

linear bot commented Nov 4, 2024

@dlon dlon force-pushed the add-hyperv-blocking-rules branch 3 times, most recently from 2c72f86 to 978ab2b Compare November 4, 2024 08:46
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 6 files at r1, 1 of 2 files at r2, all commit messages.
Reviewable status: 3 of 8 files reviewed, 1 unresolved discussion (waiting on @dlon)


docs/known-issues.md line 193 at r2 (raw file):

Windows host that Mullvad use to prevent leaks). This means that if there is a VPN tunnel
up and running, the Linux guest’s traffic will be sent via the VPN with no leaks!
In the other states, the mitigation above is used to prevent leaks.

You should maybe mention that the fix requires the firewall setting for WSL to be enabled https://learn.microsoft.com/en-us/windows/wsl/wsl-config#main-wsl-settings. It should be be on by default for Windows 11 version 22H2. But with an older version of Windows, or if the setting is explicitly disabled, the app will leak.

Copy link
Member Author

@dlon dlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 8 files reviewed, 1 unresolved discussion (waiting on @Serock3)


docs/known-issues.md line 193 at r2 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

You should maybe mention that the fix requires the firewall setting for WSL to be enabled https://learn.microsoft.com/en-us/windows/wsl/wsl-config#main-wsl-settings. It should be be on by default for Windows 11 version 22H2. But with an older version of Windows, or if the setting is explicitly disabled, the app will leak.

Done. I've clarified that the mitigation doesn't work at all on earlier versions.

Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 6 files at r1, 1 of 2 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@dlon dlon force-pushed the add-hyperv-blocking-rules branch from 47f1291 to 9f3758f Compare November 7, 2024 10:25
@dlon dlon force-pushed the add-hyperv-blocking-rules branch from 9f3758f to a08f093 Compare November 7, 2024 10:26
@dlon dlon merged commit f19d71f into main Nov 7, 2024
59 checks passed
@dlon dlon deleted the add-hyperv-blocking-rules branch November 7, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lockdown mode not working in WSL2
2 participants