qubes.ConnectTCP policy bug/missconfig

qubes.ConnectTCP +<PORT> @dispvm:<SOURCE-QUBE> @default allow target=<TARGET-QUBE> should allow me connecting me from any dispvm with source-qube as template to the dedicated port of the targeted qube. But it doesn’t. Is this a bug, did I do something wrong, do you know a work around?

Thank you in advance.

How have you configured the connection in the SOURCE-QUBE, and have you
ensured the connection is being made in the disposables? How are you
creating the tunnel in the disposables?

In my /rw/config/rc.local there is a oneliner: qvm-connect-tcp <Port>:@default:<Port>.
When after creation of the dispvm I manually set qubes.ConnectTCP +<PORT> DISPXXXX @default allow target=<TARGET-QUBE> it even works.

I’m intrigued that @dispvm:<disposable template> is even intended to work in a policy source field - and apparently it is - but yeah it doesn’t actually work, for any RPC.

Please file a bug.

As a workaround, you could add a tag to the disposable template (inherited by the disposable) and match on that with @tag:foo. Unfortunately, @dispvm:@tag:foo is also broken if used in a source field.

Yeah, it isn’t supposed to work. See Qrexec: secure communication across domains — Qubes OS Documentation :

@dispvm means “new VM created for this particular request,” so it is never a source of request

Thanks, but then I wonder why the Policy Editor states so. And source code if I understand it correctly.

Is there any way to achieve something similar? @rustybird said tags are broken too.

You can use @tag: in a source field, it’s only the @dispvm keyword that isn’t supposed to work there.

Should it be rejected at the parser level then or is there a reason not to (in contrast to bare @dispvm without a disposable template and without a tag, which is rejected)? The test suite seems to want the current behavior:

See my comment in the issue ( @dispvm:<template> policy not working · Issue #11017 · QubesOS/qubes-issues · GitHub ). While I can see what it could be interpreted as (any disposable based on a specified template), yet that would be quite confusing, as it’s very different than what the same thing means in the target field (a new disposable, not any existing disposable based on a given template).