You need to use a few nftables to forward the traffic to the right place, and open the port in the appvm. My guide for forwarding ports (or the firewall documentation) is what you need. This is unrelated to network manager.
I can confirm it’ll work fine, I used such setup last year.
Everything works correctly but not the /rw/config/rc.local script i tried to delete the template-dispvm two times and restart again from scratch and it’s the same result any help please ? I’m using the last version on fedora on 4.3
What i have done so far is put the command of solene in /rw/config/rc.local > sudo chmod +x /rw/config/rc.local
(I noticed that every script i put in /rw/config/rc.local do not work even on debian based vm) and by doing some research i’v seen other people had problem with /rw/config/rc.local in the past
#!/bin/sh
# This script will be executed at every VM startup, you can place your own
# custom commands here. This includes overriding some configuration in /etc,
# starting services etc.
#
# Executable scripts located in /rw/config/rc.local.d with the extension
# '.rc' are executed immediately before this rc.local.
# Example:
# /rw/config/rc.local.d/custom.rc
#
# Example for overriding the whole CUPS configuration:
# rm -rf /etc/cups
# ln -s /rw/config/cups /etc/cups
# systemctl --no-block restart cups
RANDOM_VPN=$(nmcli connection show | awk '/wireguard/ { print $1 }' | sort -R | head -n 1)
nmcli connection up "$RANDOM_VPN"
I said that to give more information but anyway i can’t see where the problem is coming from
To permanently fix this timing issue, I changed in the sys-vpn template the systemd requirement for qubes-misc-post.service , so that it starts after “network-online.target”, not “network-pre.target”:
[deb-12m-vpn]# sed -ie 's/network-pre.target/network-online.target/g' /lib/systemd/system/qubes-misc-post.service
Notes:
this qubes-misc-post.service is running /usr/lib/qubes/init/misc-post.sh which in turn runs any /rw/config/rc.local.d/* scripts and /rw/config/rc.local;
for the impatient users: after the change, the template must be shut down and only then the changes will show up upon further sys-vpn (re)starts
First of all I want to thank you, Solene, for this guide who enabled me to set up a sys-vpn service Qube for wireguard based VPN (by Proton)!
Since I’ll not only want to use this but also understand the underlying concepts and settings I’m asking the following regarding this statement from you:
I just wanted to inform about a low severity information disclosure security vulnerability happening on Qubes 4.3 when following these suggested Wireguard VPN guidelines, at least when using debian-13-xfce template for the VPN gateway qube.
I found it during a routine security audit, and have reported it to the bug tracker, but it may as well be a configuration flaw rather than software bug. If anyone is able to help replicate or prevent this leak, it would be appreciated.
Hey @ryrona I’ve noticed your impeccable work here, as well as debunking that Qubes OS is not secure on the grapheneOS forums, a while back. I also noticed you troubleshooted with Wireshark a USB problem of not being able to attach a pixel running graphene OS on qubes. I would like to ask you, (since there is no DM option), how did you achieve such mastery? Who thinks of running Wireshark on sys-usb and then have enough skill to actually find the problem? This is very inspiring and I hope you get a chance to reply as I’d like to learn and reach your level.
Okay I have been trying for a while now but I can’t get VPN port forwarding to work.
Netcat can’t get a connection at all when listening in the vpn-qube-2 with nc -l $port.
Did not have this issue with wg-quick…
I don’t think any firewall rules should block it.
My setup is vpn-qube-2 > vpn-qube-1 > sys-firewall > sys-net
qvm-firewall blocks everything but the udp port for vpn-qube-1 but no rules at all for vpn-qube-2
If I understand correctly, you want to have a service in vpn-qube-2 listening on a port, and the other side of the VPN should be able to connect, right?
Indeed, sys-firewall and vpn-qube-1 firewalls have nothing to do with this because they all see WireGuard tunnel. You might already know this, but I’m summarizing to be sure we both talk about the same thing
Can vpn-qube-2 and its remote peer able to ping each other?
Did you allow the incoming port in vpn-qube-2 on the WireGuard interface? By default, qubes block all incoming traffic on all interfaces, so it would be the expected behavior to have incoming connections through a VPN to be blocked.