This work is based on the original Qubes VPN support project by @tasket. That
project provided the core model and much of the structure for running a VPN
client inside a dedicated Qubes ProxyVM. Credit belongs to @tasket for the
original design and implementation.
I also want to credit @1choice for laying important groundwork for the shift
toward `nftables`.
The goal of this fork is to update and harden the project for a modern Qubes OS
4.3 setup using `nftables`, with a stricter fail-closed security model.
Most existing VPN-in-Qubes approaches either rely heavily on manual firewall
configuration, partially documented scripts, NetworkManager behavior, or older
`iptables` assumptions. Those can work, but they are often less elegant, less
complete, or harder to reason about under failure conditions.
This update keeps the Qubes-native ProxyVM model while making the firewall, DNS,
IPv6, and startup behavior more explicit.
| This work is based on the original Qubes VPN support project by @tasket. That project provided the core model and much of the structure for running a VPN client inside a dedicated Qubes ProxyVM. Credit belongs to @tasket for the original design and implementation.
I also want to credit @1choice for laying important groundwork for the shift toward `nftables`.
The goal of this fork is to update and harden the project for a modern Qubes OS 4.3 setup using `nftables`, with a stricter fail-closed security model.
Most existing VPN-in-Qubes approaches either rely heavily on manual firewall configuration, partially documented scripts, NetworkManager behavior, or older `iptables` assumptions. Those can work, but they are often less elegant, less complete, or harder to reason about under failure conditions.
This update keeps the Qubes-native ProxyVM model while making the firewall, DNS, IPv6, and startup behavior more explicit.
|
- VPN DNS handling falls back to QubesDB on Qubes 4.3 where the older helper file
is absent
- OpenVPN hostname remotes can be resolved through configured VPN DNS before
connection
- Deployment can be staged so config files, certs, and credentials can be added
after ProxyVM creation
- Startup checks verify the expected firewall state before the VPN client runs
| - VPN DNS handling falls back to QubesDB on Qubes 4.3 where the older helper file is absent
- OpenVPN hostname remotes can be resolved through configured VPN DNS before connection
- WireGuard hostname endpoints can also be resolved through configured VPN DNS before connection
- Deployment can be staged so config files, certs, and credentials can be added after ProxyVM creation
- Startup checks verify the expected firewall state before the VPN client runs
- OpenVPN and WireGuard are now split into explicit backend selections instead of sharing one auto-detected startup path
|
OpenVPN is the primary supported backend.
WireGuard support is included through an optional systemd override selected
during ProxyVM initialization, but it should be considered more operationally
sensitive because WireGuard is kernel-driven and does not map as cleanly to the
same userspace process-group egress model.
| OpenVPN remains the primary supported backend.
WireGuard support is now handled through a dedicated service rather than an optional systemd override. It should still be considered more operationally sensitive because WireGuard is kernel-driven and does not map as cleanly to the same userspace process-group egress model.
|
- Enable the relevant Qubes service for this handler, if used by your setup
| - Enable the Qubes service `vpn-handler` if you are using the shipped service model
|
| In the VPN ProxyVM:
| In the VPN ProxyVM, select the backend explicitly.
For OpenVPN:
|
| sudo /usr/lib/qubes/qubes-vpn-setup --config
| sudo /usr/lib/qubes/qubes-vpn-setup --config-openvpn
|
This prepares `/rw/config/vpn/` for you.
It also asks whether to install the optional WireGuard override:
- Answer `y` if this ProxyVM will use WireGuard
- Answer `n` or press Enter to keep the default OpenVPN service settings
| For WireGuard:
```bash
sudo /usr/lib/qubes/qubes-vpn-setup --config-wireguard
```
This prepares `/rw/config/vpn/` for you and writes a persistent backend marker for that ProxyVM under one of:
```text
/rw/config/vpn/backend-openvpn
/rw/config/vpn/backend-wireguard
```
|
Also place any required certs, keys, CRLs, or other provider files in that
directory.
If username/password authentication is needed:
| Also place any required certs, keys, CRLs, or other provider files in that directory.
If username/password authentication is needed for OpenVPN:
|
For the strictest setup, use an IPv4 remote or endpoint address instead of a
hostname.
If WireGuard was selected during `--config`, the persistent override choice is
stored under:
```text
/rw/config/qubes-vpn-handler.service.d/10_wg.conf
```
That override is synced into the live systemd drop-in path on boot.
| For the strictest setup, use an IPv4 remote or endpoint address instead of a hostname.
Backend selection is now stored by the persistent marker files under `/rw/config/vpn/`, not by a WireGuard drop-in under `/rw/config/qubes-vpn-handler.service.d/`.
|
| For OpenVPN:
|
| For WireGuard:
```bash
sudo systemctl restart qubes-firewall.service
sudo systemctl restart qubes-wg-handler.service
sudo systemctl status qubes-wg-handler.service
```
|
| ls -l /rw/config/vpn/backend-openvpn /rw/config/vpn/backend-wireguard
|
| - The VPN tunnel interface exists, for example `tun0`
| - The VPN tunnel interface exists, for example `tun0` for OpenVPN or the WireGuard interface name from the config
|
- `custom-forward` contains downstream-to-VPN forwarding and stateful return
rules
| - `custom-forward` contains downstream-to-VPN forwarding and stateful return rules
|
- IPv6 disablement reports `1`
Only attach downstream AppVMs to the VPN ProxyVM after verifying the tunnel and
DNS rules.
| - IPv6 disablement reports `1`
- Exactly one backend marker exists under `/rw/config/vpn/`
Only attach downstream AppVMs to the VPN ProxyVM after verifying the tunnel and DNS rules.
|
This is security-sensitive networking code. Please test carefully before relying
on it for important workloads.
| This is security-sensitive networking code. Please test carefully before relying on it for important workloads.
|
- WireGuard startup and reconnect behavior work as expected when the override is enabled
- Behavior with non-standard NetVM chains, such as Mirage Firewall or another
ProxyVM
If you find bugs, edge cases, provider-specific issues, or Qubes-version
differences, please open an issue or submit a pull request.
The intent is to make this easier to audit and more robust for the community
while preserving the basic architecture that made the original `Qubes-vpn-support` project
useful. | - WireGuard startup and reconnect behavior work as expected with the dedicated `qubes-wg-handler.service`
- Behavior with non-standard NetVM chains, such as Mirage Firewall or another ProxyVM
If you find bugs, edge cases, provider-specific issues, or Qubes-version differences, please open an issue or submit a pull request.
The intent is to make this easier to audit and more robust for the community while preserving the basic architecture that made the original `Qubes-vpn-support` project useful. |