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

VPN-6626: Install socks proxy as a service #9952

Merged
merged 24 commits into from
Nov 13, 2024
Merged

Conversation

oskirby
Copy link
Collaborator

@oskirby oskirby commented Oct 11, 2024

Description

Time for some more wild experiments in the VPN extension's proxy. This time we try to make it autonomous as a windows service. For now, this just starts the service using a fixed port number (8123) but eventually we will probably want to make this dynamic (or use named pipes).

In this PR:

  • Finally get around to testing named pipe support on Windows.
  • Add firewall code to automatically install the split tunneling rules.
  • Add a WinSvcThread class to handle the Windows service glue.
  • Generate a sensible logfile so that we can inspect what the service is doing.
  • Add a new service in the Wix installer to start the proxy automatically.
  • Install the proxy tool as a systemd service.

This also adds a firewall policy to restrict the connecting clients to just web browsers. We do this by enumerating the browsers found in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet and building firewall rules to block everything which doesn't originate from one of the browser binaries.

Regarding named pipes, I think ultimately that would be the best way to run this service, since it allows us to perform verification of the client application. And in theory Firefox supports connecting to them as a SOCKS proxy. However, I cannot get it to work locally. I suspect that Firefox has some kind of sandboxing permissions around named pipe access which is preventing the extension from connecting to them. This is probably worthy of some future research into how we want to setup the security around the VPN extension.

Reference

JIRA issue: VPN-6626

Checklist

  • My code follows the style guidelines for this project
  • I have not added any packages that contain high risk or unknown licenses (GPL, LGPL, MPL, etc. consult with DevOps if in question)
  • I have performed a self review of my own code
  • I have commented my code PARTICULARLY in hard to understand areas
  • I have added thorough tests where needed

@oskirby oskirby changed the title Install socks proxy as a Windows service Install socks proxy as a service Oct 25, 2024
@oskirby oskirby force-pushed the naomi-proxy-win-service branch from b5c7c24 to f4b7a3a Compare October 28, 2024 17:59
@oskirby oskirby force-pushed the naomi-proxy-win-service branch from 3b00e48 to ef650c0 Compare November 1, 2024 17:27
@oskirby oskirby changed the title Install socks proxy as a service VPN-6626: Install socks proxy as a service Nov 1, 2024
Copy link
Collaborator

@strseb strseb left a comment

Choose a reason for hiding this comment

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

Great stuff, r+wc

constexpr const QUuid LOCALPROXY_FW_GUID(0x0555706c, 0x4468, 0x4ec6, 0xb4, 47,
0x20, 0xe7, 0x4a, 0x10, 0x06, 0xe7);

WinFwPolicy::WinFwPolicy(QObject* parent) : QObject(parent) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Totally nitpicking here. Maybe a factory function, given the constructor can fail.

@oskirby oskirby merged commit 62cc6b9 into main Nov 13, 2024
116 of 117 checks passed
@oskirby oskirby deleted the naomi-proxy-win-service branch November 13, 2024 22:45
strseb pushed a commit to mozilla-extensions/mozilla-vpn-extension that referenced this pull request Nov 22, 2024
This is a companion PR to mozilla-mobile/mozilla-vpn-client#9952 that
implements Linux support by connecting to the SOCKS proxy as a systemd
service. Basically all we do here is check if the platform is `linux`
and set the bypass proxy to `{type: "socks", host:
"file:/var/run/mozillavpn.proxy", port: 1234}` The port number here
isn't used, but it seems to be required in order to be parsed as a valid
proxy.

Update! Now it supports connecting to the Windows proxy service too.
Similar logic, we just check the platform and generate a fixed proxy
config.
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.

2 participants